FSTests Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 0/2] xfs_admin: unify online/offline fs label setting
@ 2020-01-16  5:11 Darrick J. Wong
  2020-01-16  5:11 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
  2020-01-16  5:11 ` [PATCH 2/2] xfs: test setting labels with xfs_admin Darrick J. Wong
  0 siblings, 2 replies; 8+ messages in thread
From: Darrick J. Wong @ 2020-01-16  5:11 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

Hi all,

Unify the online and offline label setting code paths in xfs_admin so
that one program can handle both.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=online-label-setting

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] xfs: refactor calls to xfs_admin
  2020-01-16  5:11 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
@ 2020-01-16  5:11 ` Darrick J. Wong
  2020-02-17 18:05   ` Brian Foster
  2020-01-16  5:11 ` [PATCH 2/2] xfs: test setting labels with xfs_admin Darrick J. Wong
  1 sibling, 1 reply; 8+ messages in thread
From: Darrick J. Wong @ 2020-01-16  5:11 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Create a helper to run xfs_admin on the scratch device, then refactor
all tests to use it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/config |    1 +
 common/xfs    |    8 ++++++++
 tests/xfs/287 |    2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)


diff --git a/common/config b/common/config
index 9a9c7760..1116cb99 100644
--- a/common/config
+++ b/common/config
@@ -154,6 +154,7 @@ MKSWAP_PROG="$MKSWAP_PROG -f"
 export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
 export XFS_REPAIR_PROG="$(type -P xfs_repair)"
 export XFS_DB_PROG="$(type -P xfs_db)"
+export XFS_ADMIN_PROG="$(type -P xfs_admin)"
 export XFS_GROWFS_PROG=$(type -P xfs_growfs)
 export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
 export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
diff --git a/common/xfs b/common/xfs
index 706ddf85..d9a9784f 100644
--- a/common/xfs
+++ b/common/xfs
@@ -218,6 +218,14 @@ _scratch_xfs_db()
 	$XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
 }
 
