* [PATCH 1/4] xfs/273: fix test for internal zoned filesystems
2025-05-21 22:40 [PATCHSET 1/2] fstests: check new 6.15 behaviors Darrick J. Wong
@ 2025-05-21 22:41 ` Darrick J. Wong
2025-05-23 5:17 ` Christoph Hellwig
2025-05-21 22:41 ` [PATCH 2/4] xfs/259: drop the 512-byte fsblock logic from this test Darrick J. Wong
` (3 subsequent siblings)
4 siblings, 1 reply; 18+ messages in thread
From: Darrick J. Wong @ 2025-05-21 22:41 UTC (permalink / raw)
To: zlang, djwong; +Cc: fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
For XFS filesystems with internal zoned sections, fsmap reports a u32
cookie for the device instead of an actual major/minor. Adjust the test
accordingly.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/xfs/273 | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/xfs/273 b/tests/xfs/273
index 7e743179975e81..87a1c623b73b46 100755
--- a/tests/xfs/273
+++ b/tests/xfs/273
@@ -50,6 +50,11 @@ rtdev_daddrs=$((rtdev_fsblocks * fsblock_bytes / 512))
ddev_devno=$(stat -c '%t:%T' $SCRATCH_DEV)
if [ "$USE_EXTERNAL" = "yes" ] && [ -n "$SCRATCH_RTDEV" ]; then
rtdev_devno=$(stat -c '%t:%T' $SCRATCH_RTDEV)
+elif $XFS_INFO_PROG $SCRATCH_MNT | grep -q 'zoned=1'; then
+ # no external rt device and zoned=1 means fsmap reports internal device
+ # numbers instead of block major/minor.
+ ddev_devno="0:1"
+ rtdev_devno="0:3"
fi
$XFS_IO_PROG -c 'fsmap -m -n 65536' $SCRATCH_MNT | awk -F ',' \
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 2/4] xfs/259: drop the 512-byte fsblock logic from this test
2025-05-21 22:40 [PATCHSET 1/2] fstests: check new 6.15 behaviors Darrick J. Wong
2025-05-21 22:41 ` [PATCH 1/4] xfs/273: fix test for internal zoned filesystems Darrick J. Wong
@ 2025-05-21 22:41 ` Darrick J. Wong
2025-05-23 5:17 ` Christoph Hellwig
2025-05-21 22:41 ` [PATCH 3/4] xfs/259: try to force loop device block size Darrick J. Wong
` (2 subsequent siblings)
4 siblings, 1 reply; 18+ messages in thread
From: Darrick J. Wong @ 2025-05-21 22:41 UTC (permalink / raw)
To: zlang, djwong; +Cc: fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
V5 filesystems do not support 512-byte fsblocks, and mkfs.xfs has long
defaulted to V5 filesystems. Drop the 512 from the test loops, which
means we can get rid of all the _fs_has_crcs logic. As a further
cleanup, use the truncate -s command to create the sparse file instead
of dd since even RHEL7 supports the -s switch.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/xfs/259 | 24 ++++++++----------------
tests/xfs/259.out | 7 -------
2 files changed, 8 insertions(+), 23 deletions(-)
diff --git a/tests/xfs/259 b/tests/xfs/259
index c2d26381a91c02..e367d35acc3956 100755
--- a/tests/xfs/259
+++ b/tests/xfs/259
@@ -30,28 +30,20 @@ testfile=$TEST_DIR/259.image
# Test various sizes slightly less than 4 TB. Need to handle different
# minimum block sizes for CRC enabled filesystems, but use a small log so we
# don't write lots of zeros unnecessarily.
-sizes_to_check="4096 2048 1024 512"
-blocksizes="4096 2048 1024 512"
+sizes_to_check="4096 2048 1024"
+blocksizes="4096 2048 1024"
four_TB=$(_math "2^42")
-# The initial value of _fs_has_crcs is not important, because we start testing
-# with 4096 block size, it only matters for 512 block size test
-_fs_has_crcs=0
+
for del in $sizes_to_check; do
for bs in $blocksizes; do
- echo "Trying to make (4TB - ${del}B) long xfs, block size $bs"
- # skip tests with 512 block size if the fs created has crc
- # enabled by default
- if [ $_fs_has_crcs -eq 1 -a $bs -eq 512 ]; then
- break;
- fi
+ echo "Trying to make (4TB - ${del}B) long xfs, block size $bs" | \
+ tee -a $seqres.full
ddseek=$(_math "$four_TB - $del")
rm -f "$testfile"
- dd if=/dev/zero "of=$testfile" bs=1 count=0 seek=$ddseek \
- >/dev/null 2>&1 || echo "dd failed"
+ truncate -s $ddseek "$testfile"
loop_dev=$(_create_loop_device $testfile)
- $MKFS_XFS_PROG -l size=32m -b size=$bs $loop_dev | _filter_mkfs \
- >/dev/null 2> $tmp.mkfs || echo "mkfs failed!"
- . $tmp.mkfs
+ $MKFS_XFS_PROG -l size=32m -b size=$bs $loop_dev >> $seqres.full || \
+ echo "mkfs failed!"
sync
_destroy_loop_device $loop_dev
unset loop_dev
diff --git a/tests/xfs/259.out b/tests/xfs/259.out
index 9fc4920c2b33b3..50af1a9b326147 100644
--- a/tests/xfs/259.out
+++ b/tests/xfs/259.out
@@ -2,16 +2,9 @@ QA output created by 259
Trying to make (4TB - 4096B) long xfs, block size 4096
Trying to make (4TB - 4096B) long xfs, block size 2048
Trying to make (4TB - 4096B) long xfs, block size 1024
-Trying to make (4TB - 4096B) long xfs, block size 512
Trying to make (4TB - 2048B) long xfs, block size 4096
Trying to make (4TB - 2048B) long xfs, block size 2048
Trying to make (4TB - 2048B) long xfs, block size 1024
-Trying to make (4TB - 2048B) long xfs, block size 512
Trying to make (4TB - 1024B) long xfs, block size 4096
Trying to make (4TB - 1024B) long xfs, block size 2048
Trying to make (4TB - 1024B) long xfs, block size 1024
-Trying to make (4TB - 1024B) long xfs, block size 512
-Trying to make (4TB - 512B) long xfs, block size 4096
-Trying to make (4TB - 512B) long xfs, block size 2048
-Trying to make (4TB - 512B) long xfs, block size 1024
-Trying to make (4TB - 512B) long xfs, block size 512
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH 3/4] xfs/259: try to force loop device block size
2025-05-21 22:40 [PATCHSET 1/2] fstests: check new 6.15 behaviors Darrick J. Wong
2025-05-21 22:41 ` [PATCH 1/4] xfs/273: fix test for internal zoned filesystems Darrick J. Wong
2025-05-21 22:41 ` [PATCH 2/4] xfs/259: drop the 512-byte fsblock logic from this test Darrick J. Wong
@ 2025-05-21 22:41 ` Darrick J. Wong
2025-05-22 1:21 ` Dave Chinner
2025-05-23 5:19 ` Christoph Hellwig
2025-05-21 22:41 ` [PATCH 4/4] xfs/432: fix metadump loop device blocksize problems Darrick J. Wong
2025-07-10 16:16 ` [PATCHSET 1/2] fstests: check new 6.15 behaviors Darrick J. Wong
4 siblings, 2 replies; 18+ messages in thread
From: Darrick J. Wong @ 2025-05-21 22:41 UTC (permalink / raw)
To: zlang, djwong; +Cc: fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Starting with 6.15-rc1, loop devices created with directio mode enabled
will set their logical block size to whatever STATX_DIO_ALIGN on the
host filesystem reports. If you happen to be running a kernel that
always sets up loop devices in directio mode and TEST_DEV is a block
device with 4k sectors, this will cause conflicts with this test's usage
of mkfs with different block sizes. Add a helper to force the loop
device block size to 512 bytes, which is implied by scenarios such as
"device size is 4T - 2048 bytes".
Also fix xfs/078 which simply needs the blocksize to be set.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
common/rc | 22 ++++++++++++++++++++++
tests/generic/563 | 1 +
tests/xfs/078 | 2 ++
tests/xfs/259 | 1 +
tests/xfs/613 | 1 +
5 files changed, 27 insertions(+)
diff --git a/common/rc b/common/rc
index 657772e73db86b..4e3917a298e072 100644
--- a/common/rc
+++ b/common/rc
@@ -4526,6 +4526,28 @@ _create_loop_device()
echo $dev
}
+# Configure the loop device however needed to support the given block size.
+_force_loop_device_blocksize()
+{
+ local loopdev="$1"
+ local blksize="$2"
+ local is_dio
+ local logsec
+
+ if [ ! -b "$loopdev" ] || [ -z "$blksize" ]; then
+ echo "_force_loop_device_blocksize requires loopdev and blksize" >&2
+ return 1
+ fi
+
+ curr_blksize="$(losetup --list --output LOG-SEC --noheadings --raw "$loopdev")"
+ if [ "$curr_blksize" -gt "$blksize" ]; then
+ losetup --direct-io=off "$loopdev"
+ losetup --sector-size "$blksize" "$loopdev"
+ fi
+
+ #losetup --raw --list "$loopdev" >> $seqres.full
+}
+
_destroy_loop_device()
{
local dev=$1
diff --git a/tests/generic/563 b/tests/generic/563
index 89a71aa44938ea..6fd153d8b04ca8 100755
--- a/tests/generic/563
+++ b/tests/generic/563
@@ -92,6 +92,7 @@ reset()
# cgroup I/O accounting doesn't work on partitions. Use a loop device to rule
# that out.
loop_dev=$(_create_loop_device $SCRATCH_DEV)
+_force_loop_device_blocksize $loop_dev $SCRATCH_DEV
smajor=$((0x`stat -L -c %t $loop_dev`))
sminor=$((0x`stat -L -c %T $loop_dev`))
diff --git a/tests/xfs/078 b/tests/xfs/078
index 0d3c2eb23e51ce..43a384dbdf7797 100755
--- a/tests/xfs/078
+++ b/tests/xfs/078
@@ -56,6 +56,7 @@ _grow_loop()
$XFS_IO_PROG -f -c "truncate $original" $LOOP_IMG
loop_dev=`_create_loop_device $LOOP_IMG`
+ _force_loop_device_blocksize $loop_dev $bsize
dparam=""
if [ -n "$agsize" ]; then
@@ -74,6 +75,7 @@ _grow_loop()
_destroy_loop_device $loop_dev
$XFS_IO_PROG -c "pwrite $new_size $bsize" $LOOP_IMG | _filter_io
loop_dev=`_create_loop_device $LOOP_IMG`
+ _force_loop_device_blocksize $loop_dev $bsize
echo "*** mount loop filesystem"
_mount $loop_dev $LOOP_MNT
diff --git a/tests/xfs/259 b/tests/xfs/259
index e367d35acc3956..8e93b464b90360 100755
--- a/tests/xfs/259
+++ b/tests/xfs/259
@@ -42,6 +42,7 @@ for del in $sizes_to_check; do
rm -f "$testfile"
truncate -s $ddseek "$testfile"
loop_dev=$(_create_loop_device $testfile)
+ _force_loop_device_blocksize $loop_dev 512
$MKFS_XFS_PROG -l size=32m -b size=$bs $loop_dev >> $seqres.full || \
echo "mkfs failed!"
sync
diff --git a/tests/xfs/613 b/tests/xfs/613
index c034ef60d28bad..f4d16c62570274 100755
--- a/tests/xfs/613
+++ b/tests/xfs/613
@@ -169,6 +169,7 @@ do_test "-o attr2" pass "attr2" "true"
do_test "-o noattr2" pass "attr2" "false"
# Test logbsize=value.
+_force_loop_device_blocksize $loop_dev 512 # needed for v1 log
do_mkfs -m crc=0 -l version=1
# New kernel (refer to 4f62282a3696 xfs: cleanup xlog_get_iclog_buffer_size)
# prints "logbsize=N" in /proc/mounts, but old kernel not. So the default
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 3/4] xfs/259: try to force loop device block size
2025-05-21 22:41 ` [PATCH 3/4] xfs/259: try to force loop device block size Darrick J. Wong
@ 2025-05-22 1:21 ` Dave Chinner
2025-05-28 22:36 ` Darrick J. Wong
2025-05-23 5:19 ` Christoph Hellwig
1 sibling, 1 reply; 18+ messages in thread
From: Dave Chinner @ 2025-05-22 1:21 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs
On Wed, May 21, 2025 at 03:41:36PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Starting with 6.15-rc1, loop devices created with directio mode enabled
> will set their logical block size to whatever STATX_DIO_ALIGN on the
> host filesystem reports. If you happen to be running a kernel that
> always sets up loop devices in directio mode and TEST_DEV is a block
> device with 4k sectors, this will cause conflicts with this test's usage
> of mkfs with different block sizes. Add a helper to force the loop
> device block size to 512 bytes, which is implied by scenarios such as
> "device size is 4T - 2048 bytes".
>
> Also fix xfs/078 which simply needs the blocksize to be set.
>
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> ---
> common/rc | 22 ++++++++++++++++++++++
> tests/generic/563 | 1 +
> tests/xfs/078 | 2 ++
> tests/xfs/259 | 1 +
> tests/xfs/613 | 1 +
> 5 files changed, 27 insertions(+)
>
>
> diff --git a/common/rc b/common/rc
> index 657772e73db86b..4e3917a298e072 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4526,6 +4526,28 @@ _create_loop_device()
> echo $dev
> }
>
> +# Configure the loop device however needed to support the given block size.
> +_force_loop_device_blocksize()
> +{
> + local loopdev="$1"
> + local blksize="$2"
> + local is_dio
> + local logsec
> +
> + if [ ! -b "$loopdev" ] || [ -z "$blksize" ]; then
> + echo "_force_loop_device_blocksize requires loopdev and blksize" >&2
> + return 1
> + fi
> +
> + curr_blksize="$(losetup --list --output LOG-SEC --noheadings --raw "$loopdev")"
> + if [ "$curr_blksize" -gt "$blksize" ]; then
> + losetup --direct-io=off "$loopdev"
> + losetup --sector-size "$blksize" "$loopdev"
> + fi
> +
> + #losetup --raw --list "$loopdev" >> $seqres.full
> +}
I think it would make more sense to use a
_create_loop_device_blocksize() wrapper function and change the call
sites to use it that to add this function that requires error
checking of the parameters even though it is only called directly
after loop device creation.
_create_loop_device_blocksize()
{
local file=$1
local blksize=$2
dev=`losetup -f --show $file --sector-size=$blksize`
# If the loop device sector size is incompatible with doing
# direct IO on the backing file, attempting to turn on
# direct-io will fail with an -EINVAL error. However, the
# device will still work correctly using buffered IO, so we
# ignore the error.
test -b "$dev" && losetup --direct-io=on $dev 2> /dev/null
echo $dev
}
-Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 3/4] xfs/259: try to force loop device block size
2025-05-22 1:21 ` Dave Chinner
@ 2025-05-28 22:36 ` Darrick J. Wong
0 siblings, 0 replies; 18+ messages in thread
From: Darrick J. Wong @ 2025-05-28 22:36 UTC (permalink / raw)
To: Dave Chinner; +Cc: zlang, fstests, linux-xfs
On Thu, May 22, 2025 at 11:21:26AM +1000, Dave Chinner wrote:
> On Wed, May 21, 2025 at 03:41:36PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Starting with 6.15-rc1, loop devices created with directio mode enabled
> > will set their logical block size to whatever STATX_DIO_ALIGN on the
> > host filesystem reports. If you happen to be running a kernel that
> > always sets up loop devices in directio mode and TEST_DEV is a block
> > device with 4k sectors, this will cause conflicts with this test's usage
> > of mkfs with different block sizes. Add a helper to force the loop
> > device block size to 512 bytes, which is implied by scenarios such as
> > "device size is 4T - 2048 bytes".
> >
> > Also fix xfs/078 which simply needs the blocksize to be set.
> >
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > ---
> > common/rc | 22 ++++++++++++++++++++++
> > tests/generic/563 | 1 +
> > tests/xfs/078 | 2 ++
> > tests/xfs/259 | 1 +
> > tests/xfs/613 | 1 +
> > 5 files changed, 27 insertions(+)
> >
> >
> > diff --git a/common/rc b/common/rc
> > index 657772e73db86b..4e3917a298e072 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -4526,6 +4526,28 @@ _create_loop_device()
> > echo $dev
> > }
> >
> > +# Configure the loop device however needed to support the given block size.
> > +_force_loop_device_blocksize()
> > +{
> > + local loopdev="$1"
> > + local blksize="$2"
> > + local is_dio
> > + local logsec
> > +
> > + if [ ! -b "$loopdev" ] || [ -z "$blksize" ]; then
> > + echo "_force_loop_device_blocksize requires loopdev and blksize" >&2
> > + return 1
> > + fi
> > +
> > + curr_blksize="$(losetup --list --output LOG-SEC --noheadings --raw "$loopdev")"
> > + if [ "$curr_blksize" -gt "$blksize" ]; then
> > + losetup --direct-io=off "$loopdev"
> > + losetup --sector-size "$blksize" "$loopdev"
> > + fi
> > +
> > + #losetup --raw --list "$loopdev" >> $seqres.full
> > +}
>
> I think it would make more sense to use a
> _create_loop_device_blocksize() wrapper function and change the call
> sites to use it that to add this function that requires error
> checking of the parameters even though it is only called directly
> after loop device creation.
>
> _create_loop_device_blocksize()
> {
> local file=$1
> local blksize=$2
>
> dev=`losetup -f --show $file --sector-size=$blksize`
>
> # If the loop device sector size is incompatible with doing
> # direct IO on the backing file, attempting to turn on
> # direct-io will fail with an -EINVAL error. However, the
> # device will still work correctly using buffered IO, so we
> # ignore the error.
> test -b "$dev" && losetup --direct-io=on $dev 2> /dev/null
> echo $dev
Yeah, I guess that works too.
--D
> }
>
> -Dave.
> --
> Dave Chinner
> david@fromorbit.com
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] xfs/259: try to force loop device block size
2025-05-21 22:41 ` [PATCH 3/4] xfs/259: try to force loop device block size Darrick J. Wong
2025-05-22 1:21 ` Dave Chinner
@ 2025-05-23 5:19 ` Christoph Hellwig
2025-05-28 22:22 ` Darrick J. Wong
1 sibling, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2025-05-23 5:19 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs
On Wed, May 21, 2025 at 03:41:36PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Starting with 6.15-rc1, loop devices created with directio mode enabled
> will set their logical block size to whatever STATX_DIO_ALIGN on the
> host filesystem reports. If you happen to be running a kernel that
> always sets up loop devices in directio mode
Such a kernel has some weird out of tree patches. Why would we want
to support that?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] xfs/259: try to force loop device block size
2025-05-23 5:19 ` Christoph Hellwig
@ 2025-05-28 22:22 ` Darrick J. Wong
2025-06-02 5:07 ` Christoph Hellwig
0 siblings, 1 reply; 18+ messages in thread
From: Darrick J. Wong @ 2025-05-28 22:22 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: zlang, fstests, linux-xfs
On Thu, May 22, 2025 at 10:19:00PM -0700, Christoph Hellwig wrote:
> On Wed, May 21, 2025 at 03:41:36PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Starting with 6.15-rc1, loop devices created with directio mode enabled
> > will set their logical block size to whatever STATX_DIO_ALIGN on the
> > host filesystem reports. If you happen to be running a kernel that
> > always sets up loop devices in directio mode
>
> Such a kernel has some weird out of tree patches. Why would we want
> to support that?
Welll... the only reason I patched the loop driver to turn ovn directio
by default is because writeback throttling for loop devices keeps
getting turned on and off randomly. At this point I have NFI if
throttling is actually the desired behavior or not. It makes fstests
crawl really slowly.
On one hand it seems bogus that a loopbacked filesystem with enough
dirty pages to trip the thresholds then gets throttled doing writeback
to the pagecache of the loop file, but OTOH it /is/ more dirty
pagecache. Ultimately I think non-directio loop devices are stupid
especially when there are filesystems on top of them, but I bet there's
some user that would break if we suddenly started requiring directio
alignments.
Maybe RWF_DONTCACHE will solve this whenever it stabilizes.
--D
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] xfs/259: try to force loop device block size
2025-05-28 22:22 ` Darrick J. Wong
@ 2025-06-02 5:07 ` Christoph Hellwig
2025-06-03 14:36 ` Darrick J. Wong
0 siblings, 1 reply; 18+ messages in thread
From: Christoph Hellwig @ 2025-06-02 5:07 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, zlang, fstests, linux-xfs
On Wed, May 28, 2025 at 03:22:26PM -0700, Darrick J. Wong wrote:
> Welll... the only reason I patched the loop driver to turn ovn directio
> by default is because writeback throttling for loop devices keeps
> getting turned on and off randomly. At this point I have NFI if
> throttling is actually the desired behavior or not. It makes fstests
> crawl really slowly.
>
> On one hand it seems bogus that a loopbacked filesystem with enough
> dirty pages to trip the thresholds then gets throttled doing writeback
> to the pagecache of the loop file, but OTOH it /is/ more dirty
> pagecache. Ultimately I think non-directio loop devices are stupid
> especially when there are filesystems on top of them, but I bet there's
> some user that would break if we suddenly started requiring directio
> alignments.
>
> Maybe RWF_DONTCACHE will solve this whenever it stabilizes.
Well, I'm all for using direct I/O loop devices by default. But having
non-standard kernel hacks for that is pretty silly. Can we just make
xfstests use direct I/O by default so that everyone uses the same
configuration?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] xfs/259: try to force loop device block size
2025-06-02 5:07 ` Christoph Hellwig
@ 2025-06-03 14:36 ` Darrick J. Wong
2025-06-03 14:37 ` Christoph Hellwig
0 siblings, 1 reply; 18+ messages in thread
From: Darrick J. Wong @ 2025-06-03 14:36 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: zlang, fstests, linux-xfs
On Sun, Jun 01, 2025 at 10:07:00PM -0700, Christoph Hellwig wrote:
> On Wed, May 28, 2025 at 03:22:26PM -0700, Darrick J. Wong wrote:
> > Welll... the only reason I patched the loop driver to turn ovn directio
> > by default is because writeback throttling for loop devices keeps
> > getting turned on and off randomly. At this point I have NFI if
> > throttling is actually the desired behavior or not. It makes fstests
> > crawl really slowly.
> >
> > On one hand it seems bogus that a loopbacked filesystem with enough
> > dirty pages to trip the thresholds then gets throttled doing writeback
> > to the pagecache of the loop file, but OTOH it /is/ more dirty
> > pagecache. Ultimately I think non-directio loop devices are stupid
> > especially when there are filesystems on top of them, but I bet there's
> > some user that would break if we suddenly started requiring directio
> > alignments.
> >
> > Maybe RWF_DONTCACHE will solve this whenever it stabilizes.
>
> Well, I'm all for using direct I/O loop devices by default. But having
> non-standard kernel hacks for that is pretty silly. Can we just make
> xfstests use direct I/O by default so that everyone uses the same
> configuration?
I guess we could just modify _create_loop_device to set directio from
creation and fall back to pagecache io if need be, instead of the weird
"create it then try to change the mode" dance that we do now. Does that
sound better?
--D
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/4] xfs/259: try to force loop device block size
2025-06-03 14:36 ` Darrick J. Wong
@ 2025-06-03 14:37 ` Christoph Hellwig
0 siblings, 0 replies; 18+ messages in thread
From: Christoph Hellwig @ 2025-06-03 14:37 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, zlang, fstests, linux-xfs
On Tue, Jun 03, 2025 at 07:36:34AM -0700, Darrick J. Wong wrote:
> I guess we could just modify _create_loop_device to set directio from
> creation and fall back to pagecache io if need be, instead of the weird
> "create it then try to change the mode" dance that we do now. Does that
> sound better?
That's much better.
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 4/4] xfs/432: fix metadump loop device blocksize problems
2025-05-21 22:40 [PATCHSET 1/2] fstests: check new 6.15 behaviors Darrick J. Wong
` (2 preceding siblings ...)
2025-05-21 22:41 ` [PATCH 3/4] xfs/259: try to force loop device block size Darrick J. Wong
@ 2025-05-21 22:41 ` Darrick J. Wong
2025-05-22 1:08 ` Dave Chinner
2025-07-10 16:16 ` [PATCHSET 1/2] fstests: check new 6.15 behaviors Darrick J. Wong
4 siblings, 1 reply; 18+ messages in thread
From: Darrick J. Wong @ 2025-05-21 22:41 UTC (permalink / raw)
To: zlang, djwong; +Cc: fstests, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Make sure the lba size of the loop devices created for the metadump
tests actually match that of the real SCRATCH_ devices or else the tests
will fail.
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
common/metadump | 12 ++++++++++--
common/rc | 7 +++++++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/common/metadump b/common/metadump
index 61ba3cbb91647c..4ae03c605563fc 100644
--- a/common/metadump
+++ b/common/metadump
@@ -76,6 +76,7 @@ _xfs_verify_metadump_v1()
# Create loopdev for data device so we can mount the fs
METADUMP_DATA_LOOP_DEV=$(_create_loop_device $data_img)
+ _force_loop_device_blocksize $METADUMP_DATA_LOOP_DEV $SCRATCH_DEV
# Mount fs, run an extra test, fsck, and unmount
SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV _scratch_mount
@@ -123,12 +124,19 @@ _xfs_verify_metadump_v2()
# Create loopdev for data device so we can mount the fs
METADUMP_DATA_LOOP_DEV=$(_create_loop_device $data_img)
+ _force_loop_device_blocksize $METADUMP_DATA_LOOP_DEV $SCRATCH_DEV
# Create loopdev for log device if we recovered anything
- test -s "$log_img" && METADUMP_LOG_LOOP_DEV=$(_create_loop_device $log_img)
+ if [ -s "$log_img" ]; then
+ METADUMP_LOG_LOOP_DEV=$(_create_loop_device $log_img)
+ _force_loop_device_blocksize $METADUMP_LOG_LOOP_DEV $SCRATCH_LOGDEV
+ fi
# Create loopdev for rt device if we recovered anything
- test -s "$rt_img" && METADUMP_RT_LOOP_DEV=$(_create_loop_device $rt_img)
+ if [ -s "$rt_img" ]; then
+ METADUMP_RT_LOOP_DEV=$(_create_loop_device $rt_img)
+ _force_loop_device_blocksize $METADUMP_RT_LOOP_DEV $SCRATCH_RTDEV
+ fi
# Mount fs, run an extra test, fsck, and unmount
SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV SCRATCH_LOGDEV=$METADUMP_LOG_LOOP_DEV SCRATCH_RTDEV=$METADUMP_RT_LOOP_DEV _scratch_mount
diff --git a/common/rc b/common/rc
index 4e3917a298e072..9e27f7a4afba44 100644
--- a/common/rc
+++ b/common/rc
@@ -4527,6 +4527,8 @@ _create_loop_device()
}
# Configure the loop device however needed to support the given block size.
+# The first argument is the loop device; the second is either an integer block
+# size, or a different block device whose blocksize we want to match.
_force_loop_device_blocksize()
{
local loopdev="$1"
@@ -4539,6 +4541,11 @@ _force_loop_device_blocksize()
return 1
fi
+ # second argument is really a bdev; copy its lba size
+ if [ -b "$blksize" ]; then
+ blksize="$(blockdev --getss "${blksize}")"
+ fi
+
curr_blksize="$(losetup --list --output LOG-SEC --noheadings --raw "$loopdev")"
if [ "$curr_blksize" -gt "$blksize" ]; then
losetup --direct-io=off "$loopdev"
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 4/4] xfs/432: fix metadump loop device blocksize problems
2025-05-21 22:41 ` [PATCH 4/4] xfs/432: fix metadump loop device blocksize problems Darrick J. Wong
@ 2025-05-22 1:08 ` Dave Chinner
2025-05-28 22:37 ` Darrick J. Wong
0 siblings, 1 reply; 18+ messages in thread
From: Dave Chinner @ 2025-05-22 1:08 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs
On Wed, May 21, 2025 at 03:41:51PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Make sure the lba size of the loop devices created for the metadump
> tests actually match that of the real SCRATCH_ devices or else the tests
> will fail.
>
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> ---
> common/metadump | 12 ++++++++++--
> common/rc | 7 +++++++
> 2 files changed, 17 insertions(+), 2 deletions(-)
>
>
> diff --git a/common/metadump b/common/metadump
> index 61ba3cbb91647c..4ae03c605563fc 100644
> --- a/common/metadump
> +++ b/common/metadump
> @@ -76,6 +76,7 @@ _xfs_verify_metadump_v1()
>
> # Create loopdev for data device so we can mount the fs
> METADUMP_DATA_LOOP_DEV=$(_create_loop_device $data_img)
> + _force_loop_device_blocksize $METADUMP_DATA_LOOP_DEV $SCRATCH_DEV
That doesn't look right. You're passing the scratch device as a
block size parameter.
>
> # Mount fs, run an extra test, fsck, and unmount
> SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV _scratch_mount
> @@ -123,12 +124,19 @@ _xfs_verify_metadump_v2()
>
> # Create loopdev for data device so we can mount the fs
> METADUMP_DATA_LOOP_DEV=$(_create_loop_device $data_img)
> + _force_loop_device_blocksize $METADUMP_DATA_LOOP_DEV $SCRATCH_DEV
>
> # Create loopdev for log device if we recovered anything
> - test -s "$log_img" && METADUMP_LOG_LOOP_DEV=$(_create_loop_device $log_img)
> + if [ -s "$log_img" ]; then
> + METADUMP_LOG_LOOP_DEV=$(_create_loop_device $log_img)
> + _force_loop_device_blocksize $METADUMP_LOG_LOOP_DEV $SCRATCH_LOGDEV
> + fi
>
> # Create loopdev for rt device if we recovered anything
> - test -s "$rt_img" && METADUMP_RT_LOOP_DEV=$(_create_loop_device $rt_img)
> + if [ -s "$rt_img" ]; then
> + METADUMP_RT_LOOP_DEV=$(_create_loop_device $rt_img)
> + _force_loop_device_blocksize $METADUMP_RT_LOOP_DEV $SCRATCH_RTDEV
> + fi
>
> # Mount fs, run an extra test, fsck, and unmount
> SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV SCRATCH_LOGDEV=$METADUMP_LOG_LOOP_DEV SCRATCH_RTDEV=$METADUMP_RT_LOOP_DEV _scratch_mount
> diff --git a/common/rc b/common/rc
> index 4e3917a298e072..9e27f7a4afba44 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4527,6 +4527,8 @@ _create_loop_device()
> }
>
> # Configure the loop device however needed to support the given block size.
> +# The first argument is the loop device; the second is either an integer block
> +# size, or a different block device whose blocksize we want to match.
> _force_loop_device_blocksize()
> {
> local loopdev="$1"
> @@ -4539,6 +4541,11 @@ _force_loop_device_blocksize()
> return 1
> fi
>
> + # second argument is really a bdev; copy its lba size
> + if [ -b "$blksize" ]; then
> + blksize="$(blockdev --getss "${blksize}")"
> + fi
Oh, you're overloading the second parameter with different types -
that's pretty nasty. It would be much cleaner to write a wrapper
function that extracts the block size from the device before calling
_force_loop_device_blocksize()....
-Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 4/4] xfs/432: fix metadump loop device blocksize problems
2025-05-22 1:08 ` Dave Chinner
@ 2025-05-28 22:37 ` Darrick J. Wong
0 siblings, 0 replies; 18+ messages in thread
From: Darrick J. Wong @ 2025-05-28 22:37 UTC (permalink / raw)
To: Dave Chinner; +Cc: zlang, fstests, linux-xfs
On Thu, May 22, 2025 at 11:08:14AM +1000, Dave Chinner wrote:
> On Wed, May 21, 2025 at 03:41:51PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Make sure the lba size of the loop devices created for the metadump
> > tests actually match that of the real SCRATCH_ devices or else the tests
> > will fail.
> >
> > Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> > ---
> > common/metadump | 12 ++++++++++--
> > common/rc | 7 +++++++
> > 2 files changed, 17 insertions(+), 2 deletions(-)
> >
> >
> > diff --git a/common/metadump b/common/metadump
> > index 61ba3cbb91647c..4ae03c605563fc 100644
> > --- a/common/metadump
> > +++ b/common/metadump
> > @@ -76,6 +76,7 @@ _xfs_verify_metadump_v1()
> >
> > # Create loopdev for data device so we can mount the fs
> > METADUMP_DATA_LOOP_DEV=$(_create_loop_device $data_img)
> > + _force_loop_device_blocksize $METADUMP_DATA_LOOP_DEV $SCRATCH_DEV
>
> That doesn't look right. You're passing the scratch device as a
> block size parameter.
>
> >
> > # Mount fs, run an extra test, fsck, and unmount
> > SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV _scratch_mount
> > @@ -123,12 +124,19 @@ _xfs_verify_metadump_v2()
> >
> > # Create loopdev for data device so we can mount the fs
> > METADUMP_DATA_LOOP_DEV=$(_create_loop_device $data_img)
> > + _force_loop_device_blocksize $METADUMP_DATA_LOOP_DEV $SCRATCH_DEV
> >
> > # Create loopdev for log device if we recovered anything
> > - test -s "$log_img" && METADUMP_LOG_LOOP_DEV=$(_create_loop_device $log_img)
> > + if [ -s "$log_img" ]; then
> > + METADUMP_LOG_LOOP_DEV=$(_create_loop_device $log_img)
> > + _force_loop_device_blocksize $METADUMP_LOG_LOOP_DEV $SCRATCH_LOGDEV
> > + fi
> >
> > # Create loopdev for rt device if we recovered anything
> > - test -s "$rt_img" && METADUMP_RT_LOOP_DEV=$(_create_loop_device $rt_img)
> > + if [ -s "$rt_img" ]; then
> > + METADUMP_RT_LOOP_DEV=$(_create_loop_device $rt_img)
> > + _force_loop_device_blocksize $METADUMP_RT_LOOP_DEV $SCRATCH_RTDEV
> > + fi
> >
> > # Mount fs, run an extra test, fsck, and unmount
> > SCRATCH_DEV=$METADUMP_DATA_LOOP_DEV SCRATCH_LOGDEV=$METADUMP_LOG_LOOP_DEV SCRATCH_RTDEV=$METADUMP_RT_LOOP_DEV _scratch_mount
> > diff --git a/common/rc b/common/rc
> > index 4e3917a298e072..9e27f7a4afba44 100644
> > --- a/common/rc
> > +++ b/common/rc
> > @@ -4527,6 +4527,8 @@ _create_loop_device()
> > }
> >
> > # Configure the loop device however needed to support the given block size.
> > +# The first argument is the loop device; the second is either an integer block
> > +# size, or a different block device whose blocksize we want to match.
> > _force_loop_device_blocksize()
> > {
> > local loopdev="$1"
> > @@ -4539,6 +4541,11 @@ _force_loop_device_blocksize()
> > return 1
> > fi
> >
> > + # second argument is really a bdev; copy its lba size
> > + if [ -b "$blksize" ]; then
> > + blksize="$(blockdev --getss "${blksize}")"
> > + fi
>
> Oh, you're overloading the second parameter with different types -
> that's pretty nasty. It would be much cleaner to write a wrapper
> function that extracts the block size from the device before calling
> _force_loop_device_blocksize()....
Or my preferred solution: a special purpose wrapper with a different
name that takes only a bdev path and has a comment that says it requires
a bdev path.
--D
>
> -Dave.
>
> --
> Dave Chinner
> david@fromorbit.com
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCHSET 1/2] fstests: check new 6.15 behaviors
2025-05-21 22:40 [PATCHSET 1/2] fstests: check new 6.15 behaviors Darrick J. Wong
` (3 preceding siblings ...)
2025-05-21 22:41 ` [PATCH 4/4] xfs/432: fix metadump loop device blocksize problems Darrick J. Wong
@ 2025-07-10 16:16 ` Darrick J. Wong
2025-07-10 18:26 ` Zorro Lang
4 siblings, 1 reply; 18+ messages in thread
From: Darrick J. Wong @ 2025-07-10 16:16 UTC (permalink / raw)
To: zlang; +Cc: fstests, linux-xfs
On Wed, May 21, 2025 at 03:40:53PM -0700, Darrick J. Wong wrote:
> Hi all,
>
> Adjust fstests to check for new behaviors introduced in 6.15.
>
> If you're going to start using this code, I strongly recommend pulling
> from my git trees, which are linked below.
>
> With a bit of luck, this should all go splendidly.
> Comments and questions are, as always, welcome.
Hrm, can we get the first two patches into for-next, please?
I'll work on the last two and repost when they're ready.
--D
> --D
>
> fstests git tree:
> https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=linux-6.15-sync
> ---
> Commits in this patchset:
> * xfs/273: fix test for internal zoned filesystems
> * xfs/259: drop the 512-byte fsblock logic from this test
> * xfs/259: try to force loop device block size
> * xfs/432: fix metadump loop device blocksize problems
> ---
> common/metadump | 12 ++++++++++--
> common/rc | 29 +++++++++++++++++++++++++++++
> tests/generic/563 | 1 +
> tests/xfs/078 | 2 ++
> tests/xfs/259 | 25 +++++++++----------------
> tests/xfs/259.out | 7 -------
> tests/xfs/273 | 5 +++++
> tests/xfs/613 | 1 +
> 8 files changed, 57 insertions(+), 25 deletions(-)
>
>
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCHSET 1/2] fstests: check new 6.15 behaviors
2025-07-10 16:16 ` [PATCHSET 1/2] fstests: check new 6.15 behaviors Darrick J. Wong
@ 2025-07-10 18:26 ` Zorro Lang
0 siblings, 0 replies; 18+ messages in thread
From: Zorro Lang @ 2025-07-10 18:26 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: fstests, linux-xfs
On Thu, Jul 10, 2025 at 09:16:10AM -0700, Darrick J. Wong wrote:
> On Wed, May 21, 2025 at 03:40:53PM -0700, Darrick J. Wong wrote:
> > Hi all,
> >
> > Adjust fstests to check for new behaviors introduced in 6.15.
> >
> > If you're going to start using this code, I strongly recommend pulling
> > from my git trees, which are linked below.
> >
> > With a bit of luck, this should all go splendidly.
> > Comments and questions are, as always, welcome.
>
> Hrm, can we get the first two patches into for-next, please?
>
> I'll work on the last two and repost when they're ready.
Sure Darrick :)
>
> --D
>
> > --D
> >
> > fstests git tree:
> > https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=linux-6.15-sync
> > ---
> > Commits in this patchset:
> > * xfs/273: fix test for internal zoned filesystems
> > * xfs/259: drop the 512-byte fsblock logic from this test
> > * xfs/259: try to force loop device block size
> > * xfs/432: fix metadump loop device blocksize problems
> > ---
> > common/metadump | 12 ++++++++++--
> > common/rc | 29 +++++++++++++++++++++++++++++
> > tests/generic/563 | 1 +
> > tests/xfs/078 | 2 ++
> > tests/xfs/259 | 25 +++++++++----------------
> > tests/xfs/259.out | 7 -------
> > tests/xfs/273 | 5 +++++
> > tests/xfs/613 | 1 +
> > 8 files changed, 57 insertions(+), 25 deletions(-)
> >
> >
>
^ permalink raw reply [flat|nested] 18+ messages in thread