diff options
| author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2009-01-05 21:49:55 -0500 |
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2009-01-05 21:49:55 -0500 |
| commit | 2ccb5fb9f113dae969d1ae9b6c10e80fa34f8cd3 (patch) | |
| tree | d9dc5bca94748d4173a7783e963d20b5a75f8db8 /fs/ext4/mballoc.c | |
| parent | 393418676a7602e1d7d3f6e560159c65c8cbd50e (diff) | |
ext4: Use new buffer_head flag to check uninit group bitmaps initialization
For uninit block group, the on-disk bitmap is not initialized. That
implies we cannot depend on the uptodate flag on the bitmap
buffer_head to find bitmap validity. Use a new buffer_head flag which
would be set after we properly initialize the bitmap. This also
prevents (re-)initializing the uninit group bitmap every time we call
ext4_read_block_bitmap().
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@kernel.org
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 aac33590ac6..18a52d39d09 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); |
