summaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4_jbd2.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-11-24 11:05:59 -0500
committerTheodore Ts'o <tytso@mit.edu>2009-11-24 11:05:59 -0500
commite4684b3fbb848446683feecb4aee133344c93933 (patch)
treec3e695ff304a8114e9efad460c30e9948665da66 /fs/ext4/ext4_jbd2.c
parentd6797d14b1640d088652c72508b529a3aea479e3 (diff)
downloadblackbird-op-linux-e4684b3fbb848446683feecb4aee133344c93933.tar.gz
blackbird-op-linux-e4684b3fbb848446683feecb4aee133344c93933.zip
ext4: fold ext4_journal_revoke() into ext4_forget()
The only caller of ext4_journal_revoke() is ext4_forget(), so we can fold ext4_journal_revoke() into ext4_forget() to simplify the code and shorten the call stack. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4_jbd2.c')
-rw-r--r--fs/ext4/ext4_jbd2.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index 913f85715433..92c88a8f734d 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -50,22 +50,6 @@ int __ext4_journal_forget(const char *where, handle_t *handle,
return err;
}
-int __ext4_journal_revoke(const char *where, handle_t *handle,
- ext4_fsblk_t blocknr, struct buffer_head *bh)
-{
- int err = 0;
-
- if (ext4_handle_valid(handle)) {
- err = jbd2_journal_revoke(handle, blocknr, bh);
- if (err)
- ext4_journal_abort_handle(where, __func__, bh,
- handle, err);
- }
- else
- bforget(bh);
- return err;
-}
-
/*
* The ext4 forget function must perform a revoke if we are freeing data
* which has been journaled. Metadata (eg. indirect blocks) must be
@@ -94,6 +78,12 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata,
bh, is_metadata, inode->i_mode,
test_opt(inode->i_sb, DATA_FLAGS));
+ /* In the no journal case, we can just do a bforget and return */
+ if (!ext4_handle_valid(handle)) {
+ bforget(bh);
+ return 0;
+ }
+
/* Never use the revoke function if we are doing full data
* journaling: there is no need to, and a V1 superblock won't
* support it. Otherwise, only skip the revoke on un-journaled
@@ -111,11 +101,13 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata,
/*
* data!=journal && (is_metadata || should_journal_data(inode))
*/
- BUFFER_TRACE(bh, "call ext4_journal_revoke");
- err = __ext4_journal_revoke(where, handle, blocknr, bh);
- if (err)
+ BUFFER_TRACE(bh, "call jbd2_journal_revoke");
+ err = jbd2_journal_revoke(handle, blocknr, bh);
+ if (err) {
+ ext4_journal_abort_handle(where, __func__, bh, handle, err);
ext4_abort(inode->i_sb, __func__,
"error %d when attempting revoke", err);
+ }
BUFFER_TRACE(bh, "exit");
return err;
}
OpenPOWER on IntegriCloud