diff options
author | Jeff Mahoney <jeffm@suse.com> | 2006-10-01 02:28:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:28 -0400 |
commit | 5065227b46235ec0131b383cc2f537069b55c6b6 (patch) | |
tree | 12187734ef619626c901b9d2b43ad72286d4d258 /fs/reiserfs/super.c | |
parent | 6f01046b35d940079822827498a7dd6d3eec8c6b (diff) |
[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/super.c')
-rw-r--r-- | fs/reiserfs/super.c | 39 |
1 files changed, 9 insertions, 30 deletions
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index c78e99e196fa..c89aa2338191 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -432,7 +432,6 @@ int remove_save_link(struct inode *inode, int truncate) | |||
432 | 432 | ||
433 | static void reiserfs_put_super(struct super_block *s) | 433 | static void reiserfs_put_super(struct super_block *s) |
434 | { | 434 | { |
435 | int i; | ||
436 | struct reiserfs_transaction_handle th; | 435 | struct reiserfs_transaction_handle th; |
437 | th.t_trans_id = 0; | 436 | th.t_trans_id = 0; |
438 | 437 | ||
@@ -462,10 +461,7 @@ static void reiserfs_put_super(struct super_block *s) | |||
462 | */ | 461 | */ |
463 | journal_release(&th, s); | 462 | journal_release(&th, s); |
464 | 463 | ||
465 | for (i = 0; i < SB_BMAP_NR(s); i++) | 464 | reiserfs_free_bitmap_cache(s); |
466 | brelse(SB_AP_BITMAP(s)[i].bh); | ||
467 | |||
468 | vfree(SB_AP_BITMAP(s)); | ||
469 | 465 | ||
470 | brelse(SB_BUFFER_WITH_SB(s)); | 466 | brelse(SB_BUFFER_WITH_SB(s)); |
471 | 467 | ||
@@ -1344,7 +1340,6 @@ static int read_super_block(struct super_block *s, int offset) | |||
1344 | /* after journal replay, reread all bitmap and super blocks */ | 1340 | /* after journal replay, reread all bitmap and super blocks */ |
1345 | static int reread_meta_blocks(struct super_block *s) | 1341 | static int reread_meta_blocks(struct super_block *s) |
1346 | { | 1342 | { |
1347 | int i; | ||
1348 | ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s))); | 1343 | ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s))); |
1349 | wait_on_buffer(SB_BUFFER_WITH_SB(s)); | 1344 | wait_on_buffer(SB_BUFFER_WITH_SB(s)); |
1350 | if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) { | 1345 | if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) { |
@@ -1353,20 +1348,7 @@ static int reread_meta_blocks(struct super_block *s) | |||
1353 | return 1; | 1348 | return 1; |
1354 | } | 1349 | } |
1355 | 1350 | ||
1356 | for (i = 0; i < SB_BMAP_NR(s); i++) { | ||
1357 | ll_rw_block(READ, 1, &(SB_AP_BITMAP(s)[i].bh)); | ||
1358 | wait_on_buffer(SB_AP_BITMAP(s)[i].bh); | ||
1359 | if (!buffer_uptodate(SB_AP_BITMAP(s)[i].bh)) { | ||
1360 | reiserfs_warning(s, | ||
1361 | "reread_meta_blocks, error reading bitmap block number %d at %llu", | ||
1362 | i, | ||
1363 | (unsigned long long)SB_AP_BITMAP(s)[i]. | ||
1364 | bh->b_blocknr); | ||
1365 | return 1; | ||
1366 | } | ||
1367 | } | ||
1368 | return 0; | 1351 | return 0; |
1369 | |||
1370 | } | 1352 | } |
1371 | 1353 | ||
1372 | ///////////////////////////////////////////////////// | 1354 | ///////////////////////////////////////////////////// |
@@ -1547,7 +1529,6 @@ static int function2code(hashf_t func) | |||
1547 | static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | 1529 | static int reiserfs_fill_super(struct super_block *s, void *data, int silent) |
1548 | { | 1530 | { |
1549 | struct inode *root_inode; | 1531 | struct inode *root_inode; |
1550 | int j; | ||
1551 | struct reiserfs_transaction_handle th; | 1532 | struct reiserfs_transaction_handle th; |
1552 | int old_format = 0; | 1533 | int old_format = 0; |
1553 | unsigned long blocks; | 1534 | unsigned long blocks; |
@@ -1793,19 +1774,17 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1793 | if (jinit_done) { /* kill the commit thread, free journal ram */ | 1774 | if (jinit_done) { /* kill the commit thread, free journal ram */ |
1794 | journal_release_error(NULL, s); | 1775 | journal_release_error(NULL, s); |
1795 | } | 1776 | } |
1796 | if (SB_DISK_SUPER_BLOCK(s)) { | 1777 | |
1797 | for (j = 0; j < SB_BMAP_NR(s); j++) { | 1778 | reiserfs_free_bitmap_cache(s); |
1798 | if (SB_AP_BITMAP(s)) | ||
1799 | brelse(SB_AP_BITMAP(s)[j].bh); | ||
1800 | } | ||
1801 | vfree(SB_AP_BITMAP(s)); | ||
1802 | } | ||
1803 | if (SB_BUFFER_WITH_SB(s)) | 1779 | if (SB_BUFFER_WITH_SB(s)) |
1804 | brelse(SB_BUFFER_WITH_SB(s)); | 1780 | brelse(SB_BUFFER_WITH_SB(s)); |
1805 | #ifdef CONFIG_QUOTA | 1781 | #ifdef CONFIG_QUOTA |
1806 | for (j = 0; j < MAXQUOTAS; j++) { | 1782 | { |
1807 | kfree(sbi->s_qf_names[j]); | 1783 | int j; |
1808 | sbi->s_qf_names[j] = NULL; | 1784 | for (j = 0; j < MAXQUOTAS; j++) { |
1785 | kfree(sbi->s_qf_names[j]); | ||
1786 | sbi->s_qf_names[j] = NULL; | ||
1787 | } | ||
1809 | } | 1788 | } |
1810 | #endif | 1789 | #endif |
1811 | kfree(sbi); | 1790 | kfree(sbi); |