libext2fs: grow dblist more aggressively

Make the dblist grow more quickly when many directory blocks are added,
otherwise the array has to get copied too often, which is slow when it
is large.

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
bitmap-optimize
Andreas Dilger 2008-08-23 21:17:17 -06:00 committed by Theodore Ts'o
parent ba7b0feef6
commit 9f9e5c3aea
1 changed files with 1 additions and 1 deletions

View File

@ -164,7 +164,7 @@ errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk,
if (dblist->count >= dblist->size) {
old_size = dblist->size * sizeof(struct ext2_db_entry);
dblist->size += 100;
dblist->size += dblist->size > 200 ? dblist->size / 2 : 100;
retval = ext2fs_resize_mem(old_size, (size_t) dblist->size *
sizeof(struct ext2_db_entry),
&dblist->list);