Re: [PATCH 2/2] xfs: test inobtcount upgrade

Darrick J. Wong
2020-11-20T01:53:53Z

On Wed, Nov 18, 2020 at 10:44:40AM -0600, Eric Sandeen wrote:
> On 10/27/20 2:03 PM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Make sure we can actually upgrade filesystems to support inobtcounts.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > common/xfs | 16 ++++++++++++
> > tests/xfs/910 | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> > tests/xfs/910.out | 3 ++
> > tests/xfs/group | 1 +
> > 4 files changed, 92 insertions(+)
> > create mode 100755 tests/xfs/910
> > create mode 100644 tests/xfs/910.out
> >
> >
> > diff --git a/common/xfs b/common/xfs
> > index 3f5c14ba..e548a0a1 100644
> > --- a/common/xfs
> > +++ b/common/xfs
> > @@ -978,3 +978,19 @@ _require_xfs_copy()
> > [ "$USE_EXTERNAL" = yes ] && \
> > _notrun "Cannot xfs_copy with external devices"
> > }
> > +
> > +_require_xfs_mkfs_inobtcount()
> > +{
> > + _scratch_mkfs_xfs_supported -m inobtcount=1 >/dev/null 2>&1 \
> > + || _notrun "mkfs.xfs doesn't have inobtcount feature"
> > +}
>
> I'd like to also add:
>
> +_require_xfs_admin_upgrade()
> +{
> + local feature="$1"
> +
> + _require_scratch
> + # Catch missing "-O" or missing feature handling
> + _scratch_xfs_admin -O $feature 2>&1 | grep "illegal option\|Cannot change" \
> + && _notrun "xfs_admin does not support upgrading $1"
> +}

Well it occurred to me that the xfs_db version command has a help
screen that lists all of the things that it knows how to upgrade.
So, it should be easy enough to detect whether or not it makes sense to
test an upgrade path. Thanks for the suggestion, sorry I was rambling
about this being harder a few days ago... :/

--D

>
> and then:
>
> ...
>
> > +# real QA test starts here
> > +_supported_fs xfs
> > +_require_command "$XFS_ADMIN_PROG" "xfs_admin"
> > +_require_xfs_mkfs_inobtcount
> > +_require_xfs_scratch_inobtcount
>
> +_require_xfs_admin_upgrade "inobtcount"
>
> to be sure that the upgrade command is also supported by xfs_admin. By the time
> we get to release, both mkfs & xfs_admin should both support it, but I'm hedging
> my bets on the upgrade path just a little,and it seems best to explicitly test
> both requirements.
>
> that helper can be re-used on the bigtime upgrade test as well and anything else
> that requires an xfs_admin upgrade path ...
>
> Thanks,
> -Eric