diff options
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r-- | fs/ext4/mballoc.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index aac33590ac64..18a52d39d094 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -794,22 +794,42 @@ static int ext4_mb_init_cache(struct page *page, char *incore) | |||
794 | if (bh[i] == NULL) | 794 | if (bh[i] == NULL) |
795 | goto out; | 795 | goto out; |
796 | 796 | ||
797 | if (buffer_uptodate(bh[i]) && | 797 | if (bitmap_uptodate(bh[i])) |
798 | !(desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT))) | ||
799 | continue; | 798 | continue; |
800 | 799 | ||
801 | lock_buffer(bh[i]); | 800 | lock_buffer(bh[i]); |
801 | if (bitmap_uptodate(bh[i])) { | ||
802 | unlock_buffer(bh[i]); | ||
803 | continue; | ||
804 | } | ||
802 | spin_lock(sb_bgl_lock(EXT4_SB(sb), first_group + i)); | 805 | spin_lock(sb_bgl_lock(EXT4_SB(sb), first_group + i)); |
803 | if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { | 806 | if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { |
804 | ext4_init_block_bitmap(sb, bh[i], | 807 | ext4_init_block_bitmap(sb, bh[i], |
805 | first_group + i, desc); | 808 | first_group + i, desc); |
809 | set_bitmap_uptodate(bh[i]); | ||
806 | set_buffer_uptodate(bh[i]); | 810 | set_buffer_uptodate(bh[i]); |
807 | spin_unlock(sb_bgl_lock(EXT4_SB(sb), first_group + i)); | 811 | spin_unlock(sb_bgl_lock(EXT4_SB(sb), first_group + i)); |
808 | unlock_buffer(bh[i]); | 812 | unlock_buffer(bh[i]); |
809 | continue; | 813 | continue; |
810 | } | 814 | } |
811 | spin_unlock(sb_bgl_lock(EXT4_SB(sb), first_group + i)); | 815 | spin_unlock(sb_bgl_lock(EXT4_SB(sb), first_group + i)); |
816 | if (buffer_uptodate(bh[i])) { | ||
817 | /* | ||
818 | * if not uninit if bh is uptodate, | ||
819 | * bitmap is also uptodate | ||
820 | */ | ||
821 | set_bitmap_uptodate(bh[i]); | ||
822 | unlock_buffer(bh[i]); | ||
823 | continue; | ||
824 | } | ||
812 | get_bh(bh[i]); | 825 | get_bh(bh[i]); |
826 | /* | ||
827 | * submit the buffer_head for read. We can | ||
828 | * safely mark the bitmap as uptodate now. | ||
829 | * We do it here so the bitmap uptodate bit | ||
830 | * get set with buffer lock held. | ||
831 | */ | ||
832 | set_bitmap_uptodate(bh[i]); | ||
813 | bh[i]->b_end_io = end_buffer_read_sync; | 833 | bh[i]->b_end_io = end_buffer_read_sync; |
814 | submit_bh(READ, bh[i]); | 834 | submit_bh(READ, bh[i]); |
815 | mb_debug("read bitmap for group %u\n", first_group + i); | 835 | mb_debug("read bitmap for group %u\n", first_group + i); |