e2fsck init memory according to filesystem inodes/dir numbers
recorded in the superblock, this should be aware of filesystem
number of threads, otherwise, oom happen.
E2fsprogs-commit:
ed2cec54da604efe1af2734182985d1730674138
Change-Id: Ia66cd782a330f3f0215c7119c25ef701edc8b143
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
if (retval)
goto cleanup;
dblist->size = (num_dirs * 2) + 12;
+ if (fs->fs_num_threads)
+ dblist->size /= fs->fs_num_threads;
}
len = (size_t) sizeof(struct ext2_db_entry2) * dblist->size;
dblist->count = count;
* value.
*/
num_inodes = fs->super->s_inodes_count - fs->super->s_free_inodes_count;
+ if (fs->fs_num_threads)
+ num_inodes /= fs->fs_num_threads;
icount->tdb = tdb_open(fn, num_inodes, TDB_NOLOCK | TDB_NOSYNC,
O_RDWR | O_CREAT | O_TRUNC, 0600);
if (retval)
goto errout;
icount->size += fs->super->s_inodes_count / 50;
+ if (fs->fs_num_threads)
+ icount->size /= fs->fs_num_threads;
}
bytes = (size_t) (icount->size * sizeof(struct ext2_icount_el));