diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-11-24 11:05:59 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-11-24 11:05:59 -0500 |
commit | e4684b3fbb848446683feecb4aee133344c93933 (patch) | |
tree | c3e695ff304a8114e9efad460c30e9948665da66 /fs/ext4/ext4_jbd2.c | |
parent | d6797d14b1640d088652c72508b529a3aea479e3 (diff) |
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.c | 30 |
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, | |||
50 | return err; | 50 | return err; |
51 | } | 51 | } |
52 | 52 | ||
53 | int __ext4_journal_revoke(const char *where, handle_t *handle, | ||
54 | ext4_fsblk_t blocknr, struct buffer_head *bh) | ||
55 | { | ||
56 | int err = 0; | ||
57 | |||
58 | if (ext4_handle_valid(handle)) { | ||
59 | err = jbd2_journal_revoke(handle, blocknr, bh); | ||
60 | if (err) | ||
61 | ext4_journal_abort_handle(where, __func__, bh, | ||
62 | handle, err); | ||
63 | } | ||
64 | else | ||
65 | bforget(bh); | ||
66 | return err; | ||
67 | } | ||
68 | |||
69 | /* | 53 | /* |
70 | * The ext4 forget function must perform a revoke if we are freeing data | 54 | * The ext4 forget function must perform a revoke if we are freeing data |
71 | * which has been journaled. Metadata (eg. indirect blocks) must be | 55 | * 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, | |||
94 | bh, is_metadata, inode->i_mode, | 78 | bh, is_metadata, inode->i_mode, |
95 | test_opt(inode->i_sb, DATA_FLAGS)); | 79 | test_opt(inode->i_sb, DATA_FLAGS)); |
96 | 80 | ||
81 | /* In the no journal case, we can just do a bforget and return */ | ||
82 | if (!ext4_handle_valid(handle)) { | ||
83 | bforget(bh); | ||
84 | return 0; | ||
85 | } | ||
86 | |||
97 | /* Never use the revoke function if we are doing full data | 87 | /* Never use the revoke function if we are doing full data |
98 | * journaling: there is no need to, and a V1 superblock won't | 88 | * journaling: there is no need to, and a V1 superblock won't |
99 | * support it. Otherwise, only skip the revoke on un-journaled | 89 | * 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, | |||
111 | /* | 101 | /* |
112 | * data!=journal && (is_metadata || should_journal_data(inode)) | 102 | * data!=journal && (is_metadata || should_journal_data(inode)) |
113 | */ | 103 | */ |
114 | BUFFER_TRACE(bh, "call ext4_journal_revoke"); | 104 | BUFFER_TRACE(bh, "call jbd2_journal_revoke"); |
115 | err = __ext4_journal_revoke(where, handle, blocknr, bh); | 105 | err = jbd2_journal_revoke(handle, blocknr, bh); |
116 | if (err) | 106 | if (err) { |
107 | ext4_journal_abort_handle(where, __func__, bh, handle, err); | ||
117 | ext4_abort(inode->i_sb, __func__, | 108 | ext4_abort(inode->i_sb, __func__, |
118 | "error %d when attempting revoke", err); | 109 | "error %d when attempting revoke", err); |
110 | } | ||
119 | BUFFER_TRACE(bh, "exit"); | 111 | BUFFER_TRACE(bh, "exit"); |
120 | return err; | 112 | return err; |
121 | } | 113 | } |