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 | |
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')
-rw-r--r-- | fs/ext4/ext4_jbd2.c | 30 | ||||
-rw-r--r-- | fs/ext4/ext4_jbd2.h | 12 |
2 files changed, 12 insertions, 30 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 | } |
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h index dc0b34a903eb..f9fb4bb69577 100644 --- a/fs/ext4/ext4_jbd2.h +++ b/fs/ext4/ext4_jbd2.h | |||
@@ -116,12 +116,8 @@ int ext4_reserve_inode_write(handle_t *handle, struct inode *inode, | |||
116 | int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode); | 116 | int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode); |
117 | 117 | ||
118 | /* | 118 | /* |
119 | * Wrapper functions with which ext4 calls into JBD. The intent here is | 119 | * Wrapper functions with which ext4 calls into JBD. |
120 | * to allow these to be turned into appropriate stubs so ext4 can control | ||
121 | * ext2 filesystems, so ext2+ext4 systems only nee one fs. This work hasn't | ||
122 | * been done yet. | ||
123 | */ | 120 | */ |
124 | |||
125 | void ext4_journal_abort_handle(const char *caller, const char *err_fn, | 121 | void ext4_journal_abort_handle(const char *caller, const char *err_fn, |
126 | struct buffer_head *bh, handle_t *handle, int err); | 122 | struct buffer_head *bh, handle_t *handle, int err); |
127 | 123 | ||
@@ -135,10 +131,6 @@ int __ext4_journal_get_write_access(const char *where, handle_t *handle, | |||
135 | int __ext4_journal_forget(const char *where, handle_t *handle, | 131 | int __ext4_journal_forget(const char *where, handle_t *handle, |
136 | struct buffer_head *bh); | 132 | struct buffer_head *bh); |
137 | 133 | ||
138 | /* When called with an invalid handle, this will still do a put on the BH */ | ||
139 | int __ext4_journal_revoke(const char *where, handle_t *handle, | ||
140 | ext4_fsblk_t blocknr, struct buffer_head *bh); | ||
141 | |||
142 | int __ext4_forget(const char *where, handle_t *handle, int is_metadata, | 134 | int __ext4_forget(const char *where, handle_t *handle, int is_metadata, |
143 | struct inode *inode, struct buffer_head *bh, | 135 | struct inode *inode, struct buffer_head *bh, |
144 | ext4_fsblk_t blocknr); | 136 | ext4_fsblk_t blocknr); |
@@ -153,8 +145,6 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle, | |||
153 | __ext4_journal_get_undo_access(__func__, (handle), (bh)) | 145 | __ext4_journal_get_undo_access(__func__, (handle), (bh)) |
154 | #define ext4_journal_get_write_access(handle, bh) \ | 146 | #define ext4_journal_get_write_access(handle, bh) \ |
155 | __ext4_journal_get_write_access(__func__, (handle), (bh)) | 147 | __ext4_journal_get_write_access(__func__, (handle), (bh)) |
156 | #define ext4_journal_revoke(handle, blocknr, bh) \ | ||
157 | __ext4_journal_revoke(__func__, (handle), (blocknr), (bh)) | ||
158 | #define ext4_forget(handle, is_metadata, inode, bh, block_nr) \ | 148 | #define ext4_forget(handle, is_metadata, inode, bh, block_nr) \ |
159 | __ext4_forget(__func__, (handle), (is_metadata), (inode), (bh),\ | 149 | __ext4_forget(__func__, (handle), (is_metadata), (inode), (bh),\ |
160 | (block_nr)) | 150 | (block_nr)) |