]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ext4: support large block size in ext4_mb_init_cache()
authorBaokun Li <libaokun1@huawei.com>
Fri, 21 Nov 2025 09:06:43 +0000 (17:06 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 29 Nov 2025 03:35:27 +0000 (22:35 -0500)
commit0ad55fa104a2aa5980c12f88546fab328d34644b
tree14b9296c9ccb38d9554a0eee29e2a139b542c9ca
parent3938fc29f89fff132929b2fea2fe00b0f43617ca
ext4: support large block size in ext4_mb_init_cache()

Currently, ext4_mb_init_cache() uses blocks_per_page to calculate the
folio index and offset. However, when blocksize is larger than PAGE_SIZE,
blocks_per_page becomes zero, leading to a potential division-by-zero bug.

Since we now have the folio, we know its exact size. This allows us to
convert {blocks, groups}_per_page to {blocks, groups}_per_folio, thus
supporting block sizes greater than page size.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Ojaswin Mujoo <ojaswin@linux.ibm.com>
Message-ID: <20251121090654.631996-14-libaokun@huaweicloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/mballoc.c