fs: ext4: Fix computation of inodes per block group
Colin Cross [Fri, 29 Apr 2011 22:38:33 +0000 (15:38 -0700)]
857ac889cce8a486d47874db4d2f9620e7e9e5de (ext4: add interface
to advertise ext4 features in sysfs) added an error check that
exposes a bug in the computation of sbi->s_itb_per_group.  If
the number of inodes per group is not a multiple of the number
of inodes per block,

Original-Change-Id: I8c60817dbb6feb43535b567ec7ea5ee0af709c37
Signed-off-by: Colin Cross <ccross@android.com>
(cherry picked from commit 8703a0ccb0135ae0de0d7011f29eeb6dc1caa486)

Rebase-Id: R7fc03850010d565447bb8702710040f112705738

fs/ext4/super.c

index 502c61f..e3efcfe 100644 (file)
@@ -3395,8 +3395,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
        sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb);
        if (sbi->s_inodes_per_block == 0)
                goto cantfind_ext4;
-       sbi->s_itb_per_group = sbi->s_inodes_per_group /
-                                       sbi->s_inodes_per_block;
+       sbi->s_itb_per_group = DIV_ROUND_UP(sbi->s_inodes_per_group,
+                                       sbi->s_inodes_per_block);
        sbi->s_desc_per_block = blocksize / EXT4_DESC_SIZE(sb);
        sbi->s_sbh = bh;
        sbi->s_mount_state = le16_to_cpu(es->s_state);