diff options
Diffstat (limited to 'fs/reiserfs/resize.c')
-rw-r--r-- | fs/reiserfs/resize.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c index 90d39fd3096f..315684793d1d 100644 --- a/fs/reiserfs/resize.c +++ b/fs/reiserfs/resize.c | |||
@@ -128,8 +128,9 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
128 | * transaction begins, and the new bitmaps don't matter if the | 128 | * transaction begins, and the new bitmaps don't matter if the |
129 | * transaction fails. */ | 129 | * transaction fails. */ |
130 | for (i = bmap_nr; i < bmap_nr_new; i++) { | 130 | for (i = bmap_nr; i < bmap_nr_new; i++) { |
131 | bh = sb_getblk(s, i * s->s_blocksize * 8); | 131 | /* don't use read_bitmap_block since it will cache |
132 | get_bh(bh); | 132 | * the uninitialized bitmap */ |
133 | bh = sb_bread(s, i * s->s_blocksize * 8); | ||
133 | memset(bh->b_data, 0, sb_blocksize(sb)); | 134 | memset(bh->b_data, 0, sb_blocksize(sb)); |
134 | reiserfs_test_and_set_le_bit(0, bh->b_data); | 135 | reiserfs_test_and_set_le_bit(0, bh->b_data); |
135 | reiserfs_cache_bitmap_metadata(s, bh, bitmap + i); | 136 | reiserfs_cache_bitmap_metadata(s, bh, bitmap + i); |
@@ -140,7 +141,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
140 | // update bitmap_info stuff | 141 | // update bitmap_info stuff |
141 | bitmap[i].first_zero_hint = 1; | 142 | bitmap[i].first_zero_hint = 1; |
142 | bitmap[i].free_count = sb_blocksize(sb) * 8 - 1; | 143 | bitmap[i].free_count = sb_blocksize(sb) * 8 - 1; |
143 | bitmap[i].bh = bh; | ||
144 | brelse(bh); | 144 | brelse(bh); |
145 | } | 145 | } |
146 | /* free old bitmap blocks array */ | 146 | /* free old bitmap blocks array */ |
@@ -157,8 +157,13 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
157 | 157 | ||
158 | /* Extend old last bitmap block - new blocks have been made available */ | 158 | /* Extend old last bitmap block - new blocks have been made available */ |
159 | info = SB_AP_BITMAP(s) + bmap_nr - 1; | 159 | info = SB_AP_BITMAP(s) + bmap_nr - 1; |
160 | bh = info->bh; | 160 | bh = reiserfs_read_bitmap_block(s, bmap_nr - 1); |
161 | get_bh(bh); | 161 | if (!bh) { |
162 | int jerr = journal_end(&th, s, 10); | ||
163 | if (jerr) | ||
164 | return jerr; | ||
165 | return -EIO; | ||
166 | } | ||
162 | 167 | ||
163 | reiserfs_prepare_for_journal(s, bh, 1); | 168 | reiserfs_prepare_for_journal(s, bh, 1); |
164 | for (i = block_r; i < s->s_blocksize * 8; i++) | 169 | for (i = block_r; i < s->s_blocksize * 8; i++) |
@@ -172,8 +177,13 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new) | |||
172 | 177 | ||
173 | /* Correct new last bitmap block - It may not be full */ | 178 | /* Correct new last bitmap block - It may not be full */ |
174 | info = SB_AP_BITMAP(s) + bmap_nr_new - 1; | 179 | info = SB_AP_BITMAP(s) + bmap_nr_new - 1; |
175 | bh = info->bh; | 180 | bh = reiserfs_read_bitmap_block(s, bmap_nr_new - 1); |
176 | get_bh(bh); | 181 | if (!bh) { |
182 | int jerr = journal_end(&th, s, 10); | ||
183 | if (jerr) | ||
184 | return jerr; | ||
185 | return -EIO; | ||
186 | } | ||
177 | 187 | ||
178 | reiserfs_prepare_for_journal(s, bh, 1); | 188 | reiserfs_prepare_for_journal(s, bh, 1); |
179 | for (i = block_r_new; i < s->s_blocksize * 8; i++) | 189 | for (i = block_r_new; i < s->s_blocksize * 8; i++) |