This is a note to let you know that I've just added the patch titled ext4: convert number of blocks to clusters properly to the 3.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: ext4-convert-number-of-blocks-to-clusters-properly.patch and it can be found in the queue-3.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 810da240f221d64bf90020f25941b05b378186fe Mon Sep 17 00:00:00 2001 From: Lukas Czerner <lczerner@xxxxxxxxxx> Date: Sat, 2 Mar 2013 17:18:58 -0500 Subject: ext4: convert number of blocks to clusters properly From: Lukas Czerner <lczerner@xxxxxxxxxx> commit 810da240f221d64bf90020f25941b05b378186fe upstream. We're using macro EXT4_B2C() to convert number of blocks to number of clusters for bigalloc file systems. However, we should be using EXT4_NUM_B2C(). Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx> Signed-off-by: "Theodore Ts'o" <tytso@xxxxxxx> Signed-off-by: CAI Qian <caiqian@xxxxxxxxxx> Signed-off-by: Lingzhu Xiang <lxiang@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/ext4/balloc.c | 2 +- fs/ext4/mballoc.c | 8 ++++---- fs/ext4/resize.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c @@ -600,7 +600,7 @@ ext4_fsblk_t ext4_count_free_clusters(st brelse(bitmap_bh); printk(KERN_DEBUG "ext4_count_free_clusters: stored = %llu" ", computed = %llu, %llu\n", - EXT4_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)), + EXT4_NUM_B2C(EXT4_SB(sb), ext4_free_blocks_count(es)), desc_count, bitmap_count); return bitmap_count; #else --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -3433,7 +3433,7 @@ ext4_mb_new_inode_pa(struct ext4_allocat win = offs; ac->ac_b_ex.fe_logical = ac->ac_o_ex.fe_logical - - EXT4_B2C(sbi, win); + EXT4_NUM_B2C(sbi, win); BUG_ON(ac->ac_o_ex.fe_logical < ac->ac_b_ex.fe_logical); BUG_ON(ac->ac_o_ex.fe_len > ac->ac_b_ex.fe_len); } @@ -4577,7 +4577,7 @@ do_more: EXT4_BLOCKS_PER_GROUP(sb); count -= overflow; } - count_clusters = EXT4_B2C(sbi, count); + count_clusters = EXT4_NUM_B2C(sbi, count); bitmap_bh = ext4_read_block_bitmap(sb, block_group); if (!bitmap_bh) { err = -EIO; @@ -4808,11 +4808,11 @@ int ext4_group_add_blocks(handle_t *hand desc->bg_checksum = ext4_group_desc_csum(sbi, block_group, desc); ext4_unlock_group(sb, block_group); percpu_counter_add(&sbi->s_freeclusters_counter, - EXT4_B2C(sbi, blocks_freed)); + EXT4_NUM_B2C(sbi, blocks_freed)); if (sbi->s_log_groups_per_flex) { ext4_group_t flex_group = ext4_flex_group(sbi, block_group); - atomic_add(EXT4_B2C(sbi, blocks_freed), + atomic_add(EXT4_NUM_B2C(sbi, blocks_freed), &sbi->s_flex_groups[flex_group].free_clusters); } --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -1112,7 +1112,7 @@ static int ext4_setup_new_descs(handle_t ext4_inode_bitmap_set(sb, gdp, group_data->inode_bitmap); ext4_inode_table_set(sb, gdp, group_data->inode_table); ext4_free_group_clusters_set(sb, gdp, - EXT4_B2C(sbi, group_data->free_blocks_count)); + EXT4_NUM_B2C(sbi, group_data->free_blocks_count)); ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb)); gdp->bg_flags = cpu_to_le16(*bg_flags); gdp->bg_checksum = ext4_group_desc_csum(sbi, group, gdp); @@ -1210,7 +1210,7 @@ static void ext4_update_super(struct sup /* Update the free space counts */ percpu_counter_add(&sbi->s_freeclusters_counter, - EXT4_B2C(sbi, free_blocks)); + EXT4_NUM_B2C(sbi, free_blocks)); percpu_counter_add(&sbi->s_freeinodes_counter, EXT4_INODES_PER_GROUP(sb) * flex_gd->count); @@ -1219,7 +1219,7 @@ static void ext4_update_super(struct sup sbi->s_log_groups_per_flex) { ext4_group_t flex_group; flex_group = ext4_flex_group(sbi, group_data[0].group); - atomic_add(EXT4_B2C(sbi, free_blocks), + atomic_add(EXT4_NUM_B2C(sbi, free_blocks), &sbi->s_flex_groups[flex_group].free_clusters); atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count, &sbi->s_flex_groups[flex_group].free_inodes); Patches currently in stable-queue which might be from lczerner@xxxxxxxxxx are queue-3.4/ext4-convert-number-of-blocks-to-clusters-properly.patch queue-3.4/ext4-use-atomic64_t-for-the-per-flexbg-free_clusters-count.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html