From: Theodore Ts'o Date: Thu, 7 Jul 2011 17:54:39 +0000 (-0400) Subject: libext2fs: teach ext2fs_block_alloc_stats2() about bigalloc X-Git-Tag: v1.42-WIP-0916~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b98d3e8fadf32cc34b8231089a4da0a225697545;p=thirdparty%2Fe2fsprogs.git libext2fs: teach ext2fs_block_alloc_stats2() about bigalloc Change ext2fs_block_alloc_stats2() so that when a cluster is allocated, the free blocks counter in the superblock is appropriately decremented by the cluster size. Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/alloc_stats.c b/lib/ext2fs/alloc_stats.c index 0f2766593..9a6697e0b 100644 --- a/lib/ext2fs/alloc_stats.c +++ b/lib/ext2fs/alloc_stats.c @@ -77,7 +77,8 @@ void ext2fs_block_alloc_stats2(ext2_filsys fs, blk64_t blk, int inuse) ext2fs_bg_flags_clear(fs, group, EXT2_BG_BLOCK_UNINIT); ext2fs_group_desc_csum_set(fs, group); - ext2fs_free_blocks_count_add(fs->super, -inuse); + ext2fs_free_blocks_count_add(fs->super, + -inuse * EXT2FS_CLUSTER_RATIO(fs)); ext2fs_mark_super_dirty(fs); ext2fs_mark_bb_dirty(fs); if (fs->block_alloc_stats)