On Apr 20, 2007 09:57 -0500, Eric Sandeen wrote: > Anyway, how about something like this for calculating journal size in > the face of lazy_bg. I know the last group may be smaller... but I figure > this is just a heuristic anyway. > > Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> > > Index: e2fsprogs-1.39_ext4_hg/misc/util.c > =================================================================== > --- e2fsprogs-1.39_ext4_hg.orig/misc/util.c > +++ e2fsprogs-1.39_ext4_hg/misc/util.c > @@ -252,8 +252,16 @@ void parse_journal_opts(const char *opts > int figure_journal_size(int size, ext2_filsys fs) > { > blk_t j_blocks; > + blk_t fs_size; > > - if (fs->super->s_blocks_count < 2048) { > + if (EXT2_HAS_COMPAT_FEATURE(fs->super, > + EXT2_FEATURE_COMPAT_LAZY_BG)) { > + fs_size = fs->super->s_blocks_per_group * 2; > + } else { > + fs_size = fs->super->s_blocks_count; > + } This should also check for !RO_COMPAT_UNINIT_GROUPS, since LAZY_BG can be used in conjunction with UNINIT_GROUPS to mean "don't zero uninitialized groups" but doesn't set bg_free_blocks_count == 0. I was going to suggest using s_free_blocks_count, but that might lead to confusion if e.g. e2fsck deletes a journal on a nearly-full fs and then tune2fs recreates it much smaller than before. Cheers, Andreas -- Andreas Dilger Principal Software Engineer Cluster File Systems, Inc. - To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html