diff --git a/0008-mkfs-fix-the-issue-of-maxpct-set-to-0-not-taking-eff.patch b/0008-mkfs-fix-the-issue-of-maxpct-set-to-0-not-taking-eff.patch new file mode 100644 index 0000000000000000000000000000000000000000..eafb2f12290b3d36bf8d9689bac1424202c0fe46 --- /dev/null +++ b/0008-mkfs-fix-the-issue-of-maxpct-set-to-0-not-taking-eff.patch @@ -0,0 +1,77 @@ +From 81f646b0d6afb797fdd14eccc9965a3212ba358e Mon Sep 17 00:00:00 2001 +From: liuh +Date: Fri, 11 Apr 2025 15:12:03 +0800 +Subject: mkfs: fix the issue of maxpct set to 0 not taking effect + +If a filesystem has the sb_imax_pct field set to zero, there is no limit to the number of inode blocks in the filesystem. + +However, when using mkfs.xfs and specifying maxpct = 0, the result is not as expected. + [root@fs ~]# mkfs.xfs -f -i maxpct=0 xfs.img + data = bsize=4096 blocks=262144, imaxpct=25 + = sunit=0 swidth=0 blks + +The reason is that the condition will never succeed when specifying maxpct = 0. As a result, the default algorithm was applied. + cfg->imaxpct = cli->imaxpct; + if (cfg->imaxpct) + return; + +The result with patch: + [root@fs ~]# mkfs.xfs -f -i maxpct=0 xfs.img + data = bsize=4096 blocks=262144, imaxpct=0 + = sunit=0 swidth=0 blks + + [root@fs ~]# mkfs.xfs -f xfs.img + data = bsize=4096 blocks=262144, imaxpct=25 + = sunit=0 swidth=0 blks + +Cc: linux-xfs@vger.kernel.org # v4.15.0 +Fixes: d7240c965389e1 ("mkfs: rework imaxpct calculation") +Suggested-by: Darrick J. Wong +Signed-off-by: liuh +Reviewed-by: Darrick J. Wong +--- + mkfs/xfs_mkfs.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c +index 4c8a6f3..75f682f 100644 +--- a/mkfs/xfs_mkfs.c ++++ b/mkfs/xfs_mkfs.c +@@ -893,12 +893,12 @@ struct cli_params { + int lsunit; + int is_supported; + int proto_slashes_are_spaces; ++ int imaxpct; + + /* parameters where 0 is not a valid value */ + int64_t agcount; + int inodesize; + int inopblock; +- int imaxpct; + int lsectorsize; + uuid_t uuid; + +@@ -3186,9 +3186,10 @@ calculate_imaxpct( + struct mkfs_params *cfg, + struct cli_params *cli) + { +- cfg->imaxpct = cli->imaxpct; +- if (cfg->imaxpct) ++ if (cli->imaxpct >= 0) { ++ cfg->imaxpct = cli->imaxpct; + return; ++ } + + /* + * This returns the % of the disk space that is used for +@@ -4075,6 +4076,7 @@ main( + .xi = &xi, + .loginternal = 1, + .is_supported = 1, ++ .imaxpct = -1, /* set sb_imax_pct automatically */ + }; + struct mkfs_params cfg = {}; + +-- +2.43.0 + diff --git a/xfsprogs.spec b/xfsprogs.spec index 08402fabcf33fd27c11c5a59d1a91a273c169036..db8209607349391d403054d3719f726974260630 100644 --- a/xfsprogs.spec +++ b/xfsprogs.spec @@ -1,6 +1,6 @@ Name: xfsprogs Version: 6.6.0 -Release: 8 +Release: 9 Summary: Administration and debugging tools for the XFS file system License: GPL+ and LGPLv2+ URL: https://xfs.wiki.kernel.org @@ -26,6 +26,7 @@ Patch4: 0004-xfs_db-fix-leak-in-flist_find_ftyp.patch Patch5: 0005-xfs_db-add-helper-for-flist_find_type-for-clearer-fi.patch Patch6: 0006-xfs_io-fix-mread-with-length-1-mod-page-size.patch Patch7: 0007-xfs_scrub-don-t-call-phase_end-if-phase_rusage-was-n.patch +Patch8: 0008-mkfs-fix-the-issue-of-maxpct-set-to-0-not-taking-eff.patch %description xfsprogs are the userspace utilities that manage XFS filesystems. @@ -109,6 +110,9 @@ rm -rf %{buildroot}%{_datadir}/doc/xfsprogs/ %changelog +* Tue Sep 30 2025 liuh - 6.6.0-9 +- mkfs: fix the issue of maxpct set to 0 not taking effect + * Tue Jul 1 2025 wangmian - 6.6.0-8 - Fixed bug for macros in Changelog