Commit eacf9510 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] JBD: rename journal_unlock_journal_head to

journal_unlock_journal_head() is misnamed: what it does is to drop a ref on
the journal_head and free it if that ref fell to zero.  It doesn't actually
unlock anything.

Rename it to journal_put_journal_head().
parent 1c69516f
...@@ -487,7 +487,7 @@ void journal_commit_transaction(journal_t *journal) ...@@ -487,7 +487,7 @@ void journal_commit_transaction(journal_t *journal)
*/ */
bh = jh2bh(jh); bh = jh2bh(jh);
BUFFER_TRACE(bh, "dumping temporary bh"); BUFFER_TRACE(bh, "dumping temporary bh");
journal_unlock_journal_head(jh); journal_put_journal_head(jh);
__brelse(bh); __brelse(bh);
J_ASSERT_BH(bh, atomic_read(&bh->b_count) == 0); J_ASSERT_BH(bh, atomic_read(&bh->b_count) == 0);
free_buffer_head(bh); free_buffer_head(bh);
...@@ -536,7 +536,7 @@ void journal_commit_transaction(journal_t *journal) ...@@ -536,7 +536,7 @@ void journal_commit_transaction(journal_t *journal)
clear_bit(BH_JWrite, &bh->b_state); clear_bit(BH_JWrite, &bh->b_state);
journal_unfile_buffer(jh); journal_unfile_buffer(jh);
jh->b_transaction = NULL; jh->b_transaction = NULL;
journal_unlock_journal_head(jh); journal_put_journal_head(jh);
__brelse(bh); /* One for getblk */ __brelse(bh); /* One for getblk */
/* AKPM: bforget here */ /* AKPM: bforget here */
} }
...@@ -578,7 +578,7 @@ void journal_commit_transaction(journal_t *journal) ...@@ -578,7 +578,7 @@ void journal_commit_transaction(journal_t *journal)
if (unlikely(!buffer_uptodate(bh))) if (unlikely(!buffer_uptodate(bh)))
err = -EIO; err = -EIO;
put_bh(bh); /* One for getblk() */ put_bh(bh); /* One for getblk() */
journal_unlock_journal_head(descriptor); journal_put_journal_head(descriptor);
} }
/* End of a transaction! Finally, we can do checkpoint /* End of a transaction! Finally, we can do checkpoint
......
...@@ -1686,7 +1686,7 @@ static void journal_free_journal_head(struct journal_head *jh) ...@@ -1686,7 +1686,7 @@ static void journal_free_journal_head(struct journal_head *jh)
* _before_ attaching the journal_head to a transaction. To protect the * _before_ attaching the journal_head to a transaction. To protect the
* journal_head in this situation, journal_add_journal_head elevates the * journal_head in this situation, journal_add_journal_head elevates the
* journal_head's b_jcount refcount by one. The caller must call * journal_head's b_jcount refcount by one. The caller must call
* journal_unlock_journal_head() to undo this. * journal_put_journal_head() to undo this.
* *
* So the typical usage would be: * So the typical usage would be:
* *
...@@ -1694,7 +1694,7 @@ static void journal_free_journal_head(struct journal_head *jh) ...@@ -1694,7 +1694,7 @@ static void journal_free_journal_head(struct journal_head *jh)
* struct journal_head *jh = journal_add_journal_head(bh); * struct journal_head *jh = journal_add_journal_head(bh);
* ... * ...
* jh->b_transaction = xxx; * jh->b_transaction = xxx;
* journal_unlock_journal_head(jh); * journal_put_journal_head(jh);
* *
* Now, the journal_head's b_jcount is zero, but it is safe from being released * Now, the journal_head's b_jcount is zero, but it is safe from being released
* because it has a non-zero b_transaction. * because it has a non-zero b_transaction.
...@@ -1791,7 +1791,11 @@ void journal_remove_journal_head(struct buffer_head *bh) ...@@ -1791,7 +1791,11 @@ void journal_remove_journal_head(struct buffer_head *bh)
jbd_unlock_bh_journal_head(bh); jbd_unlock_bh_journal_head(bh);
} }
void journal_unlock_journal_head(struct journal_head *jh) /*
* Drop a reference on the passed journal_head. If it fell to zero then try to
* release the journal_head from the buffer_head.
*/
void journal_put_journal_head(struct journal_head *jh)
{ {
struct buffer_head *bh = jh2bh(jh); struct buffer_head *bh = jh2bh(jh);
......
...@@ -725,7 +725,7 @@ int journal_get_write_access (handle_t *handle, struct buffer_head *bh) ...@@ -725,7 +725,7 @@ int journal_get_write_access (handle_t *handle, struct buffer_head *bh)
* completes any outstanding IO before proceeding. */ * completes any outstanding IO before proceeding. */
lock_journal(journal); lock_journal(journal);
rc = do_get_write_access(handle, jh, 0); rc = do_get_write_access(handle, jh, 0);
journal_unlock_journal_head(jh); journal_put_journal_head(jh);
unlock_journal(journal); unlock_journal(journal);
return rc; return rc;
} }
...@@ -802,7 +802,7 @@ int journal_get_create_access (handle_t *handle, struct buffer_head *bh) ...@@ -802,7 +802,7 @@ int journal_get_create_access (handle_t *handle, struct buffer_head *bh)
JBUFFER_TRACE(jh, "cancelling revoke"); JBUFFER_TRACE(jh, "cancelling revoke");
lock_kernel(); lock_kernel();
journal_cancel_revoke(handle, jh); journal_cancel_revoke(handle, jh);
journal_unlock_journal_head(jh); journal_put_journal_head(jh);
unlock_kernel(); unlock_kernel();
out: out:
unlock_journal(journal); unlock_journal(journal);
...@@ -877,7 +877,7 @@ int journal_get_undo_access (handle_t *handle, struct buffer_head *bh) ...@@ -877,7 +877,7 @@ int journal_get_undo_access (handle_t *handle, struct buffer_head *bh)
out: out:
if (!err) if (!err)
J_ASSERT_JH(jh, jh->b_committed_data); J_ASSERT_JH(jh, jh->b_committed_data);
journal_unlock_journal_head(jh); journal_put_journal_head(jh);
unlock_journal(journal); unlock_journal(journal);
return err; return err;
} }
...@@ -1035,7 +1035,7 @@ int journal_dirty_data (handle_t *handle, struct buffer_head *bh) ...@@ -1035,7 +1035,7 @@ int journal_dirty_data (handle_t *handle, struct buffer_head *bh)
__brelse(bh); __brelse(bh);
} }
JBUFFER_TRACE(jh, "exit"); JBUFFER_TRACE(jh, "exit");
journal_unlock_journal_head(jh); journal_put_journal_head(jh);
return 0; return 0;
} }
......
...@@ -967,7 +967,7 @@ extern int journal_force_commit(journal_t *); ...@@ -967,7 +967,7 @@ extern int journal_force_commit(journal_t *);
extern struct journal_head extern struct journal_head
*journal_add_journal_head(struct buffer_head *bh); *journal_add_journal_head(struct buffer_head *bh);
extern void journal_remove_journal_head(struct buffer_head *bh); extern void journal_remove_journal_head(struct buffer_head *bh);
extern void journal_unlock_journal_head(struct journal_head *jh); extern void journal_put_journal_head(struct journal_head *jh);
/* /*
* handle management * handle management
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment