From 89a6ebd524891f332aad8ca0281935159ddc1217 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 5 Aug 2001 20:31:09 -0400 Subject: [PATCH] Performance enhancements to speed up creating a journal and block and inode allocation in general. --- lib/ext2fs/ChangeLog | 13 +++++++++++++ lib/ext2fs/alloc.c | 4 ++-- lib/ext2fs/mkjournal.c | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 0c28ed46..9b42fb42 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,16 @@ +2001-08-05 Theodore Tso + + * alloc.c (ext2fs_new_inode, ext2fs_new_block): Use the fast + version of the bitmap test routines to speed up these + routines. (At some point I may want to make these + routines use the find_first_bit functions, but that will + add a lot of complexity since it means that these + functions will have to break the bitmap abstraction + boundary. It's not clear it's worth it.) + + * mkjournal.c (mkjournal_proc): Remember the last block allocated + to speed up ext2fs_new_block(). + 2001-07-29 Theodore Tso * finddev.c (scan_dir): Fix memory leak; we weren't calling diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c index 3661f983..2de05bca 100644 --- a/lib/ext2fs/alloc.c +++ b/lib/ext2fs/alloc.c @@ -55,7 +55,7 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode, i = start_inode; do { - if (!ext2fs_test_inode_bitmap(map, i)) + if (!ext2fs_fast_test_inode_bitmap(map, i)) break; i++; if (i > fs->super->s_inodes_count) @@ -87,7 +87,7 @@ errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal, goal = fs->super->s_first_data_block; i = goal; do { - if (!ext2fs_test_block_bitmap(map, i)) { + if (!ext2fs_fast_test_block_bitmap(map, i)) { *ret = i; return 0; } diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c index 1ba30b2d..606501d7 100644 --- a/lib/ext2fs/mkjournal.c +++ b/lib/ext2fs/mkjournal.c @@ -179,6 +179,7 @@ static int mkjournal_proc(ext2_filsys fs, return BLOCK_ABORT; } *blocknr = new_blk; + last_blk = new_blk; ext2fs_mark_block_bitmap(fs->block_map, new_blk); ext2fs_mark_bb_dirty(fs); group = ext2fs_group_of_blk(fs, new_blk);