[Ocfs2-commits] mfasheh commits r1707 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Dec 16 14:10:21 CST 2004
Author: mfasheh
Date: 2004-12-16 14:10:19 -0600 (Thu, 16 Dec 2004)
New Revision: 1707
Modified:
trunk/src/inode.c
trunk/src/journal.c
trunk/src/ocfs_journal.h
Log:
* checkpoint inodes in clear_inode if they have journalled
metadata. We need to do this because our cluster locks go away there.
Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c 2004-12-16 19:48:24 UTC (rev 1706)
+++ trunk/src/inode.c 2004-12-16 20:10:19 UTC (rev 1707)
@@ -767,10 +767,12 @@
status = ocfs2_free_dinode(handle, inode_alloc_inode,
inode_alloc_bh, fe);
-
- if (status < 0)
+ if (status < 0) {
LOG_ERROR_STATUS(status);
+ goto bail;
+ }
+ SET_INODE_DELETED(inode);
bail:
if (handle)
ocfs_commit_trans(handle);
@@ -820,13 +822,19 @@
goto bail;
}
+ /* We very well may get a clear_inode before all an inodes
+ * metadata has hit disk. Of course, we can't drop any cluster
+ * locks until the journal has finished with it. */
+ if (!INODE_DELETED(inode))
+ ocfs2_checkpoint_inode(inode);
+
OCFS_I(inode)->ip_flags &= ~OCFS_INODE_INITIALIZED;
if (OCFS_I(inode)->ip_blkno == -1)
BUG();
+
OCFS_ASSERT(list_empty(&OCFS_I(inode)->ip_io_markers));
-
/* blkno == 0 if this inode is newly created and hasn't been
* filled in yet. */
if (OCFS_I(inode)->ip_blkno == 0) {
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-12-16 19:48:24 UTC (rev 1706)
+++ trunk/src/journal.c 2004-12-16 20:10:19 UTC (rev 1707)
@@ -114,6 +114,7 @@
#endif
ocfs2_kick_vote_thread(osb);
+ wake_up(&journal->j_checkpointed);
finally:
LOG_EXIT_STATUS (status);
return status;
@@ -692,6 +693,7 @@
osb->journal->lockbh = bh;
atomic_set(&(osb->journal->num_trans), 0);
init_rwsem(&(osb->journal->trans_barrier));
+ init_waitqueue_head(&osb->journal->j_checkpointed);
osb->journal->state = OCFS_JOURNAL_LOADED;
osb->journal->trans_id = (unsigned long) 1;
Modified: trunk/src/ocfs_journal.h
===================================================================
--- trunk/src/ocfs_journal.h 2004-12-16 19:48:24 UTC (rev 1706)
+++ trunk/src/ocfs_journal.h 2004-12-16 20:10:19 UTC (rev 1707)
@@ -67,6 +67,7 @@
/* locking order: trans_lock -> cmt_lock */
spinlock_t cmt_lock; /* protects the committed list */
struct rw_semaphore trans_barrier;
+ wait_queue_head_t j_checkpointed;
};
extern spinlock_t trans_inc_lock;
@@ -95,7 +96,7 @@
* inode. Returns true if all the inodes changes have been
* checkpointed to disk. You should be holding the spinlock on the
* metadata lock while calling this to be sure that nobody can take
- * the lock at put it on another transaction. */
+ * the lock and put it on another transaction. */
static inline int ocfs_inode_fully_checkpointed(struct inode *inode)
{
int ret;
@@ -203,7 +204,24 @@
atomic_set(&osb->needs_checkpoint, 1);
wake_up(&osb->checkpoint_event);
}
+static inline void ocfs2_checkpoint_inode(struct inode *inode)
+{
+ ocfs_super *osb = OCFS_SB(inode->i_sb);
+ if (!ocfs_inode_fully_checkpointed(inode)) {
+ /* WARNING: This only kicks off a single
+ * checkpoint. If someone races you and adds more
+ * metadata to the journal, you won't know, and will
+ * wind up waiting *alot* longer than necessary. Right
+ * now we only use this in clear_inode so that's
+ * OK. */
+ ocfs_start_checkpoint(osb);
+
+ wait_event(osb->journal->j_checkpointed,
+ ocfs_inode_fully_checkpointed(inode));
+ }
+}
+
/*
* Transaction Handling:
* Manage the lifetime of a transaction handle.
More information about the Ocfs2-commits
mailing list