+_scratch_xfs_admin()
+{
+	local options=("$SCRATCH_DEV")
+	[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+		options+=("$SCRATCH_LOGDEV")
+	$XFS_ADMIN_PROG "$@" "${options[@]}"
+}
+
 _scratch_xfs_logprint()
 {
 	SCRATCH_OPTIONS=""
diff --git a/tests/xfs/287 b/tests/xfs/287
index 8dc754a5..f77ed2f1 100755
--- a/tests/xfs/287
+++ b/tests/xfs/287
@@ -70,7 +70,7 @@ $XFS_IO_PROG -r -c "lsproj" $dir/32bit
 _scratch_unmount
 
 # Now, enable projid32bit support by xfs_admin
-xfs_admin -p $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_admin failed"
+_scratch_xfs_admin -p >> $seqres.full 2>&1 || _fail "xfs_admin failed"
 
 # Now mount the fs, 32bit project quotas shall be supported, now
 _qmount_option "pquota"


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] xfs: test setting labels with xfs_admin
  2020-01-16  5:11 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
  2020-01-16  5:11 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
@ 2020-01-16  5:11 ` Darrick J. Wong
  2020-02-17 18:06   ` Brian Foster
  1 sibling, 1 reply; 8+ messages in thread
From: Darrick J. Wong @ 2020-01-16  5:11 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Test setting filesystem labels with xfs_admin.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/912     |  103 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/xfs/912.out |   43 ++++++++++++++++++++++
 tests/xfs/group   |    1 +
 3 files changed, 147 insertions(+)
 create mode 100755 tests/xfs/912
 create mode 100644 tests/xfs/912.out


diff --git a/tests/xfs/912 b/tests/xfs/912
new file mode 100755
index 00000000..1eef36cd
--- /dev/null
+++ b/tests/xfs/912
@@ -0,0 +1,103 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2020, Oracle and/or its affiliates.  All Rights Reserved.
+#
+# FS QA Test No. 912
+#
+# Check that xfs_admin can set and clear filesystem labels offline and online.
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1    # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+_require_scratch
+_require_xfs_db_command label
+_require_xfs_io_command label
+grep -q "xfs_io" "$(which xfs_admin)" || \
+	_notrun "xfs_admin does not support online label setting of any kind"
+
+rm -f $seqres.full
+
+echo
+echo "Format with label"
+_scratch_mkfs -L "label0" > $seqres.full
+
+echo "Read label offline"
+_scratch_xfs_admin -l
+
+echo "Read label online"
+_scratch_mount
+_scratch_xfs_admin -l
+
+echo
+echo "Set label offline"
+_scratch_unmount
+_scratch_xfs_admin -L "label1"
+
+echo "Read label offline"
+_scratch_xfs_admin -l
+
+echo "Read label online"
+_scratch_mount
+_scratch_xfs_admin -l
+
+echo
+echo "Set label online"
+_scratch_xfs_admin -L "label2"
+
+echo "Read label online"
+_scratch_xfs_admin -l
+
+echo "Read label offline"
+_scratch_unmount
+_scratch_xfs_admin -l
+
+echo
+echo "Clear label online"
+_scratch_mount
+_scratch_xfs_admin -L "--"
+
+echo "Read label online"
+_scratch_xfs_admin -l
+
+echo "Read label offline"
+_scratch_unmount
+_scratch_xfs_admin -l
+
+echo
+echo "Set label offline"
+_scratch_xfs_admin -L "label3"
+
+echo "Read label offline"
+_scratch_xfs_admin -l
+
+echo
+echo "Clear label offline"
+_scratch_xfs_admin -L "--"
+
+echo "Read label offline"
+_scratch_xfs_admin -l
+
+echo "Read label online"
+_scratch_mount
+_scratch_xfs_admin -l
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/912.out b/tests/xfs/912.out
new file mode 100644
index 00000000..186d827f
--- /dev/null
+++ b/tests/xfs/912.out
@@ -0,0 +1,43 @@
+QA output created by 912
+
+Format with label
+Read label offline
+label = "label0"
+Read label online
+label = "label0"
+
+Set label offline
+writing all SBs
+new label = "label1"
+Read label offline
+label = "label1"
+Read label online
+label = "label1"
+
+Set label online
+label = "label2"
+Read label online
+label = "label2"
+Read label offline
+label = "label2"
+
+Clear label online
+label = ""
+Read label online
+label = ""
+Read label offline
+label = ""
+
+Set label offline
+writing all SBs
+new label = "label3"
+Read label offline
+label = "label3"
+
+Clear label offline
+writing all SBs
+new label = ""
+Read label offline
+label = ""
+Read label online
+label = ""
diff --git a/tests/xfs/group b/tests/xfs/group
index a6c9ef08..cc1d122a 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -511,3 +511,4 @@
 511 auto quick quota
 747 auto quick scrub
 748 auto quick scrub
+912 auto quick label


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] xfs: refactor calls to xfs_admin
  2020-01-16  5:11 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
