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