diff options
author | Kemeng Shi <shikemeng@huaweicloud.com> | 2023-08-27 01:47:07 +0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2023-10-05 22:32:15 -0400 |
commit | 1fc1bd2d18bbade157f7b14270f509ebbd89881b (patch) | |
tree | 5c4b84286c3d3c227f58165dec5275b53f6410a7 /fs/ext4 | |
parent | 31458077273b5f883d99bee33a7fb295f155712d (diff) | |
download | linux-stable-1fc1bd2d18bbade157f7b14270f509ebbd89881b.tar.gz linux-stable-1fc1bd2d18bbade157f7b14270f509ebbd89881b.tar.bz2 linux-stable-1fc1bd2d18bbade157f7b14270f509ebbd89881b.zip |
ext4: calculate free_clusters_count in cluster unit in verify_group_input
The field free_cluster_count in struct ext4_new_group_data should be
in units of clusters. In verify_group_input() this field is being
filled in units of blocks. Fortunately, we don't support online
resizing of bigalloc file systems, and for non-bigalloc file systems,
the cluster size == block size. But fix this in case we do support
online resizing of bigalloc file systems in the future.
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Reviewed-by: Theodore Ts'o <tytso@mit.edu>
Link: https://lore.kernel.org/r/20230826174712.4059355-9-shikemeng@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/resize.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index a370ca1a2bd6..3ad2b1a900ad 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -154,8 +154,9 @@ static int verify_group_input(struct super_block *sb, overhead = ext4_group_overhead_blocks(sb, group); metaend = start + overhead; - input->free_clusters_count = free_blocks_count = - input->blocks_count - 2 - overhead - sbi->s_itb_per_group; + free_blocks_count = input->blocks_count - 2 - overhead - + sbi->s_itb_per_group; + input->free_clusters_count = EXT4_B2C(sbi, free_blocks_count); if (test_opt(sb, DEBUG)) printk(KERN_DEBUG "EXT4-fs: adding %s group %u: %u blocks " |