@ 2020-02-17 18:05   ` Brian Foster
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Foster @ 2020-02-17 18:05 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, linux-xfs, fstests

On Wed, Jan 15, 2020 at 09:11:36PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Create a helper to run xfs_admin on the scratch device, then refactor
> all tests to use it.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---

Looks Ok:

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  common/config |    1 +
>  common/xfs    |    8 ++++++++
>  tests/xfs/287 |    2 +-
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/common/config b/common/config
> index 9a9c7760..1116cb99 100644
> --- a/common/config
> +++ b/common/config
> @@ -154,6 +154,7 @@ MKSWAP_PROG="$MKSWAP_PROG -f"
>  export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
>  export XFS_REPAIR_PROG="$(type -P xfs_repair)"
>  export XFS_DB_PROG="$(type -P xfs_db)"
> +export XFS_ADMIN_PROG="$(type -P xfs_admin)"
>  export XFS_GROWFS_PROG=$(type -P xfs_growfs)
>  export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
>  export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
> diff --git a/common/xfs b/common/xfs
> index 706ddf85..d9a9784f 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -218,6 +218,14 @@ _scratch_xfs_db()
>  	$XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
>  }
>  
> +_scratch_xfs_admin()
> +{
> +	local options=("$SCRATCH_DEV")
> +	[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
> +		options+=("$SCRATCH_LOGDEV")
> +	$XFS_ADMIN_PROG "$@" "${options[@]}"
> +}
> +
>  _scratch_xfs_logprint()
>  {
>  	SCRATCH_OPTIONS=""
> diff --git a/tests/xfs/287 b/tests/xfs/287
> index 8dc754a5..f77ed2f1 100755
> --- a/tests/xfs/287
> +++ b/tests/xfs/287
> @@ -70,7 +70,7 @@ $XFS_IO_PROG -r -c "lsproj" $dir/32bit
>  _scratch_unmount
>  
>  # Now, enable projid32bit support by xfs_admin
> -xfs_admin -p $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_admin failed"
> +_scratch_xfs_admin -p >> $seqres.full 2>&1 || _fail "xfs_admin failed"
>  
>  # Now mount the fs, 32bit project quotas shall be supported, now
>  _qmount_option "pquota"
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] xfs: test setting labels with xfs_admin
  2020-01-16  5:11 ` [PATCH 2/2] xfs: test setting labels with xfs_admin Darrick J. Wong
@ 2020-02-17 18:06   ` Brian Foster
  0 siblings, 0 replies; 8+ messages in thread
From: Brian Foster @ 2020-02-17 18:06 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: guaneryu, linux-xfs, fstests

On Wed, Jan 15, 2020 at 09:11:42PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> Test setting filesystem labels with xfs_admin.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/xfs/912     |  103 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/xfs/912.out |   43 ++++++++++++++++++++++
>  tests/xfs/group   |    1 +
>  3 files changed, 147 insertions(+)
>  create mode 100755 tests/xfs/912
>  create mode 100644 tests/xfs/912.out
> 
> 
> diff --git a/tests/xfs/912 b/tests/xfs/912
> new file mode 100755
> index 00000000..1eef36cd
> --- /dev/null
> +++ b/tests/xfs/912
> @@ -0,0 +1,103 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2020, Oracle and/or its affiliates.  All Rights Reserved.
> +#
> +# FS QA Test No. 912
> +#
> +# Check that xfs_admin can set and clear filesystem labels offline and online.
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1    # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> +	cd /
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +
> +# real QA test starts here
> +_supported_fs xfs
> +_supported_os Linux
> +_require_scratch
> +_require_xfs_db_command label
> +_require_xfs_io_command label
> +grep -q "xfs_io" "$(which xfs_admin)" || \
> +	_notrun "xfs_admin does not support online label setting of any kind"

So we assume xfs_admin functionality by looking at the script..? This
seems like it should have its own _require_* helper or some such with a
more explicit implementation. (This also ignores the XFS_ADMIN_PROG env
var added by the previous patch as well, fwiw).

> +
> +rm -f $seqres.full
> +
> +echo
> +echo "Format with label"
> +_scratch_mkfs -L "label0" > $seqres.full
> +
> +echo "Read label offline"
> +_scratch_xfs_admin -l
> +
> +echo "Read label online"
> +_scratch_mount
> +_scratch_xfs_admin -l
> +
> +echo
> +echo "Set label offline"
> +_scratch_unmount
> +_scratch_xfs_admin -L "label1"
> +
> +echo "Read label offline"
> +_scratch_xfs_admin -l
> +
> +echo "Read label online"
> +_scratch_mount
> +_scratch_xfs_admin -l
...
> +echo
> +echo "Set label offline"
> +_scratch_xfs_admin -L "label3"
> +
> +echo "Read label offline"
> +_scratch_xfs_admin -l
> +

Any reason for the duplicate "set label offline" test? Otherwise LGTM.

Brian

> +echo
> +echo "Clear label offline"
> +_scratch_xfs_admin -L "--"
> +
> +echo "Read label offline"
> +_scratch_xfs_admin -l
> +
> +echo "Read label online"
> +_scratch_mount
> +_scratch_xfs_admin -l
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/xfs/912.out b/tests/xfs/912.out
> new file mode 100644
> index 00000000..186d827f
> --- /dev/null
> +++ b/tests/xfs/912.out
> @@ -0,0 +1,43 @@
> +QA output created by 912
> +
> +Format with label
> +Read label offline
> +label = "label0"
> +Read label online
> +label = "label0"
> +
> +Set label offline
> +writing all SBs
> +new label = "label1"
> +Read label offline
> +label = "label1"
> +Read label online
> +label = "label1"
> +
> +Set label online
> +label = "label2"
> +Read label online
> +label = "label2"
> +Read label offline
> +label = "label2"
> +
> +Clear label online
> +label = ""
> +Read label online
> +label = ""
> +Read label offline
> +label = ""
> +
> +Set label offline
> +writing all SBs
> +new label = "label3"
> +Read label offline
> +label = "label3"
> +
> +Clear label offline
> +writing all SBs
> +new label = ""
> +Read label offline
> +label = ""
> +Read label online
> +label = ""
> diff --git a/tests/xfs/group b/tests/xfs/group
> index a6c9ef08..cc1d122a 100644
> --- a/tests/xfs/group
> +++ b/tests/xfs/group
> @@ -511,3 +511,4 @@
>  511 auto quick quota
>  747 auto quick scrub
>  748 auto quick scrub
> +912 auto quick label
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] xfs: refactor calls to xfs_admin
  2020-02-05  6:35   ` Amir Goldstein
@ 2020-02-05 16:23     ` Darrick J. Wong
  0 siblings, 0 replies; 8+ messages in thread
From: Darrick J. Wong @ 2020-02-05 16:23 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: Eryu Guan, linux-xfs, fstests

On Wed, Feb 05, 2020 at 08:35:05AM +0200, Amir Goldstein wrote:
> On Wed, Feb 5, 2020 at 2:02 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
> >
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Create a helper to run xfs_admin on the scratch device, then refactor
> > all tests to use it.
> 
> all tests... heh overstatement :)

"all tests that use xfs_admin"?

> Maybe say something about how logdev is needed as argument and
> supported only since recent v5.4 xfsprogs.
> Does older xfsprogs cope well with the extra argument?

Prior to 5.4, xfs_admin will reject the logdev argument and exit; and
if you try to work around it by constructing the xfs_db command by hand,
xfs_db will reject the filesystem because the log device isn't
specified.

IOWs, prior to 5.4 it just plain didn't work at all.

--D

> Thanks,
> Amir.
> 
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> >  common/config |    1 +
> >  common/xfs    |    8 ++++++++
> >  tests/xfs/287 |    2 +-
> >  3 files changed, 10 insertions(+), 1 deletion(-)
> >
> >
> > diff --git a/common/config b/common/config
> > index 9a9c7760..1116cb99 100644
> > --- a/common/config
> > +++ b/common/config
> > @@ -154,6 +154,7 @@ MKSWAP_PROG="$MKSWAP_PROG -f"
> >  export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
> >  export XFS_REPAIR_PROG="$(type -P xfs_repair)"
> >  export XFS_DB_PROG="$(type -P xfs_db)"
> > +export XFS_ADMIN_PROG="$(type -P xfs_admin)"
> >  export XFS_GROWFS_PROG=$(type -P xfs_growfs)
> >  export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
> >  export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
> > diff --git a/common/xfs b/common/xfs
> > index 706ddf85..d9a9784f 100644
> > --- a/common/xfs
> > +++ b/common/xfs
> > @@ -218,6 +218,14 @@ _scratch_xfs_db()
> >         $XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
> >  }
> >
> > +_scratch_xfs_admin()
> > +{
> > +       local options=("$SCRATCH_DEV")
> > +       [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
> > +               options+=("$SCRATCH_LOGDEV")
> > +       $XFS_ADMIN_PROG "$@" "${options[@]}"
> > +}
> > +
> >  _scratch_xfs_logprint()
> >  {
> >         SCRATCH_OPTIONS=""
> > diff --git a/tests/xfs/287 b/tests/xfs/287
> > index 8dc754a5..f77ed2f1 100755
> > --- a/tests/xfs/287
> > +++ b/tests/xfs/287
> > @@ -70,7 +70,7 @@ $XFS_IO_PROG -r -c "lsproj" $dir/32bit
> >  _scratch_unmount
> >
> >  # Now, enable projid32bit support by xfs_admin
> > -xfs_admin -p $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_admin failed"
> > +_scratch_xfs_admin -p >> $seqres.full 2>&1 || _fail "xfs_admin failed"
> >
> >  # Now mount the fs, 32bit project quotas shall be supported, now
> >  _qmount_option "pquota"
> >

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] xfs: refactor calls to xfs_admin
  2020-02-05  0:02 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
@ 2020-02-05  6:35   ` Amir Goldstein
  2020-02-05 16:23     ` Darrick J. Wong
  0 siblings, 1 reply; 8+ messages in thread
From: Amir Goldstein @ 2020-02-05  6:35 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eryu Guan, linux-xfs, fstests

On Wed, Feb 5, 2020 at 2:02 AM Darrick J. Wong <darrick.wong@oracle.com> wrote:
>
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Create a helper to run xfs_admin on the scratch device, then refactor
> all tests to use it.

all tests... heh overstatement :)

Maybe say something about how logdev is needed as argument and
supported only since recent v5.4 xfsprogs.
Does older xfsprogs cope well with the extra argument?

Thanks,
Amir.

>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  common/config |    1 +
>  common/xfs    |    8 ++++++++
>  tests/xfs/287 |    2 +-
>  3 files changed, 10 insertions(+), 1 deletion(-)
>
>
> diff --git a/common/config b/common/config
> index 9a9c7760..1116cb99 100644
> --- a/common/config
> +++ b/common/config
> @@ -154,6 +154,7 @@ MKSWAP_PROG="$MKSWAP_PROG -f"
>  export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
>  export XFS_REPAIR_PROG="$(type -P xfs_repair)"
>  export XFS_DB_PROG="$(type -P xfs_db)"
> +export XFS_ADMIN_PROG="$(type -P xfs_admin)"
>  export XFS_GROWFS_PROG=$(type -P xfs_growfs)
>  export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
>  export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
> diff --git a/common/xfs b/common/xfs
> index 706ddf85..d9a9784f 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -218,6 +218,14 @@ _scratch_xfs_db()
>         $XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
>  }
>
> +_scratch_xfs_admin()
> +{
> +       local options=("$SCRATCH_DEV")
> +       [ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
> +               options+=("$SCRATCH_LOGDEV")
> +       $XFS_ADMIN_PROG "$@" "${options[@]}"
> +}
> +
>  _scratch_xfs_logprint()
>  {
>         SCRATCH_OPTIONS=""
> diff --git a/tests/xfs/287 b/tests/xfs/287
> index 8dc754a5..f77ed2f1 100755
> --- a/tests/xfs/287
> +++ b/tests/xfs/287
> @@ -70,7 +70,7 @@ $XFS_IO_PROG -r -c "lsproj" $dir/32bit
>  _scratch_unmount
>
>  # Now, enable projid32bit support by xfs_admin
> -xfs_admin -p $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_admin failed"
> +_scratch_xfs_admin -p >> $seqres.full 2>&1 || _fail "xfs_admin failed"
>
>  # Now mount the fs, 32bit project quotas shall be supported, now
>  _qmount_option "pquota"
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] xfs: refactor calls to xfs_admin
  2020-02-05  0:02 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
@ 2020-02-05  0:02 ` Darrick J. Wong
  2020-02-05  6:35   ` Amir Goldstein
  0 siblings, 1 reply; 8+ messages in thread
From: Darrick J. Wong @ 2020-02-05  0:02 UTC (permalink / raw)
  To: guaneryu, darrick.wong; +Cc: linux-xfs, fstests

From: Darrick J. Wong <darrick.wong@oracle.com>

Create a helper to run xfs_admin on the scratch device, then refactor
all tests to use it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 common/config |    1 +
 common/xfs    |    8 ++++++++
 tests/xfs/287 |    2 +-
 3 files changed, 10 insertions(+), 1 deletion(-)


diff --git a/common/config b/common/config
index 9a9c7760..1116cb99 100644
--- a/common/config
+++ b/common/config
@@ -154,6 +154,7 @@ MKSWAP_PROG="$MKSWAP_PROG -f"
 export XFS_LOGPRINT_PROG="$(type -P xfs_logprint)"
 export XFS_REPAIR_PROG="$(type -P xfs_repair)"
 export XFS_DB_PROG="$(type -P xfs_db)"
+export XFS_ADMIN_PROG="$(type -P xfs_admin)"
 export XFS_GROWFS_PROG=$(type -P xfs_growfs)
 export XFS_SPACEMAN_PROG="$(type -P xfs_spaceman)"
 export XFS_SCRUB_PROG="$(type -P xfs_scrub)"
diff --git a/common/xfs b/common/xfs
index 706ddf85..d9a9784f 100644
--- a/common/xfs
+++ b/common/xfs
@@ -218,6 +218,14 @@ _scratch_xfs_db()
 	$XFS_DB_PROG "$@" $(_scratch_xfs_db_options)
 }
 
+_scratch_xfs_admin()
+{
+	local options=("$SCRATCH_DEV")
+	[ "$USE_EXTERNAL" = yes -a ! -z "$SCRATCH_LOGDEV" ] && \
+		options+=("$SCRATCH_LOGDEV")
+	$XFS_ADMIN_PROG "$@" "${options[@]}"
+}
+
 _scratch_xfs_logprint()
 {
 	SCRATCH_OPTIONS=""
diff --git a/tests/xfs/287 b/tests/xfs/287
index 8dc754a5..f77ed2f1 100755
--- a/tests/xfs/287
+++ b/tests/xfs/287
@@ -70,7 +70,7 @@ $XFS_IO_PROG -r -c "lsproj" $dir/32bit
 _scratch_unmount
 
 # Now, enable projid32bit support by xfs_admin
-xfs_admin -p $SCRATCH_DEV >> $seqres.full 2>&1 || _fail "xfs_admin failed"
+_scratch_xfs_admin -p >> $seqres.full 2>&1 || _fail "xfs_admin failed"
 
 # Now mount the fs, 32bit project quotas shall be supported, now
 _qmount_option "pquota"


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16  5:11 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
2020-01-16  5:11 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
2020-02-17 18:05   ` Brian Foster
2020-01-16  5:11 ` [PATCH 2/2] xfs: test setting labels with xfs_admin Darrick J. Wong
2020-02-17 18:06   ` Brian Foster
2020-02-05  0:02 [PATCH 0/2] xfs_admin: unify online/offline fs label setting Darrick J. Wong
2020-02-05  0:02 ` [PATCH 1/2] xfs: refactor calls to xfs_admin Darrick J. Wong
2020-02-05  6:35   ` Amir Goldstein
2020-02-05 16:23     ` Darrick J. Wong

FSTests Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/fstests/0 fstests/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 fstests fstests/ https://lore.kernel.org/fstests \
		fstests@vger.kernel.org
	public-inbox-index fstests

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.fstests


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git