* [PATCH 0/2] generic/563: limit loop device size
@ 2026-07-25 7:04 Shin'ichiro Kawasaki
2026-07-25 7:04 ` [PATCH 1/2] common/rc: add argument to _create_loop_device() to specify " Shin'ichiro Kawasaki
2026-07-25 7:04 ` [PATCH 2/2] generic/563: limit loop " Shin'ichiro Kawasaki
0 siblings, 2 replies; 5+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-07-25 7:04 UTC (permalink / raw)
To: fstests, Zorro Lang
Cc: linux-xfs, Christoph Hellwig, Shin'ichiro Kawasaki
When SCRATCH_DEV is a large NVMe that takes long time for discard
operation, the test case generic/563 takes hours to complete for xfs.
To avoid this long test time, limit the size of the loop device created
on SCRATCH_DEV.
The first patch adds an optional argument to _create_loop_device().
The second patch enables the argument in generic/563.
Shin'ichiro Kawasaki (2):
common/rc: add argument to _create_loop_device() to specify device
size
generic/563: limit loop device size
common/rc | 5 ++++-
tests/generic/563 | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
--
2.54.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] common/rc: add argument to _create_loop_device() to specify device size
2026-07-25 7:04 [PATCH 0/2] generic/563: limit loop device size Shin'ichiro Kawasaki
@ 2026-07-25 7:04 ` Shin'ichiro Kawasaki
2026-07-28 3:09 ` Christoph Hellwig
2026-07-25 7:04 ` [PATCH 2/2] generic/563: limit loop " Shin'ichiro Kawasaki
1 sibling, 1 reply; 5+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-07-25 7:04 UTC (permalink / raw)
To: fstests, Zorro Lang
Cc: linux-xfs, Christoph Hellwig, Shin'ichiro Kawasaki
Currently, _create_loop_device() does not specify the --sizelimit option
to the losetup command. As a result, the loop device has the same size
as the backing file or device. To allow controlling the loop device
size, add a third optional argument to _create_loop_device(). Also,
modify _create_loop_device_like_bdev() to pass its third argument to
_create_loop_device().
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
common/rc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/common/rc b/common/rc
index 336441c7..4be9e719 100644
--- a/common/rc
+++ b/common/rc
@@ -4610,11 +4610,13 @@ _create_loop_device()
{
local file="$1"
local blksize="$2"
+ local sizelimit="$3"
local dev
local dio_args="--direct-io=on"
local args
test -n "$blksize" && args="--sector-size=$blksize"
+ test -n "$sizelimit" && args+=" --sizelimit=$sizelimit"
# Try to enable asynchronous directio mode on the loopback device so
# that writeback started by a filesystem mounted on the loop device
@@ -4650,7 +4652,8 @@ _create_loop_device_like_bdev()
blksize="$(blockdev --getss "$bdev")"
- _create_loop_device "$file" "$blksize"
+ shift 2
+ _create_loop_device "$file" "$blksize" "$@"
}
_destroy_loop_device()
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] generic/563: limit loop device size
2026-07-25 7:04 [PATCH 0/2] generic/563: limit loop device size Shin'ichiro Kawasaki
2026-07-25 7:04 ` [PATCH 1/2] common/rc: add argument to _create_loop_device() to specify " Shin'ichiro Kawasaki
@ 2026-07-25 7:04 ` Shin'ichiro Kawasaki
2026-07-28 3:10 ` Christoph Hellwig
1 sibling, 1 reply; 5+ messages in thread
From: Shin'ichiro Kawasaki @ 2026-07-25 7:04 UTC (permalink / raw)
To: fstests, Zorro Lang
Cc: linux-xfs, Christoph Hellwig, Shin'ichiro Kawasaki
The test case generic/563 sets up a loop device on top of SCRATCH_DEV.
Currently, the loop device has the same size as SCRATCH_DEV. When
SCRATCH_DEV has huge size, mkfs for the loop device can take very long
time. Especially, when SCRATCH_DEV is a NVMe device that takes long time
for discard operation, mkfs for huge loop device can take hours.
To avoid the long mkfs time, limit the size of the loop device. Choose a
size four times the test's I/O size, then round it up to the
filesystem's minimum supported size by calling _small_fs_size_mb().
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
tests/generic/563 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/generic/563 b/tests/generic/563
index f95eb073..670238ae 100755
--- a/tests/generic/563
+++ b/tests/generic/563
@@ -91,7 +91,9 @@ reset()
# cgroup I/O accounting doesn't work on partitions. Use a loop device to rule
# that out.
-loop_dev=$(_create_loop_device_like_bdev $SCRATCH_DEV $SCRATCH_DEV)
+loopsize_mb=$(_small_fs_size_mb $(( iosize * 4 / 1024 / 1024 )))
+loop_dev=$(_create_loop_device_like_bdev $SCRATCH_DEV $SCRATCH_DEV \
+ $((loopsize_mb * 1024 * 1024)))
smajor=$((0x`stat -L -c %t $loop_dev`))
sminor=$((0x`stat -L -c %T $loop_dev`))
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] common/rc: add argument to _create_loop_device() to specify device size
2026-07-25 7:04 ` [PATCH 1/2] common/rc: add argument to _create_loop_device() to specify " Shin'ichiro Kawasaki
@ 2026-07-28 3:09 ` Christoph Hellwig
0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2026-07-28 3:09 UTC (permalink / raw)
To: Shin'ichiro Kawasaki
Cc: fstests, Zorro Lang, linux-xfs, Christoph Hellwig
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] generic/563: limit loop device size
2026-07-25 7:04 ` [PATCH 2/2] generic/563: limit loop " Shin'ichiro Kawasaki
@ 2026-07-28 3:10 ` Christoph Hellwig
0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2026-07-28 3:10 UTC (permalink / raw)
To: Shin'ichiro Kawasaki
Cc: fstests, Zorro Lang, linux-xfs, Christoph Hellwig
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-07-28 3:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-25 7:04 [PATCH 0/2] generic/563: limit loop device size Shin'ichiro Kawasaki
2026-07-25 7:04 ` [PATCH 1/2] common/rc: add argument to _create_loop_device() to specify " Shin'ichiro Kawasaki
2026-07-28 3:09 ` Christoph Hellwig
2026-07-25 7:04 ` [PATCH 2/2] generic/563: limit loop " Shin'ichiro Kawasaki
2026-07-28 3:10 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox