From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> If the caller passes in an extent size hint of zero, clear the inherit flags because a hint value of zero is treated as not a hint. Otherwise, you get stupid stuff like: $ mkfs.xfs -d cowextsize=0 /tmp/a.img -f illegal CoW extent size hint 0, must be less than 9600. Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- mkfs/xfs_mkfs.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c index 908d520df909..9989cf57c295 100644 --- a/mkfs/xfs_mkfs.c +++ b/mkfs/xfs_mkfs.c @@ -1438,11 +1438,17 @@ data_opts_parser( break; case D_EXTSZINHERIT: cli->fsx.fsx_extsize = getnum(value, opts, subopt); - cli->fsx.fsx_xflags |= FS_XFLAG_EXTSZINHERIT; + if (cli->fsx.fsx_extsize) + cli->fsx.fsx_xflags |= FS_XFLAG_EXTSZINHERIT; + else + cli->fsx.fsx_xflags &= ~FS_XFLAG_EXTSZINHERIT; break; case D_COWEXTSIZE: cli->fsx.fsx_cowextsize = getnum(value, opts, subopt); - cli->fsx.fsx_xflags |= FS_XFLAG_COWEXTSIZE; + if (cli->fsx.fsx_cowextsize) + cli->fsx.fsx_xflags |= FS_XFLAG_COWEXTSIZE; + else + cli->fsx.fsx_xflags &= ~FS_XFLAG_COWEXTSIZE; break; case D_DAXINHERIT: if (getnum(value, opts, subopt))