Browse Source

ocfs2: remove ocfs2_journal_handle flags field

Callers can set h_sync directly on the handle_t, whether a transaction has
been started or not can be determined via the existence of the handle_t on
the struct ocfs2_journal_handle.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Mark Fasheh 18 years ago
parent
commit
c161f89be7
4 changed files with 4 additions and 32 deletions
  1. 1 12
      fs/ocfs2/journal.c
  2. 0 17
      fs/ocfs2/journal.h
  3. 2 2
      fs/ocfs2/localalloc.c
  4. 1 1
      fs/ocfs2/suballoc.c

+ 1 - 12
fs/ocfs2/journal.c

@@ -190,7 +190,6 @@ struct ocfs2_journal_handle *ocfs2_start_trans(struct ocfs2_super *osb,
 	}
 	}
 
 
 	atomic_inc(&(osb->journal->j_num_trans));
 	atomic_inc(&(osb->journal->j_num_trans));
-	handle->flags |= OCFS2_HANDLE_STARTED;
 
 
 	mlog_exit_ptr(handle);
 	mlog_exit_ptr(handle);
 	return handle;
 	return handle;
@@ -247,8 +246,6 @@ static void ocfs2_commit_unstarted_handle(struct ocfs2_journal_handle *handle)
 {
 {
 	mlog_entry_void();
 	mlog_entry_void();
 
 
-	BUG_ON(handle->flags & OCFS2_HANDLE_STARTED);
-
 	ocfs2_handle_unlock_inodes(handle);
 	ocfs2_handle_unlock_inodes(handle);
 	/* You are allowed to add journal locks before the transaction
 	/* You are allowed to add journal locks before the transaction
 	 * has started. */
 	 * has started. */
@@ -269,7 +266,7 @@ void ocfs2_commit_trans(struct ocfs2_journal_handle *handle)
 
 
 	BUG_ON(!handle);
 	BUG_ON(!handle);
 
 
-	if (!(handle->flags & OCFS2_HANDLE_STARTED)) {
+	if (!handle->k_handle) {
 		ocfs2_commit_unstarted_handle(handle);
 		ocfs2_commit_unstarted_handle(handle);
 		mlog_exit_void();
 		mlog_exit_void();
 		return;
 		return;
@@ -285,11 +282,6 @@ void ocfs2_commit_trans(struct ocfs2_journal_handle *handle)
 	if (handle->k_handle) {
 	if (handle->k_handle) {
 		jbd_handle = handle->k_handle;
 		jbd_handle = handle->k_handle;
 
 
-		if (handle->flags & OCFS2_HANDLE_SYNC)
-			jbd_handle->h_sync = 1;
-		else
-			jbd_handle->h_sync = 0;
-
 		/* actually stop the transaction. if we've set h_sync,
 		/* actually stop the transaction. if we've set h_sync,
 		 * it'll have been committed when we return */
 		 * it'll have been committed when we return */
 		retval = journal_stop(jbd_handle);
 		retval = journal_stop(jbd_handle);
@@ -366,7 +358,6 @@ int ocfs2_journal_access(struct ocfs2_journal_handle *handle,
 	BUG_ON(!inode);
 	BUG_ON(!inode);
 	BUG_ON(!handle);
 	BUG_ON(!handle);
 	BUG_ON(!bh);
 	BUG_ON(!bh);
-	BUG_ON(!(handle->flags & OCFS2_HANDLE_STARTED));
 
 
 	mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %zu\n",
 	mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %zu\n",
 		   (unsigned long long)bh->b_blocknr, type,
 		   (unsigned long long)bh->b_blocknr, type,
@@ -421,8 +412,6 @@ int ocfs2_journal_dirty(struct ocfs2_journal_handle *handle,
 {
 {
 	int status;
 	int status;
 
 
-	BUG_ON(!(handle->flags & OCFS2_HANDLE_STARTED));
-
 	mlog_entry("(bh->b_blocknr=%llu)\n",
 	mlog_entry("(bh->b_blocknr=%llu)\n",
 		   (unsigned long long)bh->b_blocknr);
 		   (unsigned long long)bh->b_blocknr);
 
 

+ 0 - 17
fs/ocfs2/journal.h

@@ -143,7 +143,6 @@ struct ocfs2_journal_lock {
 struct ocfs2_journal_handle {
 struct ocfs2_journal_handle {
 	handle_t            *k_handle; /* kernel handle.                */
 	handle_t            *k_handle; /* kernel handle.                */
 	struct ocfs2_journal        *journal;
 	struct ocfs2_journal        *journal;
-	u32                 flags;     /* see flags below.              */
 
 
 	/* The following two fields are for ocfs2_handle_add_lock */
 	/* The following two fields are for ocfs2_handle_add_lock */
 	int                 num_locks;
 	int                 num_locks;
@@ -154,22 +153,6 @@ struct ocfs2_journal_handle {
 	struct list_head     inode_list;
 	struct list_head     inode_list;
 };
 };
 
 
-#define OCFS2_HANDLE_STARTED			1
-/* should we sync-commit this handle? */
-#define OCFS2_HANDLE_SYNC			2
-static inline int ocfs2_handle_started(struct ocfs2_journal_handle *handle)
-{
-	return handle->flags & OCFS2_HANDLE_STARTED;
-}
-
-static inline void ocfs2_handle_set_sync(struct ocfs2_journal_handle *handle, int sync)
-{
-	if (sync)
-		handle->flags |= OCFS2_HANDLE_SYNC;
-	else
-		handle->flags &= ~OCFS2_HANDLE_SYNC;
-}
-
 /* Exported only for the journal struct init code in super.c. Do not call. */
 /* Exported only for the journal struct init code in super.c. Do not call. */
 void ocfs2_complete_recovery(void *data);
 void ocfs2_complete_recovery(void *data);
 
 

+ 2 - 2
fs/ocfs2/localalloc.c

@@ -423,7 +423,7 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb,
 	}
 	}
 
 
 	/* we want the bitmap change to be recorded on disk asap */
 	/* we want the bitmap change to be recorded on disk asap */
-	ocfs2_handle_set_sync(handle, 1);
+	handle->k_handle->h_sync = 1;
 
 
 	status = ocfs2_sync_local_to_main(osb, handle, alloc,
 	status = ocfs2_sync_local_to_main(osb, handle, alloc,
 					  main_bm_inode, main_bm_bh);
 					  main_bm_inode, main_bm_bh);
@@ -465,7 +465,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb,
 
 
 	BUG_ON(!passed_handle);
 	BUG_ON(!passed_handle);
 	BUG_ON(!ac);
 	BUG_ON(!ac);
-	BUG_ON(passed_handle->flags & OCFS2_HANDLE_STARTED);
+	BUG_ON(passed_handle->k_handle);
 
 
 	local_alloc_inode =
 	local_alloc_inode =
 		ocfs2_get_system_file_inode(osb,
 		ocfs2_get_system_file_inode(osb,

+ 1 - 1
fs/ocfs2/suballoc.c

@@ -414,7 +414,7 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb,
 
 
 	mlog_entry_void();
 	mlog_entry_void();
 
 
-	BUG_ON(handle->flags & OCFS2_HANDLE_STARTED);
+	BUG_ON(handle->k_handle);
 
 
 	ocfs2_handle_add_inode(handle, alloc_inode);
 	ocfs2_handle_add_inode(handle, alloc_inode);
 	status = ocfs2_meta_lock(alloc_inode, handle, &bh, 1);
 	status = ocfs2_meta_lock(alloc_inode, handle, &bh, 1);