diff options
Diffstat (limited to 'fs/ocfs2/buffer_head_io.c')
-rw-r--r-- | fs/ocfs2/buffer_head_io.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c index 15c8e6deee2e..d43d34a1dd31 100644 --- a/fs/ocfs2/buffer_head_io.c +++ b/fs/ocfs2/buffer_head_io.c | |||
@@ -52,12 +52,12 @@ enum ocfs2_state_bits { | |||
52 | BUFFER_FNS(NeedsValidate, needs_validate); | 52 | BUFFER_FNS(NeedsValidate, needs_validate); |
53 | 53 | ||
54 | int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, | 54 | int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, |
55 | struct inode *inode) | 55 | struct ocfs2_caching_info *ci) |
56 | { | 56 | { |
57 | int ret = 0; | 57 | int ret = 0; |
58 | 58 | ||
59 | mlog_entry("(bh->b_blocknr = %llu, inode=%p)\n", | 59 | mlog_entry("(bh->b_blocknr = %llu, ci=%p)\n", |
60 | (unsigned long long)bh->b_blocknr, inode); | 60 | (unsigned long long)bh->b_blocknr, ci); |
61 | 61 | ||
62 | BUG_ON(bh->b_blocknr < OCFS2_SUPER_BLOCK_BLKNO); | 62 | BUG_ON(bh->b_blocknr < OCFS2_SUPER_BLOCK_BLKNO); |
63 | BUG_ON(buffer_jbd(bh)); | 63 | BUG_ON(buffer_jbd(bh)); |
@@ -70,7 +70,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, | |||
70 | goto out; | 70 | goto out; |
71 | } | 71 | } |
72 | 72 | ||
73 | mutex_lock(&OCFS2_I(inode)->ip_io_mutex); | 73 | ocfs2_metadata_cache_io_lock(ci); |
74 | 74 | ||
75 | lock_buffer(bh); | 75 | lock_buffer(bh); |
76 | set_buffer_uptodate(bh); | 76 | set_buffer_uptodate(bh); |
@@ -85,7 +85,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, | |||
85 | wait_on_buffer(bh); | 85 | wait_on_buffer(bh); |
86 | 86 | ||
87 | if (buffer_uptodate(bh)) { | 87 | if (buffer_uptodate(bh)) { |
88 | ocfs2_set_buffer_uptodate(inode, bh); | 88 | ocfs2_set_buffer_uptodate(ci, bh); |
89 | } else { | 89 | } else { |
90 | /* We don't need to remove the clustered uptodate | 90 | /* We don't need to remove the clustered uptodate |
91 | * information for this bh as it's not marked locally | 91 | * information for this bh as it's not marked locally |
@@ -94,7 +94,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, | |||
94 | put_bh(bh); | 94 | put_bh(bh); |
95 | } | 95 | } |
96 | 96 | ||
97 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); | 97 | ocfs2_metadata_cache_io_unlock(ci); |
98 | out: | 98 | out: |
99 | mlog_exit(ret); | 99 | mlog_exit(ret); |
100 | return ret; | 100 | return ret; |
@@ -177,7 +177,7 @@ bail: | |||
177 | return status; | 177 | return status; |
178 | } | 178 | } |
179 | 179 | ||
180 | int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, | 180 | int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, |
181 | struct buffer_head *bhs[], int flags, | 181 | struct buffer_head *bhs[], int flags, |
182 | int (*validate)(struct super_block *sb, | 182 | int (*validate)(struct super_block *sb, |
183 | struct buffer_head *bh)) | 183 | struct buffer_head *bh)) |
@@ -185,11 +185,12 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, | |||
185 | int status = 0; | 185 | int status = 0; |
186 | int i, ignore_cache = 0; | 186 | int i, ignore_cache = 0; |
187 | struct buffer_head *bh; | 187 | struct buffer_head *bh; |
188 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); | ||
188 | 189 | ||
189 | mlog_entry("(inode=%p, block=(%llu), nr=(%d), flags=%d)\n", | 190 | mlog_entry("(ci=%p, block=(%llu), nr=(%d), flags=%d)\n", |
190 | inode, (unsigned long long)block, nr, flags); | 191 | ci, (unsigned long long)block, nr, flags); |
191 | 192 | ||
192 | BUG_ON(!inode); | 193 | BUG_ON(!ci); |
193 | BUG_ON((flags & OCFS2_BH_READAHEAD) && | 194 | BUG_ON((flags & OCFS2_BH_READAHEAD) && |
194 | (flags & OCFS2_BH_IGNORE_CACHE)); | 195 | (flags & OCFS2_BH_IGNORE_CACHE)); |
195 | 196 | ||
@@ -212,12 +213,12 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, | |||
212 | goto bail; | 213 | goto bail; |
213 | } | 214 | } |
214 | 215 | ||
215 | mutex_lock(&OCFS2_I(inode)->ip_io_mutex); | 216 | ocfs2_metadata_cache_io_lock(ci); |
216 | for (i = 0 ; i < nr ; i++) { | 217 | for (i = 0 ; i < nr ; i++) { |
217 | if (bhs[i] == NULL) { | 218 | if (bhs[i] == NULL) { |
218 | bhs[i] = sb_getblk(inode->i_sb, block++); | 219 | bhs[i] = sb_getblk(sb, block++); |
219 | if (bhs[i] == NULL) { | 220 | if (bhs[i] == NULL) { |
220 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); | 221 | ocfs2_metadata_cache_io_unlock(ci); |
221 | status = -EIO; | 222 | status = -EIO; |
222 | mlog_errno(status); | 223 | mlog_errno(status); |
223 | goto bail; | 224 | goto bail; |
@@ -250,11 +251,11 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, | |||
250 | * before our is-it-in-flight check. | 251 | * before our is-it-in-flight check. |
251 | */ | 252 | */ |
252 | 253 | ||
253 | if (!ignore_cache && !ocfs2_buffer_uptodate(inode, bh)) { | 254 | if (!ignore_cache && !ocfs2_buffer_uptodate(ci, bh)) { |
254 | mlog(ML_UPTODATE, | 255 | mlog(ML_UPTODATE, |
255 | "bh (%llu), inode %llu not uptodate\n", | 256 | "bh (%llu), owner %llu not uptodate\n", |
256 | (unsigned long long)bh->b_blocknr, | 257 | (unsigned long long)bh->b_blocknr, |
257 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 258 | (unsigned long long)ocfs2_metadata_cache_owner(ci)); |
258 | /* We're using ignore_cache here to say | 259 | /* We're using ignore_cache here to say |
259 | * "go to disk" */ | 260 | * "go to disk" */ |
260 | ignore_cache = 1; | 261 | ignore_cache = 1; |
@@ -283,7 +284,7 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, | |||
283 | * previously submitted request than we are | 284 | * previously submitted request than we are |
284 | * done here. */ | 285 | * done here. */ |
285 | if ((flags & OCFS2_BH_READAHEAD) | 286 | if ((flags & OCFS2_BH_READAHEAD) |
286 | && ocfs2_buffer_read_ahead(inode, bh)) | 287 | && ocfs2_buffer_read_ahead(ci, bh)) |
287 | continue; | 288 | continue; |
288 | 289 | ||
289 | lock_buffer(bh); | 290 | lock_buffer(bh); |
@@ -305,7 +306,7 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, | |||
305 | * buffer lock. */ | 306 | * buffer lock. */ |
306 | if (!(flags & OCFS2_BH_IGNORE_CACHE) | 307 | if (!(flags & OCFS2_BH_IGNORE_CACHE) |
307 | && !(flags & OCFS2_BH_READAHEAD) | 308 | && !(flags & OCFS2_BH_READAHEAD) |
308 | && ocfs2_buffer_uptodate(inode, bh)) { | 309 | && ocfs2_buffer_uptodate(ci, bh)) { |
309 | unlock_buffer(bh); | 310 | unlock_buffer(bh); |
310 | continue; | 311 | continue; |
311 | } | 312 | } |
@@ -327,7 +328,7 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, | |||
327 | 328 | ||
328 | if (!(flags & OCFS2_BH_READAHEAD)) { | 329 | if (!(flags & OCFS2_BH_READAHEAD)) { |
329 | /* We know this can't have changed as we hold the | 330 | /* We know this can't have changed as we hold the |
330 | * inode sem. Avoid doing any work on the bh if the | 331 | * owner sem. Avoid doing any work on the bh if the |
331 | * journal has it. */ | 332 | * journal has it. */ |
332 | if (!buffer_jbd(bh)) | 333 | if (!buffer_jbd(bh)) |
333 | wait_on_buffer(bh); | 334 | wait_on_buffer(bh); |
@@ -351,7 +352,7 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, | |||
351 | * that better not have changed */ | 352 | * that better not have changed */ |
352 | BUG_ON(buffer_jbd(bh)); | 353 | BUG_ON(buffer_jbd(bh)); |
353 | clear_buffer_needs_validate(bh); | 354 | clear_buffer_needs_validate(bh); |
354 | status = validate(inode->i_sb, bh); | 355 | status = validate(sb, bh); |
355 | if (status) { | 356 | if (status) { |
356 | put_bh(bh); | 357 | put_bh(bh); |
357 | bhs[i] = NULL; | 358 | bhs[i] = NULL; |
@@ -363,9 +364,9 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, | |||
363 | /* Always set the buffer in the cache, even if it was | 364 | /* Always set the buffer in the cache, even if it was |
364 | * a forced read, or read-ahead which hasn't yet | 365 | * a forced read, or read-ahead which hasn't yet |
365 | * completed. */ | 366 | * completed. */ |
366 | ocfs2_set_buffer_uptodate(inode, bh); | 367 | ocfs2_set_buffer_uptodate(ci, bh); |
367 | } | 368 | } |
368 | mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); | 369 | ocfs2_metadata_cache_io_unlock(ci); |
369 | 370 | ||
370 | mlog(ML_BH_IO, "block=(%llu), nr=(%d), cached=%s, flags=0x%x\n", | 371 | mlog(ML_BH_IO, "block=(%llu), nr=(%d), cached=%s, flags=0x%x\n", |
371 | (unsigned long long)block, nr, | 372 | (unsigned long long)block, nr, |
@@ -399,7 +400,7 @@ static void ocfs2_check_super_or_backup(struct super_block *sb, | |||
399 | 400 | ||
400 | /* | 401 | /* |
401 | * Write super block and backups doesn't need to collaborate with journal, | 402 | * Write super block and backups doesn't need to collaborate with journal, |
402 | * so we don't need to lock ip_io_mutex and inode doesn't need to bea passed | 403 | * so we don't need to lock ip_io_mutex and ci doesn't need to bea passed |
403 | * into this function. | 404 | * into this function. |
404 | */ | 405 | */ |
405 | int ocfs2_write_super_or_backup(struct ocfs2_super *osb, | 406 | int ocfs2_write_super_or_backup(struct ocfs2_super *osb, |