From: Kemeng Shi <shikemeng@huaweicloud.com>
To: tytso@mit.edu, adilger.kernel@dilger.ca,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 08/13] ext4: calculate free_clusters_count in cluster unit in verify_group_input
Date: Sun, 27 Aug 2023 01:37:30 +0800 [thread overview]
Message-ID: <20230826173735.4023594-9-shikemeng@huaweicloud.com> (raw)
In-Reply-To: <20230826173735.4023594-1-shikemeng@huaweicloud.com>
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>
---
fs/ext4/resize.c | 5 +++--
1 file 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 "
--
2.30.0
next prev parent reply other threads:[~2023-08-26 9:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-26 17:37 [PATCH v2 00/13] fixes and cleanups to ext4 resize Kemeng Shi
2023-08-26 9:48 ` Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 01/13] ext4: correct offset of gdb backup in non meta_bg group to update_backups Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 02/13] ext4: add missed brelse in update_backups Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 03/13] ext4: correct return value of ext4_convert_meta_bg Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 04/13] ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 05/13] ext4: fix typo " Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 06/13] ext4: remove redundant check of count Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 07/13] ext4: remove commented code in reserve_backup_gdb Kemeng Shi
2023-08-26 17:37 ` Kemeng Shi [this message]
2023-08-26 17:37 ` [PATCH v2 09/13] ext4: remove EXT4FS_DEBUG defination in resize.c Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 10/13] ext4: use saved local variable sbi instead of EXT4_SB(sb) Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 11/13] ext4: simplify the gdbblock calculation in add_new_gdb_meta_bg Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 12/13] ext4: remove unnecessary check to avoid repeat update_backups for the same gdb Kemeng Shi
2023-08-26 17:37 ` [PATCH v2 13/13] ext4: remove unnecessary initialization of count2 in set_flexbg_block_bitmap Kemeng Shi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230826173735.4023594-9-shikemeng@huaweicloud.com \
--to=shikemeng@huaweicloud.com \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).