From: Andreas Dilger Date: Sun, 24 Aug 2008 03:17:17 +0000 (-0600) Subject: libext2fs: grow dblist more aggressively X-Git-Tag: v1.41.1~42 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=9f9e5c3aea024c92c50e8bb834a3ea33d9e1f55d;p=tools%2Fe2fsprogs.git 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 Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c index 0067cae..188e36e 100644 --- a/lib/ext2fs/dblist.c +++ b/lib/ext2fs/dblist.c @@ -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);