On Mon, Oct 26, 2020 at 04:33:56PM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > Teach mkfs how to enable the inode btree counter feature. > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > --- > man/man8/mkfs.xfs.8 | 15 +++++++++++++++ > mkfs/xfs_mkfs.c | 34 +++++++++++++++++++++++++++++++++- > 2 files changed, 48 insertions(+), 1 deletion(-) > > > diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8 > index 0a7858748457..1a6a5f93f0ea 100644 > --- a/man/man8/mkfs.xfs.8 > +++ b/man/man8/mkfs.xfs.8 ... > @@ -862,7 +871,8 @@ usage( void ) > { > fprintf(stderr, _("Usage: %s\n\ > /* blocksize */ [-b size=num]\n\ > -/* metadata */ [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1]\n\ > +/* metadata */ [-m crc=0|1,finobt=0|1,uuid=xxx,rmapbt=0|1,reflink=0|1,\n\ > + inobtcnt=0|1]\n\ > /* data subvol */ [-d agcount=n,agsize=n,file,name=xxx,size=num,\n\ > (sunit=value,swidth=value|su=num,sw=num|noalign),\n\ > sectsize=num\n\ Any plans to add a geometry flag so the feature state is reported on success? Otherwise LGTM: Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx> > @@ -1565,6 +1575,9 @@ meta_opts_parser( > case M_REFLINK: > cli->sb_feat.reflink = getnum(value, opts, subopt); > break; > + case M_INOBTCNT: > + cli->sb_feat.inobtcnt = getnum(value, opts, subopt); > + break; > default: > return -EINVAL; > } > @@ -1988,6 +2001,22 @@ _("reflink not supported without CRC support\n")); > usage(); > } > cli->sb_feat.reflink = false; > + > + if (cli->sb_feat.inobtcnt && cli_opt_set(&mopts, M_INOBTCNT)) { > + fprintf(stderr, > +_("inode btree counters not supported without CRC support\n")); > + usage(); > + } > + cli->sb_feat.inobtcnt = false; > + } > + > + if (!cli->sb_feat.finobt) { > + if (cli->sb_feat.inobtcnt && cli_opt_set(&mopts, M_INOBTCNT)) { > + fprintf(stderr, > +_("inode btree counters not supported without finobt support\n")); > + usage(); > + } > + cli->sb_feat.inobtcnt = false; > } > > if ((cli->fsx.fsx_xflags & FS_XFLAG_COWEXTSIZE) && > @@ -2955,6 +2984,8 @@ sb_set_features( > sbp->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_RMAPBT; > if (fp->reflink) > sbp->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_REFLINK; > + if (fp->inobtcnt) > + sbp->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT; > > /* > * Sparse inode chunk support has two main inode alignment requirements. > @@ -3617,6 +3648,7 @@ main( > .spinodes = true, > .rmapbt = false, > .reflink = true, > + .inobtcnt = false, > .parent_pointers = false, > .nodalign = false, > .nortalign = false, >