* _supports_xfs_scrub cleanups v2
@ 2024-01-12 5:08 Christoph Hellwig
2024-01-12 5:08 ` [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub Christoph Hellwig
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Christoph Hellwig @ 2024-01-12 5:08 UTC (permalink / raw)
To: zlang; +Cc: djwong, fstests, linux-xfs
Hi all,
this series adds a missing scrub support fix to xfs/262 and cleans
up a few bits around this.
Changes since v1:
- use _fail
- also annotate xfs/506
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub
2024-01-12 5:08 _supports_xfs_scrub cleanups v2 Christoph Hellwig
@ 2024-01-12 5:08 ` Christoph Hellwig
2024-01-12 13:20 ` Zorro Lang
2024-01-12 16:41 ` Darrick J. Wong
2024-01-12 5:08 ` [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper Christoph Hellwig
` (2 subsequent siblings)
3 siblings, 2 replies; 12+ messages in thread
From: Christoph Hellwig @ 2024-01-12 5:08 UTC (permalink / raw)
To: zlang; +Cc: djwong, fstests, linux-xfs
Add a sanity check that the passed in mount point is actually mounted
to guard against actually calling _supports_xfs_scrub before
$SCRATCH_MNT is mounted.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
common/xfs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/common/xfs b/common/xfs
index f53b33fc5..4e54d75cc 100644
--- a/common/xfs
+++ b/common/xfs
@@ -649,6 +649,9 @@ _supports_xfs_scrub()
test "$FSTYP" = "xfs" || return 1
test -x "$XFS_SCRUB_PROG" || return 1
+ mountpoint $mountpoint >/dev/null || \
+ _fail "$mountpoint is not mounted"
+
# Probe for kernel support...
$XFS_IO_PROG -c 'help scrub' 2>&1 | grep -q 'types are:.*probe' || return 1
$XFS_IO_PROG -c "scrub probe" "$mountpoint" 2>&1 | grep -q "Inappropriate ioctl" && return 1
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper
2024-01-12 5:08 _supports_xfs_scrub cleanups v2 Christoph Hellwig
2024-01-12 5:08 ` [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub Christoph Hellwig
@ 2024-01-12 5:08 ` Christoph Hellwig
2024-01-12 13:32 ` Zorro Lang
2024-01-12 5:08 ` [PATCH 3/4] xfs/262: call _scratch_require_xfs_scrub Christoph Hellwig
2024-01-12 5:08 ` [PATCH 4/4] xfs/506: " Christoph Hellwig
3 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2024-01-12 5:08 UTC (permalink / raw)
To: zlang; +Cc: djwong, fstests, linux-xfs
Add a helper to call _supports_xfs_scrub with $SCRATCH_MNT and
$SCRATCH_DEV.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
common/xfs | 7 +++++++
tests/xfs/556 | 2 +-
tests/xfs/716 | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/common/xfs b/common/xfs
index 4e54d75cc..b71ba8d1e 100644
--- a/common/xfs
+++ b/common/xfs
@@ -662,6 +662,13 @@ _supports_xfs_scrub()
return 0
}
+# Does the scratch file system support scrub?
+_scratch_require_xfs_scrub()
+{
+ _supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || \
+ _notrun "Scrub not supported"
+}
+
# Save a snapshot of a corrupt xfs filesystem for later debugging.
_xfs_metadump() {
local metadump="$1"
diff --git a/tests/xfs/556 b/tests/xfs/556
index 061d8d572..6be993273 100755
--- a/tests/xfs/556
+++ b/tests/xfs/556
@@ -40,7 +40,7 @@ _scratch_mkfs >> $seqres.full
_dmerror_init
_dmerror_mount >> $seqres.full 2>&1
-_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported"
+_scratch_require_xfs_scrub
# Write a file with 4 file blocks worth of data
victim=$SCRATCH_MNT/a
diff --git a/tests/xfs/716 b/tests/xfs/716
index 930a0ecbb..4cfb27f18 100755
--- a/tests/xfs/716
+++ b/tests/xfs/716
@@ -31,7 +31,7 @@ _require_test_program "punch-alternating"
_scratch_mkfs > $tmp.mkfs
_scratch_mount
-_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported"
+_scratch_require_xfs_scrub
# Force data device extents so that we can create a file with the exact bmbt
# that we need regardless of rt configuration.
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/4] xfs/262: call _scratch_require_xfs_scrub
2024-01-12 5:08 _supports_xfs_scrub cleanups v2 Christoph Hellwig
2024-01-12 5:08 ` [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub Christoph Hellwig
2024-01-12 5:08 ` [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper Christoph Hellwig
@ 2024-01-12 5:08 ` Christoph Hellwig
2024-01-12 16:43 ` Darrick J. Wong
2024-01-12 5:08 ` [PATCH 4/4] xfs/506: " Christoph Hellwig
3 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2024-01-12 5:08 UTC (permalink / raw)
To: zlang; +Cc: djwong, fstests, linux-xfs
Call _scratch_require_xfs_scrub so that the test is _notrun on kernels
without online scrub support.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/262 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/xfs/262 b/tests/xfs/262
index b28a6c88b..0d1fd779d 100755
--- a/tests/xfs/262
+++ b/tests/xfs/262
@@ -29,6 +29,9 @@ _require_xfs_io_error_injection "force_repair"
echo "Format and populate"
_scratch_mkfs > "$seqres.full" 2>&1
_scratch_mount
+
+_scratch_require_xfs_scrub
+
cp $XFS_SCRUB_PROG $SCRATCH_MNT/xfs_scrub
$LDD_PROG $XFS_SCRUB_PROG | sed -e '/\//!d;/linux-gate/d;/=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/};s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' | while read lib; do
cp $lib $SCRATCH_MNT/
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/4] xfs/506: call _scratch_require_xfs_scrub
2024-01-12 5:08 _supports_xfs_scrub cleanups v2 Christoph Hellwig
` (2 preceding siblings ...)
2024-01-12 5:08 ` [PATCH 3/4] xfs/262: call _scratch_require_xfs_scrub Christoph Hellwig
@ 2024-01-12 5:08 ` Christoph Hellwig
2024-01-12 16:43 ` Darrick J. Wong
3 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2024-01-12 5:08 UTC (permalink / raw)
To: zlang; +Cc: djwong, fstests, linux-xfs
Call _scratch_require_xfs_scrub so that the test is _notrun on kernels
without online scrub support.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
tests/xfs/506 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/xfs/506 b/tests/xfs/506
index 157dac293..b6ef484a5 100755
--- a/tests/xfs/506
+++ b/tests/xfs/506
@@ -21,6 +21,9 @@ _require_xfs_spaceman_command "health"
_scratch_mkfs > $seqres.full 2>&1
_scratch_mount
+
+_scratch_require_xfs_scrub
+
_scratch_cycle_mount # make sure we haven't run quotacheck on this mount
# Haven't checked anything, it should tell us to run scrub
--
2.39.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub
2024-01-12 5:08 ` [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub Christoph Hellwig
@ 2024-01-12 13:20 ` Zorro Lang
2024-01-12 16:41 ` Darrick J. Wong
1 sibling, 0 replies; 12+ messages in thread
From: Zorro Lang @ 2024-01-12 13:20 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: djwong, fstests, linux-xfs
On Fri, Jan 12, 2024 at 06:08:30AM +0100, Christoph Hellwig wrote:
> Add a sanity check that the passed in mount point is actually mounted
> to guard against actually calling _supports_xfs_scrub before
> $SCRATCH_MNT is mounted.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
This version is good to me, thanks!
Reviewed-by: Zorro Lang <zlang@redhat.com>
> common/xfs | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/common/xfs b/common/xfs
> index f53b33fc5..4e54d75cc 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -649,6 +649,9 @@ _supports_xfs_scrub()
> test "$FSTYP" = "xfs" || return 1
> test -x "$XFS_SCRUB_PROG" || return 1
>
> + mountpoint $mountpoint >/dev/null || \
> + _fail "$mountpoint is not mounted"
> +
> # Probe for kernel support...
> $XFS_IO_PROG -c 'help scrub' 2>&1 | grep -q 'types are:.*probe' || return 1
> $XFS_IO_PROG -c "scrub probe" "$mountpoint" 2>&1 | grep -q "Inappropriate ioctl" && return 1
> --
> 2.39.2
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper
2024-01-12 5:08 ` [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper Christoph Hellwig
@ 2024-01-12 13:32 ` Zorro Lang
2024-01-12 14:14 ` Christoph Hellwig
0 siblings, 1 reply; 12+ messages in thread
From: Zorro Lang @ 2024-01-12 13:32 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: djwong, fstests, linux-xfs
On Fri, Jan 12, 2024 at 06:08:31AM +0100, Christoph Hellwig wrote:
> Add a helper to call _supports_xfs_scrub with $SCRATCH_MNT and
> $SCRATCH_DEV.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> common/xfs | 7 +++++++
> tests/xfs/556 | 2 +-
> tests/xfs/716 | 2 +-
> 3 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/common/xfs b/common/xfs
> index 4e54d75cc..b71ba8d1e 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -662,6 +662,13 @@ _supports_xfs_scrub()
> return 0
> }
>
> +# Does the scratch file system support scrub?
> +_scratch_require_xfs_scrub()
Usually we name a require helper as _require_xxxxxxxx, you can find that
by running `grep -rsn scratch_require common/` and `grep -rsn require_scratch common/`.
So better to change this name to _require_scratch_xfs_scrub. That's a simple
change, I can help to change that when I merge this patchset.
Thanks,
Zorro
> +{
> + _supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || \
> + _notrun "Scrub not supported"
> +}
> +
> # Save a snapshot of a corrupt xfs filesystem for later debugging.
> _xfs_metadump() {
> local metadump="$1"
> diff --git a/tests/xfs/556 b/tests/xfs/556
> index 061d8d572..6be993273 100755
> --- a/tests/xfs/556
> +++ b/tests/xfs/556
> @@ -40,7 +40,7 @@ _scratch_mkfs >> $seqres.full
> _dmerror_init
> _dmerror_mount >> $seqres.full 2>&1
>
> -_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported"
> +_scratch_require_xfs_scrub
>
> # Write a file with 4 file blocks worth of data
> victim=$SCRATCH_MNT/a
> diff --git a/tests/xfs/716 b/tests/xfs/716
> index 930a0ecbb..4cfb27f18 100755
> --- a/tests/xfs/716
> +++ b/tests/xfs/716
> @@ -31,7 +31,7 @@ _require_test_program "punch-alternating"
> _scratch_mkfs > $tmp.mkfs
> _scratch_mount
>
> -_supports_xfs_scrub $SCRATCH_MNT $SCRATCH_DEV || _notrun "Scrub not supported"
> +_scratch_require_xfs_scrub
>
> # Force data device extents so that we can create a file with the exact bmbt
> # that we need regardless of rt configuration.
> --
> 2.39.2
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper
2024-01-12 13:32 ` Zorro Lang
@ 2024-01-12 14:14 ` Christoph Hellwig
2024-01-12 16:42 ` Darrick J. Wong
0 siblings, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2024-01-12 14:14 UTC (permalink / raw)
To: Zorro Lang; +Cc: Christoph Hellwig, djwong, fstests, linux-xfs
On Fri, Jan 12, 2024 at 09:32:05PM +0800, Zorro Lang wrote:
> Usually we name a require helper as _require_xxxxxxxx, you can find that
> by running `grep -rsn scratch_require common/` and `grep -rsn require_scratch common/`.
>
> So better to change this name to _require_scratch_xfs_scrub. That's a simple
> change, I can help to change that when I merge this patchset.
Fine with me. I just took the name that Darrick suggested.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub
2024-01-12 5:08 ` [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub Christoph Hellwig
2024-01-12 13:20 ` Zorro Lang
@ 2024-01-12 16:41 ` Darrick J. Wong
1 sibling, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2024-01-12 16:41 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: zlang, fstests, linux-xfs
On Fri, Jan 12, 2024 at 06:08:30AM +0100, Christoph Hellwig wrote:
> Add a sanity check that the passed in mount point is actually mounted
> to guard against actually calling _supports_xfs_scrub before
> $SCRATCH_MNT is mounted.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> common/xfs | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/common/xfs b/common/xfs
> index f53b33fc5..4e54d75cc 100644
> --- a/common/xfs
> +++ b/common/xfs
> @@ -649,6 +649,9 @@ _supports_xfs_scrub()
> test "$FSTYP" = "xfs" || return 1
> test -x "$XFS_SCRUB_PROG" || return 1
>
> + mountpoint $mountpoint >/dev/null || \
> + _fail "$mountpoint is not mounted"
Looks good,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> +
> # Probe for kernel support...
> $XFS_IO_PROG -c 'help scrub' 2>&1 | grep -q 'types are:.*probe' || return 1
> $XFS_IO_PROG -c "scrub probe" "$mountpoint" 2>&1 | grep -q "Inappropriate ioctl" && return 1
> --
> 2.39.2
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper
2024-01-12 14:14 ` Christoph Hellwig
@ 2024-01-12 16:42 ` Darrick J. Wong
0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2024-01-12 16:42 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Zorro Lang, fstests, linux-xfs
On Fri, Jan 12, 2024 at 03:14:10PM +0100, Christoph Hellwig wrote:
> On Fri, Jan 12, 2024 at 09:32:05PM +0800, Zorro Lang wrote:
> > Usually we name a require helper as _require_xxxxxxxx, you can find that
> > by running `grep -rsn scratch_require common/` and `grep -rsn require_scratch common/`.
> >
> > So better to change this name to _require_scratch_xfs_scrub. That's a simple
> > change, I can help to change that when I merge this patchset.
>
> Fine with me. I just took the name that Darrick suggested.
Either name is fine with me, so go with what the maintainer recommends.
Sorry for the churn :)
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/4] xfs/262: call _scratch_require_xfs_scrub
2024-01-12 5:08 ` [PATCH 3/4] xfs/262: call _scratch_require_xfs_scrub Christoph Hellwig
@ 2024-01-12 16:43 ` Darrick J. Wong
0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2024-01-12 16:43 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: zlang, fstests, linux-xfs
On Fri, Jan 12, 2024 at 06:08:32AM +0100, Christoph Hellwig wrote:
> Call _scratch_require_xfs_scrub so that the test is _notrun on kernels
> without online scrub support.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
With _require_scratch_xfs_scrub,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> tests/xfs/262 | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tests/xfs/262 b/tests/xfs/262
> index b28a6c88b..0d1fd779d 100755
> --- a/tests/xfs/262
> +++ b/tests/xfs/262
> @@ -29,6 +29,9 @@ _require_xfs_io_error_injection "force_repair"
> echo "Format and populate"
> _scratch_mkfs > "$seqres.full" 2>&1
> _scratch_mount
> +
> +_scratch_require_xfs_scrub
> +
> cp $XFS_SCRUB_PROG $SCRATCH_MNT/xfs_scrub
> $LDD_PROG $XFS_SCRUB_PROG | sed -e '/\//!d;/linux-gate/d;/=>/ {s/.*=>[[:blank:]]*\([^[:blank:]]*\).*/\1/};s/[[:blank:]]*\([^[:blank:]]*\) (.*)/\1/' | while read lib; do
> cp $lib $SCRATCH_MNT/
> --
> 2.39.2
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] xfs/506: call _scratch_require_xfs_scrub
2024-01-12 5:08 ` [PATCH 4/4] xfs/506: " Christoph Hellwig
@ 2024-01-12 16:43 ` Darrick J. Wong
0 siblings, 0 replies; 12+ messages in thread
From: Darrick J. Wong @ 2024-01-12 16:43 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: zlang, fstests, linux-xfs
On Fri, Jan 12, 2024 at 06:08:33AM +0100, Christoph Hellwig wrote:
> Call _scratch_require_xfs_scrub so that the test is _notrun on kernels
> without online scrub support.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
With whatever name we picked for the helper,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> tests/xfs/506 | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/tests/xfs/506 b/tests/xfs/506
> index 157dac293..b6ef484a5 100755
> --- a/tests/xfs/506
> +++ b/tests/xfs/506
> @@ -21,6 +21,9 @@ _require_xfs_spaceman_command "health"
>
> _scratch_mkfs > $seqres.full 2>&1
> _scratch_mount
> +
> +_scratch_require_xfs_scrub
> +
> _scratch_cycle_mount # make sure we haven't run quotacheck on this mount
>
> # Haven't checked anything, it should tell us to run scrub
> --
> 2.39.2
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-01-12 16:43 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-12 5:08 _supports_xfs_scrub cleanups v2 Christoph Hellwig
2024-01-12 5:08 ` [PATCH 1/4] xfs: check that the mountpoint is actually mounted in _supports_xfs_scrub Christoph Hellwig
2024-01-12 13:20 ` Zorro Lang
2024-01-12 16:41 ` Darrick J. Wong
2024-01-12 5:08 ` [PATCH 2/4] xfs: add a _scratch_require_xfs_scrub helper Christoph Hellwig
2024-01-12 13:32 ` Zorro Lang
2024-01-12 14:14 ` Christoph Hellwig
2024-01-12 16:42 ` Darrick J. Wong
2024-01-12 5:08 ` [PATCH 3/4] xfs/262: call _scratch_require_xfs_scrub Christoph Hellwig
2024-01-12 16:43 ` Darrick J. Wong
2024-01-12 5:08 ` [PATCH 4/4] xfs/506: " Christoph Hellwig
2024-01-12 16:43 ` Darrick J. Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox