aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/resize.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2006-09-30 23:28:44 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 00:39:28 -0700
commit5065227b46235ec0131b383cc2f537069b55c6b6 (patch)
tree12187734ef619626c901b9d2b43ad72286d4d258 /fs/reiserfs/resize.c
parent6f01046b35d940079822827498a7dd6d3eec8c6b (diff)
downloadkernel_samsung_smdk4412-5065227b46235ec0131b383cc2f537069b55c6b6.tar.gz
kernel_samsung_smdk4412-5065227b46235ec0131b383cc2f537069b55c6b6.tar.bz2
kernel_samsung_smdk4412-5065227b46235ec0131b383cc2f537069b55c6b6.zip
[PATCH] reiserfs: on-demand bitmap loading
This is the patch the three previous ones have been leading up to. It changes the behavior of ReiserFS from loading and caching all the bitmaps as special, to treating the bitmaps like any other bit of metadata and just letting the system-wide caches figure out what to hang on to. Buffer heads are allocated on the fly, so there is no need to retain pointers to all of them. The caching of the metadata occurs when the data is read and updated, and is considered invalid and uncached until then. I needed to remove the vs-4040 check for performing a duplicate operation on a particular bit. The reason is that while the other sites for working with bitmaps are allowed to schedule, is_reusable() is called from do_balance(), which will panic if a schedule occurs in certain places. The benefit of on-demand bitmaps clearly outweighs a sanity check that depends on a compile-time option that is discouraged. [akpm@osdl.org: warning fix] Signed-off-by: Jeff Mahoney <jeffm@suse.com> Cc: <reiserfs-dev@namesys.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/reiserfs/resize.c')
-rw-r--r--fs/reiserfs/resize.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/fs/reiserfs/resize.c b/fs/reiserfs/resize.c
index 90d39fd3096..315684793d1 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)
* transaction begins, and the new bitmaps don't matter if the
* transaction fails. */
for (i = bmap_nr; i < bmap_nr_new; i++) {
- bh = sb_getblk(s, i * s->s_blocksize * 8);
- get_bh(bh);
+ /* don't use read_bitmap_block since it will cache
+ * the uninitialized bitmap */
+ bh = sb_bread(s, i * s->s_blocksize * 8);
memset(bh->b_data, 0, sb_blocksize(sb));
reiserfs_test_and_set_le_bit(0, bh->b_data);
reiserfs_cache_bitmap_metadata(s, bh, bitmap + i);
@@ -140,7 +141,6 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
// update bitmap_info stuff
bitmap[i].first_zero_hint = 1;
bitmap[i].free_count = sb_blocksize(sb) * 8 - 1;
- bitmap[i].bh = bh;
brelse(bh);
}
/* free old bitmap blocks array */
@@ -157,8 +157,13 @@ int reiserfs_resize(struct super_block *s, unsigned long block_count_new)
/* Extend old last bitmap block - new blocks have been made available */
info = SB_AP_BITMAP(s) + bmap_nr - 1;
- bh = info->bh;
- get_bh(bh);
+ bh = reiserfs_read_bitmap_block(s, bmap_nr - 1);
+ if (!bh) {
+ int jerr = journal_end(&th, s, 10);
+ if (jerr)
+ return jerr;
+ return -EIO;
+ }
reiserfs_prepare_for_journal(s, bh, 1);
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)
/* Correct new last bitmap block - It may not be full */
info = SB_AP_BITMAP(s) + bmap_nr_new - 1;
- bh = info->bh;
- get_bh(bh);
+ bh = reiserfs_read_bitmap_block(s, bmap_nr_new - 1);
+ if (!bh) {
+ int jerr = journal_end(&th, s, 10);
+ if (jerr)
+ return jerr;
+ return -EIO;
+ }
reiserfs_prepare_for_journal(s, bh, 1);
for (i = block_r_new; i < s->s_blocksize * 8; i++)