diff options
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r-- | fs/ext4/balloc.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 1b26b68aa428..6bba06b09dd1 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -320,20 +320,41 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group) | |||
320 | block_group, bitmap_blk); | 320 | block_group, bitmap_blk); |
321 | return NULL; | 321 | return NULL; |
322 | } | 322 | } |
323 | if (buffer_uptodate(bh) && | 323 | |
324 | !(desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))) | 324 | if (bitmap_uptodate(bh)) |
325 | return bh; | 325 | return bh; |
326 | 326 | ||
327 | lock_buffer(bh); | 327 | lock_buffer(bh); |
328 | if (bitmap_uptodate(bh)) { | ||
329 | unlock_buffer(bh); | ||
330 | return bh; | ||
331 | } | ||
328 | spin_lock(sb_bgl_lock(EXT4_SB(sb), block_group)); | 332 | spin_lock(sb_bgl_lock(EXT4_SB(sb), block_group)); |
329 | if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { | 333 | if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { |
330 | ext4_init_block_bitmap(sb, bh, block_group, desc); | 334 | ext4_init_block_bitmap(sb, bh, block_group, desc); |
335 | set_bitmap_uptodate(bh); | ||
331 | set_buffer_uptodate(bh); | 336 | set_buffer_uptodate(bh); |
332 | spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group)); | 337 | spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group)); |
333 | unlock_buffer(bh); | 338 | unlock_buffer(bh); |
334 | return bh; | 339 | return bh; |
335 | } | 340 | } |
336 | spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group)); | 341 | spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group)); |
342 | if (buffer_uptodate(bh)) { | ||
343 | /* | ||
344 | * if not uninit if bh is uptodate, | ||
345 | * bitmap is also uptodate | ||
346 | */ | ||
347 | set_bitmap_uptodate(bh); | ||
348 | unlock_buffer(bh); | ||
349 | return bh; | ||
350 | } | ||
351 | /* | ||
352 | * submit the buffer_head for read. We can | ||
353 | * safely mark the bitmap as uptodate now. | ||
354 | * We do it here so the bitmap uptodate bit | ||
355 | * get set with buffer lock held. | ||
356 | */ | ||
357 | set_bitmap_uptodate(bh); | ||
337 | if (bh_submit_read(bh) < 0) { | 358 | if (bh_submit_read(bh) < 0) { |
338 | put_bh(bh); | 359 | put_bh(bh); |
339 | ext4_error(sb, __func__, | 360 | ext4_error(sb, __func__, |