diff options
Diffstat (limited to 'fs/ext4/ext4_jbd2.h')
-rw-r--r-- | fs/ext4/ext4_jbd2.h | 83 |
1 files changed, 68 insertions, 15 deletions
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h index b455c685a98b..663197adae56 100644 --- a/fs/ext4/ext4_jbd2.h +++ b/fs/ext4/ext4_jbd2.h | |||
@@ -122,12 +122,6 @@ int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode); | |||
122 | * been done yet. | 122 | * been done yet. |
123 | */ | 123 | */ |
124 | 124 | ||
125 | static inline void ext4_journal_release_buffer(handle_t *handle, | ||
126 | struct buffer_head *bh) | ||
127 | { | ||
128 | jbd2_journal_release_buffer(handle, bh); | ||
129 | } | ||
130 | |||
131 | void ext4_journal_abort_handle(const char *caller, const char *err_fn, | 125 | void ext4_journal_abort_handle(const char *caller, const char *err_fn, |
132 | struct buffer_head *bh, handle_t *handle, int err); | 126 | struct buffer_head *bh, handle_t *handle, int err); |
133 | 127 | ||
@@ -146,8 +140,8 @@ int __ext4_journal_revoke(const char *where, handle_t *handle, | |||
146 | int __ext4_journal_get_create_access(const char *where, | 140 | int __ext4_journal_get_create_access(const char *where, |
147 | handle_t *handle, struct buffer_head *bh); | 141 | handle_t *handle, struct buffer_head *bh); |
148 | 142 | ||
149 | int __ext4_journal_dirty_metadata(const char *where, | 143 | int __ext4_handle_dirty_metadata(const char *where, handle_t *handle, |
150 | handle_t *handle, struct buffer_head *bh); | 144 | struct inode *inode, struct buffer_head *bh); |
151 | 145 | ||
152 | #define ext4_journal_get_undo_access(handle, bh) \ | 146 | #define ext4_journal_get_undo_access(handle, bh) \ |
153 | __ext4_journal_get_undo_access(__func__, (handle), (bh)) | 147 | __ext4_journal_get_undo_access(__func__, (handle), (bh)) |
@@ -157,14 +151,57 @@ int __ext4_journal_dirty_metadata(const char *where, | |||
157 | __ext4_journal_revoke(__func__, (handle), (blocknr), (bh)) | 151 | __ext4_journal_revoke(__func__, (handle), (blocknr), (bh)) |
158 | #define ext4_journal_get_create_access(handle, bh) \ | 152 | #define ext4_journal_get_create_access(handle, bh) \ |
159 | __ext4_journal_get_create_access(__func__, (handle), (bh)) | 153 | __ext4_journal_get_create_access(__func__, (handle), (bh)) |
160 | #define ext4_journal_dirty_metadata(handle, bh) \ | ||
161 | __ext4_journal_dirty_metadata(__func__, (handle), (bh)) | ||
162 | #define ext4_journal_forget(handle, bh) \ | 154 | #define ext4_journal_forget(handle, bh) \ |
163 | __ext4_journal_forget(__func__, (handle), (bh)) | 155 | __ext4_journal_forget(__func__, (handle), (bh)) |
156 | #define ext4_handle_dirty_metadata(handle, inode, bh) \ | ||
157 | __ext4_handle_dirty_metadata(__func__, (handle), (inode), (bh)) | ||
164 | 158 | ||
165 | handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks); | 159 | handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks); |
166 | int __ext4_journal_stop(const char *where, handle_t *handle); | 160 | int __ext4_journal_stop(const char *where, handle_t *handle); |
167 | 161 | ||
162 | #define EXT4_NOJOURNAL_HANDLE ((handle_t *) 0x1) | ||
163 | |||
164 | static inline int ext4_handle_valid(handle_t *handle) | ||
165 | { | ||
166 | if (handle == EXT4_NOJOURNAL_HANDLE) | ||
167 | return 0; | ||
168 | return 1; | ||
169 | } | ||
170 | |||
171 | static inline void ext4_handle_sync(handle_t *handle) | ||
172 | { | ||
173 | if (ext4_handle_valid(handle)) | ||
174 | handle->h_sync = 1; | ||
175 | } | ||
176 | |||
177 | static inline void ext4_handle_release_buffer(handle_t *handle, | ||
178 | struct buffer_head *bh) | ||
179 | { | ||
180 | if (ext4_handle_valid(handle)) | ||
181 | jbd2_journal_release_buffer(handle, bh); | ||
182 | } | ||
183 | |||
184 | static inline int ext4_handle_is_aborted(handle_t *handle) | ||
185 | { | ||
186 | if (ext4_handle_valid(handle)) | ||
187 | return is_handle_aborted(handle); | ||
188 | return 0; | ||
189 | } | ||
190 | |||
191 | static inline int ext4_handle_has_enough_credits(handle_t *handle, int needed) | ||
192 | { | ||
193 | if (ext4_handle_valid(handle) && handle->h_buffer_credits < needed) | ||
194 | return 0; | ||
195 | return 1; | ||
196 | } | ||
197 | |||
198 | static inline void ext4_journal_release_buffer(handle_t *handle, | ||
199 | struct buffer_head *bh) | ||
200 | { | ||
201 | if (ext4_handle_valid(handle)) | ||
202 | jbd2_journal_release_buffer(handle, bh); | ||
203 | } | ||
204 | |||
168 | static inline handle_t *ext4_journal_start(struct inode *inode, int nblocks) | 205 | static inline handle_t *ext4_journal_start(struct inode *inode, int nblocks) |
169 | { | 206 | { |
170 | return ext4_journal_start_sb(inode->i_sb, nblocks); | 207 | return ext4_journal_start_sb(inode->i_sb, nblocks); |
@@ -180,27 +217,37 @@ static inline handle_t *ext4_journal_current_handle(void) | |||
180 | 217 | ||
181 | static inline int ext4_journal_extend(handle_t *handle, int nblocks) | 218 | static inline int ext4_journal_extend(handle_t *handle, int nblocks) |
182 | { | 219 | { |
183 | return jbd2_journal_extend(handle, nblocks); | 220 | if (ext4_handle_valid(handle)) |
221 | return jbd2_journal_extend(handle, nblocks); | ||
222 | return 0; | ||
184 | } | 223 | } |
185 | 224 | ||
186 | static inline int ext4_journal_restart(handle_t *handle, int nblocks) | 225 | static inline int ext4_journal_restart(handle_t *handle, int nblocks) |
187 | { | 226 | { |
188 | return jbd2_journal_restart(handle, nblocks); | 227 | if (ext4_handle_valid(handle)) |
228 | return jbd2_journal_restart(handle, nblocks); | ||
229 | return 0; | ||
189 | } | 230 | } |
190 | 231 | ||
191 | static inline int ext4_journal_blocks_per_page(struct inode *inode) | 232 | static inline int ext4_journal_blocks_per_page(struct inode *inode) |
192 | { | 233 | { |
193 | return jbd2_journal_blocks_per_page(inode); | 234 | if (EXT4_JOURNAL(inode) != NULL) |
235 | return jbd2_journal_blocks_per_page(inode); | ||
236 | return 0; | ||
194 | } | 237 | } |
195 | 238 | ||
196 | static inline int ext4_journal_force_commit(journal_t *journal) | 239 | static inline int ext4_journal_force_commit(journal_t *journal) |
197 | { | 240 | { |
198 | return jbd2_journal_force_commit(journal); | 241 | if (journal) |
242 | return jbd2_journal_force_commit(journal); | ||
243 | return 0; | ||
199 | } | 244 | } |
200 | 245 | ||
201 | static inline int ext4_jbd2_file_inode(handle_t *handle, struct inode *inode) | 246 | static inline int ext4_jbd2_file_inode(handle_t *handle, struct inode *inode) |
202 | { | 247 | { |
203 | return jbd2_journal_file_inode(handle, &EXT4_I(inode)->jinode); | 248 | if (ext4_handle_valid(handle)) |
249 | return jbd2_journal_file_inode(handle, &EXT4_I(inode)->jinode); | ||
250 | return 0; | ||
204 | } | 251 | } |
205 | 252 | ||
206 | /* super.c */ | 253 | /* super.c */ |
@@ -208,6 +255,8 @@ int ext4_force_commit(struct super_block *sb); | |||
208 | 255 | ||
209 | static inline int ext4_should_journal_data(struct inode *inode) | 256 | static inline int ext4_should_journal_data(struct inode *inode) |
210 | { | 257 | { |
258 | if (EXT4_JOURNAL(inode) == NULL) | ||
259 | return 0; | ||
211 | if (!S_ISREG(inode->i_mode)) | 260 | if (!S_ISREG(inode->i_mode)) |
212 | return 1; | 261 | return 1; |
213 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) | 262 | if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) |
@@ -219,6 +268,8 @@ static inline int ext4_should_journal_data(struct inode *inode) | |||
219 | 268 | ||
220 | static inline int ext4_should_order_data(struct inode *inode) | 269 | static inline int ext4_should_order_data(struct inode *inode) |
221 | { | 270 | { |
271 | if (EXT4_JOURNAL(inode) == NULL) | ||
272 | return 0; | ||
222 | if (!S_ISREG(inode->i_mode)) | 273 | if (!S_ISREG(inode->i_mode)) |
223 | return 0; | 274 | return 0; |
224 | if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) | 275 | if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) |
@@ -230,6 +281,8 @@ static inline int ext4_should_order_data(struct inode *inode) | |||
230 | 281 | ||
231 | static inline int ext4_should_writeback_data(struct inode *inode) | 282 | static inline int ext4_should_writeback_data(struct inode *inode) |
232 | { | 283 | { |
284 | if (EXT4_JOURNAL(inode) == NULL) | ||
285 | return 0; | ||
233 | if (!S_ISREG(inode->i_mode)) | 286 | if (!S_ISREG(inode->i_mode)) |
234 | return 0; | 287 | return 0; |
235 | if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) | 288 | if (EXT4_I(inode)->i_flags & EXT4_JOURNAL_DATA_FL) |