* [PATCHSET v30.6 2/6] fstests: atomic file updates
@ 2024-06-18 0:46 Darrick J. Wong
2024-06-18 0:47 ` [PATCH 01/10] misc: split swapext and exchangerange Darrick J. Wong
` (9 more replies)
0 siblings, 10 replies; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:46 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
Hi all,
This series creates a new XFS_IOC_EXCHANGE_RANGE ioctl to exchange
ranges of bytes between two files atomically.
This new functionality enables data storage programs to stage and commit
file updates such that reader programs will see either the old contents
or the new contents in their entirety, with no chance of torn writes. A
successful call completion guarantees that the new contents will be seen
even if the system fails.
The ability to exchange file fork mappings between files in this manner
is critical to supporting online filesystem repair, which is built upon
the strategy of constructing a clean copy of a damaged structure and
committing the new structure into the metadata file atomically. The
ioctls exist to facilitate testing of the new functionality and to
enable future application program designs.
User programs will be able to update files atomically by opening an
O_TMPFILE, reflinking the source file to it, making whatever updates
they want to make, and exchange the relevant ranges of the temp file
with the original file. If the updates are aligned with the file block
size, a new (since v2) flag provides for exchanging only the written
areas. Note that application software must quiesce writes to the file
while it stages an atomic update. This will be addressed by a
subsequent series.
This mechanism solves the clunkiness of two existing atomic file update
mechanisms: for O_TRUNC + rewrite, this eliminates the brief period
where other programs can see an empty file. For create tempfile +
rename, the need to copy file attributes and extended attributes for
each file update is eliminated.
However, this method introduces its own awkwardness -- any program
initiating an exchange now needs to have a way to signal to other
programs that the file contents have changed. For file access mediated
via read and write, fanotify or inotify are probably sufficient. For
mmaped files, that may not be fast enough.
The reference implementation in XFS creates a new log incompat feature
and log intent items to track high level progress of swapping ranges of
two files and finish interrupted work if the system goes down. Sample
code can be found in the corresponding changes to xfs_io to exercise the
use case mentioned above.
Note that this function is /not/ the O_DIRECT atomic untorn file writes
concept that has also been floating around for years. It is also not
the RWF_ATOMIC patchset that has been shared. This RFC is constructed
entirely in software, which means that there are no limitations other
than the general filesystem limits.
As a side note, the original motivation behind the kernel functionality
is online repair of file-based metadata. The atomic file content
exchange is implemented as an atomic exchange of file fork mappings,
which means that we can implement online reconstruction of extended
attributes and directories by building a new one in another inode and
exchanging the contents.
Subsequent patchsets adapt the online filesystem repair code to use
atomic file exchanges. This enables repair functions to construct a
clean copy of a directory, xattr information, symbolic links, realtime
bitmaps, and realtime summary information in a temporary inode. If this
completes successfully, the new contents can be committed atomically
into the inode being repaired. This is essential to avoid making
corruption problems worse if the system goes down in the middle of
running repair.
For userspace, this series also includes the userspace pieces needed to
test the new functionality, and a sample implementation of atomic file
updates.
If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.
This has been running on the djcloud for months with no problems. Enjoy!
Comments and questions are, as always, welcome.
--D
kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=atomic-file-updates
xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=atomic-file-updates
fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=atomic-file-updates
xfsdocs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-documentation.git/log/?h=atomic-file-updates
---
Commits in this patchset:
* misc: split swapext and exchangerange
* misc: change xfs_io -c swapext to exchangerange
* generic/710: repurpose this for exchangerange vs. quota testing
* generic/717: remove obsolete check
* ltp/{fsstress,fsx}: make the exchangerange naming consistent
* misc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic
* src/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions
* xfs/122: fix for exchrange conversion
* xfs/206: screen out exchange-range from golden output
* swapext: make sure that we don't swap unwritten extents unless they're part of a rt extent(??)
---
common/rc | 2
common/xfs | 2
configure.ac | 2
include/builddefs.in | 2
ltp/Makefile | 4 -
ltp/fsstress.c | 34 +++----
ltp/fsx.c | 43 +++------
m4/package_xfslibs.m4 | 15 ++-
src/Makefile | 4 -
src/fiexchange.h | 84 ++++--------------
src/global.h | 12 ++-
src/vfs/Makefile | 4 -
src/xfsfind.c | 1
tests/generic/709 | 2
tests/generic/710 | 14 +--
tests/generic/710.out | 2
tests/generic/711 | 2
tests/generic/712 | 10 +-
tests/generic/713 | 42 ++++-----
tests/generic/713.out | 38 ++++----
tests/generic/714 | 40 ++++----
tests/generic/714.out | 34 ++++---
tests/generic/715 | 26 +++--
tests/generic/715.out | 14 +--
tests/generic/716 | 4 -
tests/generic/717 | 39 ++++----
tests/generic/717.out | 32 +++----
tests/generic/718 | 12 +--
tests/generic/718.out | 2
tests/generic/719 | 4 -
tests/generic/720 | 10 +-
tests/generic/721 | 2
tests/generic/722 | 8 +-
tests/generic/723 | 12 +--
tests/generic/724 | 10 +-
tests/generic/725 | 4 -
tests/generic/726 | 4 -
tests/generic/727 | 4 -
tests/xfs/1213 | 73 +++++++++++++++
tests/xfs/1213.out | 2
tests/xfs/1214 | 232 +++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/1214.out | 2
tests/xfs/122.out | 6 +
tests/xfs/206 | 1
tests/xfs/300 | 2
tests/xfs/443 | 4 -
tests/xfs/789 | 2
tests/xfs/790 | 10 +-
tests/xfs/790.out | 2
tests/xfs/791 | 10 +-
tests/xfs/791.out | 2
tests/xfs/792 | 4 -
tests/xfs/795 | 2
53 files changed, 592 insertions(+), 342 deletions(-)
create mode 100755 tests/xfs/1213
create mode 100644 tests/xfs/1213.out
create mode 100755 tests/xfs/1214
create mode 100644 tests/xfs/1214.out
^ permalink raw reply [flat|nested] 29+ messages in thread
* [PATCH 01/10] misc: split swapext and exchangerange
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
@ 2024-06-18 0:47 ` Darrick J. Wong
2024-06-19 6:06 ` Christoph Hellwig
2024-06-18 0:47 ` [PATCH 02/10] misc: change xfs_io -c swapext to exchangerange Darrick J. Wong
` (8 subsequent siblings)
9 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:47 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
These two commands (and the kernel implementations) are splitting, so we
need to split the xfs_io usage.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
common/rc | 2 +-
common/xfs | 2 +-
tests/generic/709 | 2 +-
tests/generic/710 | 2 +-
tests/generic/711 | 2 +-
tests/generic/712 | 2 +-
tests/generic/713 | 4 ++--
tests/generic/714 | 4 ++--
tests/generic/715 | 4 ++--
tests/generic/716 | 2 +-
tests/generic/717 | 2 +-
tests/generic/718 | 2 +-
tests/generic/719 | 2 +-
tests/generic/720 | 2 +-
tests/generic/722 | 4 ++--
tests/generic/723 | 6 +++---
tests/generic/724 | 4 ++--
tests/generic/725 | 2 +-
tests/generic/726 | 2 +-
tests/generic/727 | 2 +-
tests/xfs/789 | 2 +-
tests/xfs/790 | 2 +-
tests/xfs/791 | 4 ++--
tests/xfs/792 | 2 +-
24 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/common/rc b/common/rc
index 163041fea5..9e69af1527 100644
--- a/common/rc
+++ b/common/rc
@@ -2771,7 +2771,7 @@ _require_xfs_io_command()
_notrun "xfs_io $command $param kernel support is missing"
param_checked="$param"
;;
- "swapext")
+ "swapext"|"exchangerange")
$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 128k -b 128k' $testfile > /dev/null
$XFS_IO_PROG -f -c 'truncate 128k' $testfile.1 > /dev/null
testio=`$XFS_IO_PROG -c "$command $param $testfile.1" $testfile 2>&1`
diff --git a/common/xfs b/common/xfs
index 11481180bd..0b0863f1dc 100644
--- a/common/xfs
+++ b/common/xfs
@@ -1823,7 +1823,7 @@ _require_xfs_scratch_atomicswap()
{
_require_xfs_mkfs_atomicswap
_require_scratch
- _require_xfs_io_command swapext '-v exchrange -a'
+ _require_xfs_io_command exchangerange
_scratch_mkfs -m reflink=1 > /dev/null
_try_scratch_mount || \
_notrun "atomicswap dependencies not supported by scratch filesystem type: $FSTYP"
diff --git a/tests/generic/709 b/tests/generic/709
index 4bd591b873..4fc938bb6a 100755
--- a/tests/generic/709
+++ b/tests/generic/709
@@ -14,7 +14,7 @@ _begin_fstest auto quick fiexchange swapext quota
. ./common/quota
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command swapext
_require_user
_require_nobody
_require_quota
diff --git a/tests/generic/710 b/tests/generic/710
index c7fca05d4c..6c6aa08f63 100755
--- a/tests/generic/710
+++ b/tests/generic/710
@@ -14,7 +14,7 @@ _begin_fstest auto quick fiexchange swapext quota
. ./common/quota
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command swapext
_require_user
_require_nobody
_require_quota
diff --git a/tests/generic/711 b/tests/generic/711
index f1318b30dd..b107f976ef 100755
--- a/tests/generic/711
+++ b/tests/generic/711
@@ -21,7 +21,7 @@ _cleanup()
. ./common/filter
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command swapext
_require_test
dir=$TEST_DIR/test-$seq
diff --git a/tests/generic/712 b/tests/generic/712
index d4a705478e..f2862c3f8e 100755
--- a/tests/generic/712
+++ b/tests/generic/712
@@ -21,7 +21,7 @@ _cleanup()
# real QA test starts here
_require_test_program punch-alternating
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command exchangerange
_require_test
dir=$TEST_DIR/test-$seq
diff --git a/tests/generic/713 b/tests/generic/713
index 9b742ee0cb..b2d3260806 100755
--- a/tests/generic/713
+++ b/tests/generic/713
@@ -21,7 +21,7 @@ _cleanup()
. ./common/reflink
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange -s 64k -l 64k'
+_require_xfs_io_command exchangerange ' -s 64k -l 64k'
_require_xfs_io_command "falloc"
_require_test
@@ -36,7 +36,7 @@ filesnap() {
test_swapext_once() {
filesnap "$1: before swapext" $dir/$3 $dir/$4
- $XFS_IO_PROG -c "swapext -v exchrange $2 $dir/$3" $dir/$4
+ $XFS_IO_PROG -c "exchangerange $2 $dir/$3" $dir/$4
filesnap "$1: after swapext" $dir/$3 $dir/$4
_test_cycle_mount
filesnap "$1: after cycling mount" $dir/$3 $dir/$4
diff --git a/tests/generic/714 b/tests/generic/714
index b48a4b7d31..ea963fdfa7 100755
--- a/tests/generic/714
+++ b/tests/generic/714
@@ -22,7 +22,7 @@ _cleanup()
. ./common/reflink
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command exchangerange
_require_xfs_io_command "falloc"
_require_test_reflink
@@ -37,7 +37,7 @@ filesnap() {
test_swapext_once() {
filesnap "$1: before swapext" $dir/$3 $dir/$4
- $XFS_IO_PROG -c "swapext -v exchrange $2 $dir/$3" $dir/$4
+ $XFS_IO_PROG -c "exchangerange $2 $dir/$3" $dir/$4
filesnap "$1: after swapext" $dir/$3 $dir/$4
_test_cycle_mount
filesnap "$1: after cycling mount" $dir/$3 $dir/$4
diff --git a/tests/generic/715 b/tests/generic/715
index 595953dfcf..eb164a848a 100755
--- a/tests/generic/715
+++ b/tests/generic/715
@@ -21,7 +21,7 @@ _cleanup()
. ./common/reflink
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange -s 64k -l 64k'
+_require_xfs_io_command exchangerange ' -s 64k -l 64k'
_require_test
filesnap() {
@@ -51,7 +51,7 @@ test_swapext_once() {
_pwrite_byte 0x59 0 $((blksz * b_len)) $dir/b >> $seqres.full
filesnap "$tag: before swapext" $dir/a $dir/b
- cmd="swapext -v exchrange -s $((blksz * a_off)) -d $((blksz * b_off)) $len $dir/a"
+ cmd="exchangerange -s $((blksz * a_off)) -d $((blksz * b_off)) $len $dir/a"
echo "$cmd" >> $seqres.full
$XFS_IO_PROG -c "$cmd" $dir/b
filesnap "$tag: after swapext" $dir/a $dir/b
diff --git a/tests/generic/716 b/tests/generic/716
index 25976ab898..5d3fa5e721 100755
--- a/tests/generic/716
+++ b/tests/generic/716
@@ -24,7 +24,7 @@ _cleanup()
. ./common/reflink
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command exchangerange
_require_xfs_io_command startupdate
_require_test_reflink
_require_test
diff --git a/tests/generic/717 b/tests/generic/717
index 2c45e715f4..dd2f3dcdc4 100755
--- a/tests/generic/717
+++ b/tests/generic/717
@@ -21,7 +21,7 @@ _cleanup()
. ./common/reflink
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command exchangerange
_require_xfs_io_command startupdate
_require_test
_require_scratch
diff --git a/tests/generic/718 b/tests/generic/718
index f53d1840d0..23e092df4d 100755
--- a/tests/generic/718
+++ b/tests/generic/718
@@ -21,7 +21,7 @@ _cleanup()
. ./common/reflink
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command exchangerange
_require_test
dir=$TEST_DIR/test-$seq
diff --git a/tests/generic/719 b/tests/generic/719
index fe0b9d082e..70d1ae5d0c 100755
--- a/tests/generic/719
+++ b/tests/generic/719
@@ -23,7 +23,7 @@ _cleanup()
. ./common/filter
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command exchangerange
_require_xfs_io_command startupdate '-e'
_require_test
diff --git a/tests/generic/720 b/tests/generic/720
index 4db69c6921..25253968a2 100755
--- a/tests/generic/720
+++ b/tests/generic/720
@@ -20,7 +20,7 @@ _cleanup()
. ./common/filter
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command exchangerange
_require_test_program punch-alternating
_require_test
diff --git a/tests/generic/722 b/tests/generic/722
index 40eab9bbb3..3ec831e708 100755
--- a/tests/generic/722
+++ b/tests/generic/722
@@ -23,7 +23,7 @@ _cleanup()
# real QA test starts here
_require_test_program "punch-alternating"
-_require_xfs_io_command swapext '-v exchrange -a'
+_require_xfs_io_command exchangerange
_require_scratch
_require_scratch_shutdown
@@ -43,7 +43,7 @@ od -tx1 -Ad -c $SCRATCH_MNT/a > /tmp/a0
od -tx1 -Ad -c $SCRATCH_MNT/b > /tmp/b0
echo swap >> $seqres.full
-$XFS_IO_PROG -c "swapext -v exchrange -a -e -f -u $SCRATCH_MNT/a" $SCRATCH_MNT/b
+$XFS_IO_PROG -c "exchangerange -e -f -u $SCRATCH_MNT/a" $SCRATCH_MNT/b
_scratch_shutdown
_scratch_cycle_mount
diff --git a/tests/generic/723 b/tests/generic/723
index b452de0208..0e1de3ec1f 100755
--- a/tests/generic/723
+++ b/tests/generic/723
@@ -22,7 +22,7 @@ _cleanup()
# real QA test starts here
_require_test_program "punch-alternating"
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command exchangerange
_require_scratch
_scratch_mkfs >> $seqres.full
@@ -41,7 +41,7 @@ echo "md5 a: $old_a md5 b: $old_b" >> $seqres.full
# Test swapext with the -n option, which will do all the input parameter
# checking and return 0 without changing anything.
echo dry run swap >> $seqres.full
-$XFS_IO_PROG -c "swapext -v exchrange -n -f -u $SCRATCH_MNT/a" $SCRATCH_MNT/b
+$XFS_IO_PROG -c "exchangerange -n -f -u $SCRATCH_MNT/a" $SCRATCH_MNT/b
_scratch_cycle_mount
new_a=$(md5sum $SCRATCH_MNT/a | awk '{print $1}')
@@ -54,7 +54,7 @@ test $old_b = $new_b || echo "scratch file B should not have swapped"
# Do it again, but without the -n option, to prove that we can actually
# swap the file contents.
echo actual swap >> $seqres.full
-$XFS_IO_PROG -c "swapext -v exchrange -f -u $SCRATCH_MNT/a" $SCRATCH_MNT/b
+$XFS_IO_PROG -c "exchangerange -f -u $SCRATCH_MNT/a" $SCRATCH_MNT/b
_scratch_cycle_mount
new_a=$(md5sum $SCRATCH_MNT/a | awk '{print $1}')
diff --git a/tests/generic/724 b/tests/generic/724
index 12324fb156..9536705503 100755
--- a/tests/generic/724
+++ b/tests/generic/724
@@ -22,7 +22,7 @@ _cleanup()
. ./common/filter
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange -a'
+_require_xfs_io_command exchangerange
_require_scratch
_scratch_mkfs >> $seqres.full
@@ -42,7 +42,7 @@ md5sum $SCRATCH_MNT/b | _filter_scratch
# Test swapext. -h means skip holes in /b, and -e means operate to EOF
echo swap | tee -a $seqres.full
-$XFS_IO_PROG -c "swapext -v exchrange -f -u -h -e -a $SCRATCH_MNT/b" $SCRATCH_MNT/a
+$XFS_IO_PROG -c "exchangerange -f -u -h -e $SCRATCH_MNT/b" $SCRATCH_MNT/a
_scratch_cycle_mount
md5sum $SCRATCH_MNT/a | _filter_scratch
diff --git a/tests/generic/725 b/tests/generic/725
index bf60127b39..3c6180fcbb 100755
--- a/tests/generic/725
+++ b/tests/generic/725
@@ -22,7 +22,7 @@ _cleanup()
. ./common/filter
# real QA test starts here
-_require_xfs_io_command swapext '-v exchrange -a'
+_require_xfs_io_command exchangerange
_require_xfs_io_command startupdate '-e'
_require_scratch
diff --git a/tests/generic/726 b/tests/generic/726
index 4cf18bd0e5..05d8a2372a 100755
--- a/tests/generic/726
+++ b/tests/generic/726
@@ -25,7 +25,7 @@ _begin_fstest auto fiexchange swapext quick
# Modify as appropriate.
_supported_fs generic
_require_user
-_require_xfs_io_command swapext '-v exchrange -a'
+_require_xfs_io_command exchangerange
_require_xfs_io_command startupdate
_require_scratch
diff --git a/tests/generic/727 b/tests/generic/727
index af9612c967..4b0d5bd372 100755
--- a/tests/generic/727
+++ b/tests/generic/727
@@ -28,7 +28,7 @@ _supported_fs generic
_require_user
_require_command "$GETCAP_PROG" getcap
_require_command "$SETCAP_PROG" setcap
-_require_xfs_io_command swapext '-v exchrange -a'
+_require_xfs_io_command exchangerange
_require_xfs_io_command startupdate
_require_scratch
_require_attrs security
diff --git a/tests/xfs/789 b/tests/xfs/789
index b966c65119..00b98020f2 100755
--- a/tests/xfs/789
+++ b/tests/xfs/789
@@ -21,7 +21,7 @@ _cleanup()
# real QA test starts here
_supported_fs xfs
-_require_xfs_io_command swapext '-v exchrange'
+_require_xfs_io_command swapext
_require_test
# We can't do any reasonable swapping if the files we're going to create are
diff --git a/tests/xfs/790 b/tests/xfs/790
index db6ce741d7..62bbd1fea6 100755
--- a/tests/xfs/790
+++ b/tests/xfs/790
@@ -24,7 +24,7 @@ _cleanup()
# real QA test starts here
_supported_fs xfs
-_require_xfs_io_command swapext '-v exchrange -a'
+_require_xfs_io_command exchangerange
_require_test_program "punch-alternating"
_require_xfs_io_command startupdate
_require_xfs_io_error_injection "bmap_finish_one"
diff --git a/tests/xfs/791 b/tests/xfs/791
index 84e3bee9b9..b4ded88d68 100755
--- a/tests/xfs/791
+++ b/tests/xfs/791
@@ -25,7 +25,7 @@ _cleanup()
# real QA test starts here
_supported_fs xfs
-_require_xfs_io_command swapext '-v exchrange -a'
+_require_xfs_io_command exchangerange
_require_xfs_scratch_atomicswap
_require_xfs_io_error_injection "bmap_finish_one"
@@ -48,7 +48,7 @@ md5sum $SCRATCH_MNT/b | _filter_scratch
# Test swapext. -h means skip holes in /b, and -e means operate to EOF
echo swap | tee -a $seqres.full
$XFS_IO_PROG -x -c 'inject bmap_finish_one' \
- -c "swapext -v exchrange -f -u -h -e -a $SCRATCH_MNT/b" $SCRATCH_MNT/a
+ -c "exchangerange -f -u -h -e $SCRATCH_MNT/b" $SCRATCH_MNT/a
_scratch_cycle_mount
md5sum $SCRATCH_MNT/a | _filter_scratch
diff --git a/tests/xfs/792 b/tests/xfs/792
index bfbfbce4aa..fded7a5a52 100755
--- a/tests/xfs/792
+++ b/tests/xfs/792
@@ -25,7 +25,7 @@ _cleanup()
# real QA test starts here
_supported_fs xfs
-_require_xfs_io_command swapext '-v exchrange -a'
+_require_xfs_io_command exchangerange
_require_xfs_io_command startupdate '-e'
_require_xfs_scratch_atomicswap
_require_xfs_io_error_injection "bmap_finish_one"
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 02/10] misc: change xfs_io -c swapext to exchangerange
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
2024-06-18 0:47 ` [PATCH 01/10] misc: split swapext and exchangerange Darrick J. Wong
@ 2024-06-18 0:47 ` Darrick J. Wong
2024-06-19 6:07 ` Christoph Hellwig
2024-06-18 0:47 ` [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing Darrick J. Wong
` (7 subsequent siblings)
9 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:47 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Update the swapext command to use exchangerange as part of severing the
connection between the two ioctls.
Flags changed:
-h (only exchange written extents) is now -w.
-a (atomic mode) is always enabled now.
-e (to eof) is now the default; -l (length) disables this flag.
-u (unconditonal swap) is inverted to -c (commit only if fresh).
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/generic/712 | 8 ++++----
tests/generic/713 | 38 +++++++++++++++++++-------------------
tests/generic/713.out | 38 +++++++++++++++++++-------------------
tests/generic/714 | 36 ++++++++++++++++++------------------
tests/generic/714.out | 34 +++++++++++++++++-----------------
tests/generic/715 | 22 ++++++++++++----------
tests/generic/715.out | 14 +++++++-------
tests/generic/716 | 2 +-
tests/generic/717 | 34 +++++++++++++++++-----------------
tests/generic/717.out | 32 ++++++++++++++++----------------
tests/generic/718 | 10 +++++-----
tests/generic/718.out | 2 +-
tests/generic/719 | 2 +-
tests/generic/720 | 8 ++++----
tests/generic/721 | 2 +-
tests/generic/722 | 6 +++---
tests/generic/723 | 10 +++++-----
tests/generic/724 | 8 ++++----
tests/generic/725 | 2 +-
tests/generic/726 | 2 +-
tests/generic/727 | 2 +-
tests/xfs/300 | 2 +-
tests/xfs/443 | 4 ++--
tests/xfs/790 | 8 ++++----
tests/xfs/790.out | 2 +-
tests/xfs/791 | 8 ++++----
tests/xfs/791.out | 2 +-
tests/xfs/792 | 2 +-
tests/xfs/795 | 2 +-
29 files changed, 172 insertions(+), 170 deletions(-)
diff --git a/tests/generic/712 b/tests/generic/712
index f2862c3f8e..a5f2ac26fd 100755
--- a/tests/generic/712
+++ b/tests/generic/712
@@ -4,10 +4,10 @@
#
# FS QA Test No. 712
#
-# Make sure that swapext modifies ctime and not mtime of the file.
+# Make sure that exchangerange modifies ctime and not mtime of the file.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -39,8 +39,8 @@ old_mtime="$(echo $(stat -c '%y' $dir/a $dir/b))"
old_ctime="$(echo $(stat -c '%z' $dir/a $dir/b))"
stat -c '%y %Y %z %Z' $dir/a $dir/b >> $seqres.full
-# Now try to swapext
-$XFS_IO_PROG -c "swapext $dir/b" $dir/a
+# Now try to exchangerange
+$XFS_IO_PROG -c "exchangerange $dir/b" $dir/a
# Snapshot the 'a' file after we swap
echo after >> $seqres.full
diff --git a/tests/generic/713 b/tests/generic/713
index b2d3260806..b0165b1d91 100755
--- a/tests/generic/713
+++ b/tests/generic/713
@@ -4,10 +4,10 @@
#
# FS QA Test No. 713
#
-# Test swapext between ranges of two different files.
+# Test exchangerange between ranges of two different files.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -34,26 +34,26 @@ filesnap() {
fi
}
-test_swapext_once() {
- filesnap "$1: before swapext" $dir/$3 $dir/$4
+test_exchangerange_once() {
+ filesnap "$1: before exchangerange" $dir/$3 $dir/$4
$XFS_IO_PROG -c "exchangerange $2 $dir/$3" $dir/$4
- filesnap "$1: after swapext" $dir/$3 $dir/$4
+ filesnap "$1: after exchangerange" $dir/$3 $dir/$4
_test_cycle_mount
filesnap "$1: after cycling mount" $dir/$3 $dir/$4
echo
}
-test_swapext_two() {
- # swapext the same range of two files
- test_swapext_once "$*: samerange" \
+test_exchangerange_two() {
+ # exchangerange the same range of two files
+ test_exchangerange_once "$*: samerange" \
"-s $((blksz * 3)) -d $((blksz * 3)) -l $((blksz * 5))" b a
- # swapext different ranges of two files
- test_swapext_once "$*: diffrange" \
+ # exchangerange different ranges of two files
+ test_exchangerange_once "$*: diffrange" \
"-s $((blksz * 37)) -d $((blksz * 47)) -l $((blksz * 7))" b a
- # swapext overlapping ranges of two files
- test_swapext_once "$*: overlap" \
+ # exchangerange overlapping ranges of two files
+ test_exchangerange_once "$*: overlap" \
"-s $((blksz * 17)) -d $((blksz * 23)) -l $((blksz * 7))" b a
}
@@ -67,19 +67,19 @@ _require_congruent_file_oplen $TEST_DIR $blksz
rm -rf $dir/a $dir/b
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
_pwrite_byte 0x59 0 $((blksz * nrblks)) $dir/b >> $seqres.full
-test_swapext_two "simple"
+test_exchangerange_two "simple"
# Make some files that don't end an aligned offset.
rm -rf $dir/a $dir/b
_pwrite_byte 0x58 0 $(( (blksz * nrblks) + 37)) $dir/a >> $seqres.full
_pwrite_byte 0x59 0 $(( (blksz * nrblks) + 37)) $dir/b >> $seqres.full
-test_swapext_once "unalignedeof" "" a b
+test_exchangerange_once "unalignedeof" "" a b
# Set up some crazy rainbow files
rm -rf $dir/a $dir/b
_weave_file_rainbow $blksz $nrblks $dir/a >> $seqres.full
_weave_file_rainbow $blksz $nrblks $dir/b >> $seqres.full
-test_swapext_two "rainbow"
+test_exchangerange_two "rainbow"
# Now set up a simple file for testing within the same file
rm -rf $dir/c
@@ -87,12 +87,12 @@ $XFS_IO_PROG -f -c "pwrite -S 0x58 0 $((blksz * nrblks))" \
-c "pwrite -S 0x59 $((blksz * nrblks)) $((blksz * nrblks))" \
$dir/c >> $seqres.full
-# swapext the same offset into the 'X' and 'Y' regions of the file
-test_swapext_once "single: sameXandY" \
+# exchangerange the same offset into the 'X' and 'Y' regions of the file
+test_exchangerange_once "single: sameXandY" \
"-s $((blksz * 3)) -d $((blksz * (nrblks + 3))) -l $((blksz * 5))" c c
-# swapext the same offset into the 'X' and 'Y' regions of the file
-test_swapext_once "single: overlap" \
+# exchangerange the same offset into the 'X' and 'Y' regions of the file
+test_exchangerange_once "single: overlap" \
"-s $((blksz * 13)) -d $((blksz * 17)) -l $((blksz * 5))" c c
# success, all done
diff --git a/tests/generic/713.out b/tests/generic/713.out
index cb58e93aa6..87e26c5372 100644
--- a/tests/generic/713.out
+++ b/tests/generic/713.out
@@ -1,85 +1,85 @@
QA output created by 713
-simple: samerange: before swapext
+simple: samerange: before exchangerange
db85d578204631f2b4eb1e73974253c2 TEST_DIR/test-713/b
d0425612f15c6071022cf7127620f63d TEST_DIR/test-713/a
-simple: samerange: after swapext
+simple: samerange: after exchangerange
20beef1c9ed7de02e4229c69bd43bd8f TEST_DIR/test-713/b
e7697fa99d08f7eb76fa3fb963fe916a TEST_DIR/test-713/a
simple: samerange: after cycling mount
20beef1c9ed7de02e4229c69bd43bd8f TEST_DIR/test-713/b
e7697fa99d08f7eb76fa3fb963fe916a TEST_DIR/test-713/a
-simple: diffrange: before swapext
+simple: diffrange: before exchangerange
20beef1c9ed7de02e4229c69bd43bd8f TEST_DIR/test-713/b
e7697fa99d08f7eb76fa3fb963fe916a TEST_DIR/test-713/a
-simple: diffrange: after swapext
+simple: diffrange: after exchangerange
cd32ce54c295fcdf571ce7f8220fac56 TEST_DIR/test-713/b
d9771c5bb6d9db00b9abe65a4410e1a6 TEST_DIR/test-713/a
simple: diffrange: after cycling mount
cd32ce54c295fcdf571ce7f8220fac56 TEST_DIR/test-713/b
d9771c5bb6d9db00b9abe65a4410e1a6 TEST_DIR/test-713/a
-simple: overlap: before swapext
+simple: overlap: before exchangerange
cd32ce54c295fcdf571ce7f8220fac56 TEST_DIR/test-713/b
d9771c5bb6d9db00b9abe65a4410e1a6 TEST_DIR/test-713/a
-simple: overlap: after swapext
+simple: overlap: after exchangerange
e0fff655f6a08fc2f03ee01e4767060c TEST_DIR/test-713/b
ec7d764c85e583e305028c9cba5b25b6 TEST_DIR/test-713/a
simple: overlap: after cycling mount
e0fff655f6a08fc2f03ee01e4767060c TEST_DIR/test-713/b
ec7d764c85e583e305028c9cba5b25b6 TEST_DIR/test-713/a
-unalignedeof: before swapext
+unalignedeof: before exchangerange
9f8c731a4f1946ffdda8c33e82417f2d TEST_DIR/test-713/a
7a5d2ba7508226751c835292e28cd227 TEST_DIR/test-713/b
-unalignedeof: after swapext
+unalignedeof: after exchangerange
7a5d2ba7508226751c835292e28cd227 TEST_DIR/test-713/a
9f8c731a4f1946ffdda8c33e82417f2d TEST_DIR/test-713/b
unalignedeof: after cycling mount
7a5d2ba7508226751c835292e28cd227 TEST_DIR/test-713/a
9f8c731a4f1946ffdda8c33e82417f2d TEST_DIR/test-713/b
-rainbow: samerange: before swapext
+rainbow: samerange: before exchangerange
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/a
-rainbow: samerange: after swapext
+rainbow: samerange: after exchangerange
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/a
rainbow: samerange: after cycling mount
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/a
-rainbow: diffrange: before swapext
+rainbow: diffrange: before exchangerange
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/a
-rainbow: diffrange: after swapext
+rainbow: diffrange: after exchangerange
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/a
rainbow: diffrange: after cycling mount
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/a
-rainbow: overlap: before swapext
+rainbow: overlap: before exchangerange
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-713/a
-rainbow: overlap: after swapext
+rainbow: overlap: after exchangerange
6753bc585e3c71d53bfaae11d2ffee99 TEST_DIR/test-713/b
39597abd4d9d0c9ceac22b77eb00c373 TEST_DIR/test-713/a
rainbow: overlap: after cycling mount
6753bc585e3c71d53bfaae11d2ffee99 TEST_DIR/test-713/b
39597abd4d9d0c9ceac22b77eb00c373 TEST_DIR/test-713/a
-single: sameXandY: before swapext
+single: sameXandY: before exchangerange
39e17753fa9e923a3b5928e13775e358 TEST_DIR/test-713/c
-single: sameXandY: after swapext
+single: sameXandY: after exchangerange
8262c617070703fb0e2a28d8f05e3112 TEST_DIR/test-713/c
single: sameXandY: after cycling mount
8262c617070703fb0e2a28d8f05e3112 TEST_DIR/test-713/c
-single: overlap: before swapext
+single: overlap: before exchangerange
8262c617070703fb0e2a28d8f05e3112 TEST_DIR/test-713/c
-swapext: Invalid argument
-single: overlap: after swapext
+exchangerange: Invalid argument
+single: overlap: after exchangerange
8262c617070703fb0e2a28d8f05e3112 TEST_DIR/test-713/c
single: overlap: after cycling mount
8262c617070703fb0e2a28d8f05e3112 TEST_DIR/test-713/c
diff --git a/tests/generic/714 b/tests/generic/714
index ea963fdfa7..4d2d4a0b49 100755
--- a/tests/generic/714
+++ b/tests/generic/714
@@ -4,11 +4,11 @@
#
# FS QA Test No. 714
#
-# Test swapext between ranges of two different files, when one of the files
+# Test exchangerange between ranges of two different files, when one of the files
# is shared.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -35,26 +35,26 @@ filesnap() {
fi
}
-test_swapext_once() {
- filesnap "$1: before swapext" $dir/$3 $dir/$4
+test_exchangerange_once() {
+ filesnap "$1: before exchangerange" $dir/$3 $dir/$4
$XFS_IO_PROG -c "exchangerange $2 $dir/$3" $dir/$4
- filesnap "$1: after swapext" $dir/$3 $dir/$4
+ filesnap "$1: after exchangerange" $dir/$3 $dir/$4
_test_cycle_mount
filesnap "$1: after cycling mount" $dir/$3 $dir/$4
echo
}
-test_swapext_two() {
- # swapext the same range of two files
- test_swapext_once "$*: samerange" \
+test_exchangerange_two() {
+ # exchangerange the same range of two files
+ test_exchangerange_once "$*: samerange" \
"-s $((blksz * 3)) -d $((blksz * 3)) -l $((blksz * 5))" b a
- # swapext different ranges of two files
- test_swapext_once "$*: diffrange" \
+ # exchangerange different ranges of two files
+ test_exchangerange_once "$*: diffrange" \
"-s $((blksz * 37)) -d $((blksz * 47)) -l $((blksz * 7))" b a
- # swapext overlapping ranges of two files
- test_swapext_once "$*: overlap" \
+ # exchangerange overlapping ranges of two files
+ test_exchangerange_once "$*: overlap" \
"-s $((blksz * 17)) -d $((blksz * 23)) -l $((blksz * 7))" b a
# Now let's overwrite a entirely to make sure COW works
@@ -79,14 +79,14 @@ rm -f $dir/a $dir/b $dir/sharea
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
_pwrite_byte 0x59 0 $((blksz * nrblks)) $dir/b >> $seqres.full
_cp_reflink $dir/a $dir/sharea
-test_swapext_two "simple"
+test_exchangerange_two "simple"
# Set up some crazy rainbow files
rm -f $dir/a $dir/b $dir/sharea
_weave_file_rainbow $blksz $nrblks $dir/a >> $seqres.full
_weave_file_rainbow $blksz $nrblks $dir/b >> $seqres.full
_cp_reflink $dir/a $dir/sharea
-test_swapext_two "rainbow"
+test_exchangerange_two "rainbow"
# Now set up a simple file for testing within the same file
rm -f $dir/c $dir/sharec
@@ -95,12 +95,12 @@ $XFS_IO_PROG -f -c "pwrite -S 0x58 0 $((blksz * nrblks))" \
$dir/c >> $seqres.full
_cp_reflink $dir/c $dir/sharec
-# swapext the same offset into the 'X' and 'Y' regions of the file
-test_swapext_once "single: sameXandY" \
+# exchangerange the same offset into the 'X' and 'Y' regions of the file
+test_exchangerange_once "single: sameXandY" \
"-s $((blksz * 3)) -d $((blksz * (nrblks + 3))) -l $((blksz * 5))" c c
-# swapext the same offset into the 'X' and 'Y' regions of the file
-test_swapext_once "single: overlap" \
+# exchangerange the same offset into the 'X' and 'Y' regions of the file
+test_exchangerange_once "single: overlap" \
"-s $((blksz * 13)) -d $((blksz * 17)) -l $((blksz * 5))" c c
# Now let's overwrite a entirely to make sure COW works
diff --git a/tests/generic/714.out b/tests/generic/714.out
index bd45efc141..0d1714bf0c 100644
--- a/tests/generic/714.out
+++ b/tests/generic/714.out
@@ -1,28 +1,28 @@
QA output created by 714
-simple: samerange: before swapext
+simple: samerange: before exchangerange
db85d578204631f2b4eb1e73974253c2 TEST_DIR/test-714/b
d0425612f15c6071022cf7127620f63d TEST_DIR/test-714/a
-simple: samerange: after swapext
+simple: samerange: after exchangerange
20beef1c9ed7de02e4229c69bd43bd8f TEST_DIR/test-714/b
e7697fa99d08f7eb76fa3fb963fe916a TEST_DIR/test-714/a
simple: samerange: after cycling mount
20beef1c9ed7de02e4229c69bd43bd8f TEST_DIR/test-714/b
e7697fa99d08f7eb76fa3fb963fe916a TEST_DIR/test-714/a
-simple: diffrange: before swapext
+simple: diffrange: before exchangerange
20beef1c9ed7de02e4229c69bd43bd8f TEST_DIR/test-714/b
e7697fa99d08f7eb76fa3fb963fe916a TEST_DIR/test-714/a
-simple: diffrange: after swapext
+simple: diffrange: after exchangerange
cd32ce54c295fcdf571ce7f8220fac56 TEST_DIR/test-714/b
d9771c5bb6d9db00b9abe65a4410e1a6 TEST_DIR/test-714/a
simple: diffrange: after cycling mount
cd32ce54c295fcdf571ce7f8220fac56 TEST_DIR/test-714/b
d9771c5bb6d9db00b9abe65a4410e1a6 TEST_DIR/test-714/a
-simple: overlap: before swapext
+simple: overlap: before exchangerange
cd32ce54c295fcdf571ce7f8220fac56 TEST_DIR/test-714/b
d9771c5bb6d9db00b9abe65a4410e1a6 TEST_DIR/test-714/a
-simple: overlap: after swapext
+simple: overlap: after exchangerange
e0fff655f6a08fc2f03ee01e4767060c TEST_DIR/test-714/b
ec7d764c85e583e305028c9cba5b25b6 TEST_DIR/test-714/a
simple: overlap: after cycling mount
@@ -34,30 +34,30 @@ d0425612f15c6071022cf7127620f63d TEST_DIR/test-714/sharea
d0425612f15c6071022cf7127620f63d TEST_DIR/test-714/sharea
d0425612f15c6071022cf7127620f63d TEST_DIR/test-714/sharea
-rainbow: samerange: before swapext
+rainbow: samerange: before exchangerange
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/a
-rainbow: samerange: after swapext
+rainbow: samerange: after exchangerange
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/a
rainbow: samerange: after cycling mount
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/a
-rainbow: diffrange: before swapext
+rainbow: diffrange: before exchangerange
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/a
-rainbow: diffrange: after swapext
+rainbow: diffrange: after exchangerange
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/a
rainbow: diffrange: after cycling mount
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/a
-rainbow: overlap: before swapext
+rainbow: overlap: before exchangerange
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/b
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/a
-rainbow: overlap: after swapext
+rainbow: overlap: after exchangerange
6753bc585e3c71d53bfaae11d2ffee99 TEST_DIR/test-714/b
39597abd4d9d0c9ceac22b77eb00c373 TEST_DIR/test-714/a
rainbow: overlap: after cycling mount
@@ -69,17 +69,17 @@ overwrite A and B entirely
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/sharea
48b41ee1970eb71064b77181f42634cf TEST_DIR/test-714/sharea
-single: sameXandY: before swapext
+single: sameXandY: before exchangerange
39e17753fa9e923a3b5928e13775e358 TEST_DIR/test-714/c
-single: sameXandY: after swapext
+single: sameXandY: after exchangerange
8262c617070703fb0e2a28d8f05e3112 TEST_DIR/test-714/c
single: sameXandY: after cycling mount
8262c617070703fb0e2a28d8f05e3112 TEST_DIR/test-714/c
-single: overlap: before swapext
+single: overlap: before exchangerange
8262c617070703fb0e2a28d8f05e3112 TEST_DIR/test-714/c
-swapext: Invalid argument
-single: overlap: after swapext
+exchangerange: Invalid argument
+single: overlap: after exchangerange
8262c617070703fb0e2a28d8f05e3112 TEST_DIR/test-714/c
single: overlap: after cycling mount
8262c617070703fb0e2a28d8f05e3112 TEST_DIR/test-714/c
diff --git a/tests/generic/715 b/tests/generic/715
index eb164a848a..60a5381eaa 100755
--- a/tests/generic/715
+++ b/tests/generic/715
@@ -4,10 +4,10 @@
#
# FS QA Test No. 715
#
-# Test swapext between two files of unlike size.
+# Test exchangerange between two files of unlike size.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -33,7 +33,7 @@ filesnap() {
fi
}
-test_swapext_once() {
+test_exchangerange_once() {
local tag=$1
local a_len=$2
local b_len=$3
@@ -41,20 +41,22 @@ test_swapext_once() {
local b_off=$5
local len=$6
- # len is either a block count or -e to swap to EOF
- if [ "$len" != "-e" ]; then
+ # len is either a block count or "EOF"
+ if [ "$len" = "EOF" ]; then
+ len=""
+ else
len="-l $((blksz * len))"
fi
rm -f $dir/a $dir/b
_pwrite_byte 0x58 0 $((blksz * a_len)) $dir/a >> $seqres.full
_pwrite_byte 0x59 0 $((blksz * b_len)) $dir/b >> $seqres.full
- filesnap "$tag: before swapext" $dir/a $dir/b
+ filesnap "$tag: before exchangerange" $dir/a $dir/b
cmd="exchangerange -s $((blksz * a_off)) -d $((blksz * b_off)) $len $dir/a"
echo "$cmd" >> $seqres.full
$XFS_IO_PROG -c "$cmd" $dir/b
- filesnap "$tag: after swapext" $dir/a $dir/b
+ filesnap "$tag: after exchangerange" $dir/a $dir/b
_test_cycle_mount
filesnap "$tag: after cycling mount" $dir/a $dir/b
@@ -65,11 +67,11 @@ dir=$TEST_DIR/test-$seq
mkdir -p $dir
blksz=65536
-test_swapext_once "last 5 blocks" 27 37 22 32 5
+test_exchangerange_once "last 5 blocks" 27 37 22 32 5
-test_swapext_once "whole file to eof" 27 37 0 0 -e
+test_exchangerange_once "whole file to eof" 27 37 0 0 EOF
-test_swapext_once "blocks 30-40" 27 37 30 30 10
+test_exchangerange_once "blocks 30-40" 27 37 30 30 10
# success, all done
status=0
diff --git a/tests/generic/715.out b/tests/generic/715.out
index b4a6565aba..c2652e632b 100644
--- a/tests/generic/715.out
+++ b/tests/generic/715.out
@@ -1,29 +1,29 @@
QA output created by 715
-last 5 blocks: before swapext
+last 5 blocks: before exchangerange
207ea56e0ccbf50d38fd3a2d842aa170 TEST_DIR/test-715/a
eb58941d31f5be1e4e22df8c536dd490 TEST_DIR/test-715/b
-last 5 blocks: after swapext
+last 5 blocks: after exchangerange
3f34470fe9feb8513d5f3a8538f2c5f3 TEST_DIR/test-715/a
c3daca7dd9218371cd0dc64f11e4b0bf TEST_DIR/test-715/b
last 5 blocks: after cycling mount
3f34470fe9feb8513d5f3a8538f2c5f3 TEST_DIR/test-715/a
c3daca7dd9218371cd0dc64f11e4b0bf TEST_DIR/test-715/b
-whole file to eof: before swapext
+whole file to eof: before exchangerange
207ea56e0ccbf50d38fd3a2d842aa170 TEST_DIR/test-715/a
eb58941d31f5be1e4e22df8c536dd490 TEST_DIR/test-715/b
-whole file to eof: after swapext
+whole file to eof: after exchangerange
eb58941d31f5be1e4e22df8c536dd490 TEST_DIR/test-715/a
207ea56e0ccbf50d38fd3a2d842aa170 TEST_DIR/test-715/b
whole file to eof: after cycling mount
eb58941d31f5be1e4e22df8c536dd490 TEST_DIR/test-715/a
207ea56e0ccbf50d38fd3a2d842aa170 TEST_DIR/test-715/b
-blocks 30-40: before swapext
+blocks 30-40: before exchangerange
207ea56e0ccbf50d38fd3a2d842aa170 TEST_DIR/test-715/a
eb58941d31f5be1e4e22df8c536dd490 TEST_DIR/test-715/b
-swapext: Invalid argument
-blocks 30-40: after swapext
+exchangerange: Invalid argument
+blocks 30-40: after exchangerange
207ea56e0ccbf50d38fd3a2d842aa170 TEST_DIR/test-715/a
eb58941d31f5be1e4e22df8c536dd490 TEST_DIR/test-715/b
blocks 30-40: after cycling mount
diff --git a/tests/generic/716 b/tests/generic/716
index 5d3fa5e721..dbfa426378 100755
--- a/tests/generic/716
+++ b/tests/generic/716
@@ -10,7 +10,7 @@
# and some of the contents are updated.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
diff --git a/tests/generic/717 b/tests/generic/717
index dd2f3dcdc4..ffabe2eaa1 100755
--- a/tests/generic/717
+++ b/tests/generic/717
@@ -7,7 +7,7 @@
# Try invalid parameters to see if they fail.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -39,62 +39,62 @@ _pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/b >> $seqres.full
echo Immutable files
-$XFS_IO_PROG -c 'chattr +i' -c "swapext $dir/b" $dir/a
+$XFS_IO_PROG -c 'chattr +i' -c "exchangerange $dir/b" $dir/a
$CHATTR_PROG -i $dir/a
echo Readonly files
-$XFS_IO_PROG -r -c "swapext $dir/b" $dir/a
+$XFS_IO_PROG -r -c "exchangerange $dir/b" $dir/a
echo Directories
-$XFS_IO_PROG -c "swapext $dir/b" $dir
+$XFS_IO_PROG -c "exchangerange $dir/b" $dir
echo Unaligned ranges
-$XFS_IO_PROG -c "swapext -s 37 -d 61 -l 17 $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange -s 37 -d 61 -l 17 $dir/b" $dir/a
echo file1 range entirely beyond EOF
-$XFS_IO_PROG -c "swapext -s $(( blksz * (nrblks + 500) )) -d 0 -l $blksz $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange -s $(( blksz * (nrblks + 500) )) -d 0 -l $blksz $dir/b" $dir/a
echo file2 range entirely beyond EOF
-$XFS_IO_PROG -c "swapext -d $(( blksz * (nrblks + 500) )) -s 0 -l $blksz $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange -d $(( blksz * (nrblks + 500) )) -s 0 -l $blksz $dir/b" $dir/a
echo Both ranges entirely beyond EOF
-$XFS_IO_PROG -c "swapext -d $(( blksz * (nrblks + 500) )) -s $(( blksz * (nrblks + 500) )) -l $blksz $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange -d $(( blksz * (nrblks + 500) )) -s $(( blksz * (nrblks + 500) )) -l $blksz $dir/b" $dir/a
echo file1 range crossing EOF
-$XFS_IO_PROG -c "swapext -s $(( blksz * (nrblks - 1) )) -d 0 -l $((2 * blksz)) $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange -s $(( blksz * (nrblks - 1) )) -d 0 -l $((2 * blksz)) $dir/b" $dir/a
echo file2 range crossing EOF
-$XFS_IO_PROG -c "swapext -d $(( blksz * (nrblks - 1) )) -s 0 -l $((2 * blksz)) $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange -d $(( blksz * (nrblks - 1) )) -s 0 -l $((2 * blksz)) $dir/b" $dir/a
echo Both ranges crossing EOF
-$XFS_IO_PROG -c "swapext -d $(( blksz * (nrblks - 1) )) -s $(( blksz * (nrblks - 1) )) -l $((blksz * 2)) $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange -d $(( blksz * (nrblks - 1) )) -s $(( blksz * (nrblks - 1) )) -l $((blksz * 2)) $dir/b" $dir/a
echo file1 unaligned EOF to file2 nowhere near EOF
_pwrite_byte 0x58 $((blksz * nrblks)) 37 $dir/a >> $seqres.full
_pwrite_byte 0x59 $((blksz * nrblks)) 37 $dir/b >> $seqres.full
-$XFS_IO_PROG -c "swapext -d 0 -s $(( blksz * nrblks )) -l 37 $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange -d 0 -s $(( blksz * nrblks )) -l 37 $dir/b" $dir/a
echo file2 unaligned EOF to file1 nowhere near EOF
-$XFS_IO_PROG -c "swapext -s 0 -d $(( blksz * nrblks )) -l 37 $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange -s 0 -d $(( blksz * nrblks )) -l 37 $dir/b" $dir/a
echo Files of unequal length
_pwrite_byte 0x58 $((blksz * nrblks)) $((blksz * 2)) $dir/a >> $seqres.full
_pwrite_byte 0x59 $((blksz * nrblks)) $blksz $dir/b >> $seqres.full
-$XFS_IO_PROG -c "swapext $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange $dir/b" $dir/a
echo Files on different filesystems
_pwrite_byte 0x58 0 $((blksz * nrblks)) $SCRATCH_MNT/c >> $seqres.full
-$XFS_IO_PROG -c "swapext $SCRATCH_MNT/c" $dir/a
+$XFS_IO_PROG -c "exchangerange $SCRATCH_MNT/c" $dir/a
echo Files on different mounts
mkdir -p $SCRATCH_MNT/xyz
mount --bind $dir $SCRATCH_MNT/xyz --bind
_pwrite_byte 0x60 0 $((blksz * (nrblks + 2))) $dir/c >> $seqres.full
-$XFS_IO_PROG -c "swapext $SCRATCH_MNT/xyz/c" $dir/a
+$XFS_IO_PROG -c "exchangerange $SCRATCH_MNT/xyz/c" $dir/a
umount $SCRATCH_MNT/xyz
echo Swapping a file with itself
-$XFS_IO_PROG -c "swapext $dir/a" $dir/a
+$XFS_IO_PROG -c "exchangerange $dir/a" $dir/a
# success, all done
status=0
diff --git a/tests/generic/717.out b/tests/generic/717.out
index 7a7ab30b59..85137bf412 100644
--- a/tests/generic/717.out
+++ b/tests/generic/717.out
@@ -1,33 +1,33 @@
QA output created by 717
Immutable files
-swapext: Operation not permitted
+exchangerange: Operation not permitted
Readonly files
-swapext: Bad file descriptor
+exchangerange: Bad file descriptor
Directories
-swapext: Is a directory
+exchangerange: Is a directory
Unaligned ranges
-swapext: Invalid argument
+exchangerange: Invalid argument
file1 range entirely beyond EOF
-swapext: Invalid argument
+exchangerange: Invalid argument
file2 range entirely beyond EOF
-swapext: Invalid argument
+exchangerange: Invalid argument
Both ranges entirely beyond EOF
-swapext: Invalid argument
+exchangerange: Invalid argument
file1 range crossing EOF
-swapext: Invalid argument
+exchangerange: Invalid argument
file2 range crossing EOF
-swapext: Invalid argument
+exchangerange: Invalid argument
Both ranges crossing EOF
-swapext: Invalid argument
+exchangerange: Invalid argument
file1 unaligned EOF to file2 nowhere near EOF
-swapext: Invalid argument
+exchangerange: Invalid argument
file2 unaligned EOF to file1 nowhere near EOF
-swapext: Invalid argument
+exchangerange: Invalid argument
Files of unequal length
-swapext: Bad address
+exchangerange: Bad address
Files on different filesystems
-swapext: Invalid cross-device link
+exchangerange: Invalid cross-device link
Files on different mounts
-swapext: Invalid cross-device link
+exchangerange: Invalid cross-device link
Swapping a file with itself
-swapext: Invalid argument
+exchangerange: Invalid argument
diff --git a/tests/generic/718 b/tests/generic/718
index 23e092df4d..ab81dbec95 100755
--- a/tests/generic/718
+++ b/tests/generic/718
@@ -4,10 +4,10 @@
#
# FS QA Test No. 718
#
-# Make sure swapext honors RLIMIT_FSIZE.
+# Make sure exchangerange honors RLIMIT_FSIZE.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -29,7 +29,7 @@ mkdir -p $dir
blksz=65536
nrblks=64
-# Create some 4M files to test swapext
+# Create some 4M files to test exchangerange
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
_pwrite_byte 0x59 0 $((blksz * nrblks)) $dir/b >> $seqres.full
sync
@@ -39,8 +39,8 @@ md5sum $dir/a $dir/b | _filter_test_dir
ulimit -f $(( (blksz * 2) / 512))
ulimit -a >> $seqres.full
-# Now try to swapext
-$XFS_IO_PROG -c "swapext $dir/b" $dir/a
+# Now try to exchangerange
+$XFS_IO_PROG -c "exchangerange $dir/b" $dir/a
md5sum $dir/a $dir/b | _filter_test_dir
# success, all done
diff --git a/tests/generic/718.out b/tests/generic/718.out
index f3f26f7c13..c96c466b7d 100644
--- a/tests/generic/718.out
+++ b/tests/generic/718.out
@@ -1,6 +1,6 @@
QA output created by 718
d712f003e9d467e063cda1baf319b928 TEST_DIR/test-718/a
901e136269b8d283d311697b7c6dc1f2 TEST_DIR/test-718/b
-swapext: Invalid argument
+exchangerange: Invalid argument
d712f003e9d467e063cda1baf319b928 TEST_DIR/test-718/a
901e136269b8d283d311697b7c6dc1f2 TEST_DIR/test-718/b
diff --git a/tests/generic/719 b/tests/generic/719
index 70d1ae5d0c..1f8da3a9fd 100755
--- a/tests/generic/719
+++ b/tests/generic/719
@@ -10,7 +10,7 @@
# caller wants a full file replacement.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
diff --git a/tests/generic/720 b/tests/generic/720
index 25253968a2..b444988841 100755
--- a/tests/generic/720
+++ b/tests/generic/720
@@ -7,7 +7,7 @@
# Stress testing with a lot of extents.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -31,18 +31,18 @@ nrblks=$((LOAD_FACTOR * 100000))
_require_fs_space $TEST_DIR $(( (2 * blksz * nrblks) / 1024 ))
-# Create some big swiss cheese files to test swapext with a lot of extents
+# Create some big swiss cheese files to test exchangerange with a lot of extents
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
$here/src/punch-alternating $dir/a
_pwrite_byte 0x59 0 $((blksz * nrblks)) $dir/b >> $seqres.full
$here/src/punch-alternating -o 1 $dir/b
filefrag -v $dir/a $dir/b >> $seqres.full
-# Now try to swapext
+# Now try to exchangerange
md5_a="$(md5sum < $dir/a)"
md5_b="$(md5sum < $dir/b)"
date >> $seqres.full
-$XFS_IO_PROG -c "swapext $dir/b" $dir/a
+$XFS_IO_PROG -c "exchangerange $dir/b" $dir/a
date >> $seqres.full
echo "md5_a=$md5_a" >> $seqres.full
diff --git a/tests/generic/721 b/tests/generic/721
index 0beb08927b..406e2b688f 100755
--- a/tests/generic/721
+++ b/tests/generic/721
@@ -8,7 +8,7 @@
# the staging file; and (b) when the staging file is created empty.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
diff --git a/tests/generic/722 b/tests/generic/722
index 3ec831e708..85afa2e0c1 100755
--- a/tests/generic/722
+++ b/tests/generic/722
@@ -4,11 +4,11 @@
#
# FS QA Test No. 722
#
-# Test swapext with the fsync flag flushes everything to disk before the call
+# Test exchangerange with the fsync flag flushes everything to disk before the call
# returns.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -43,7 +43,7 @@ od -tx1 -Ad -c $SCRATCH_MNT/a > /tmp/a0
od -tx1 -Ad -c $SCRATCH_MNT/b > /tmp/b0
echo swap >> $seqres.full
-$XFS_IO_PROG -c "exchangerange -e -f -u $SCRATCH_MNT/a" $SCRATCH_MNT/b
+$XFS_IO_PROG -c "exchangerange -f $SCRATCH_MNT/a" $SCRATCH_MNT/b
_scratch_shutdown
_scratch_cycle_mount
diff --git a/tests/generic/723 b/tests/generic/723
index 0e1de3ec1f..f1df1e53e1 100755
--- a/tests/generic/723
+++ b/tests/generic/723
@@ -4,10 +4,10 @@
#
# FS QA Test No. 723
#
-# Test swapext with the dry run flag doesn't change anything.
+# Test exchangerange with the dry run flag doesn't change anything.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -38,10 +38,10 @@ old_a=$(md5sum $SCRATCH_MNT/a | awk '{print $1}')
old_b=$(md5sum $SCRATCH_MNT/b | awk '{print $1}')
echo "md5 a: $old_a md5 b: $old_b" >> $seqres.full
-# Test swapext with the -n option, which will do all the input parameter
+# Test exchangerange with the -n option, which will do all the input parameter
# checking and return 0 without changing anything.
echo dry run swap >> $seqres.full
-$XFS_IO_PROG -c "exchangerange -n -f -u $SCRATCH_MNT/a" $SCRATCH_MNT/b
+$XFS_IO_PROG -c "exchangerange -n -f $SCRATCH_MNT/a" $SCRATCH_MNT/b
_scratch_cycle_mount
new_a=$(md5sum $SCRATCH_MNT/a | awk '{print $1}')
@@ -54,7 +54,7 @@ test $old_b = $new_b || echo "scratch file B should not have swapped"
# Do it again, but without the -n option, to prove that we can actually
# swap the file contents.
echo actual swap >> $seqres.full
-$XFS_IO_PROG -c "exchangerange -f -u $SCRATCH_MNT/a" $SCRATCH_MNT/b
+$XFS_IO_PROG -c "exchangerange -f $SCRATCH_MNT/a" $SCRATCH_MNT/b
_scratch_cycle_mount
new_a=$(md5sum $SCRATCH_MNT/a | awk '{print $1}')
diff --git a/tests/generic/724 b/tests/generic/724
index 9536705503..4cc02946dd 100755
--- a/tests/generic/724
+++ b/tests/generic/724
@@ -5,11 +5,11 @@
# FS QA Test No. 724
#
# Test scatter-gather atomic file writes. We create a temporary file, write
-# sparsely to it, then use XFS_EXCH_RANGE_FILE1_WRITTEN flag to swap
+# sparsely to it, then use XFS_EXCHRANGE_FILE1_WRITTEN flag to swap
# atomicallly only the ranges that we wrote.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -40,9 +40,9 @@ _pwrite_byte 0x57 768k 64k $SCRATCH_MNT/b >> $seqres.full
md5sum $SCRATCH_MNT/a | _filter_scratch
md5sum $SCRATCH_MNT/b | _filter_scratch
-# Test swapext. -h means skip holes in /b, and -e means operate to EOF
+# Test exchangerange. -w means skip holes in /b
echo swap | tee -a $seqres.full
-$XFS_IO_PROG -c "exchangerange -f -u -h -e $SCRATCH_MNT/b" $SCRATCH_MNT/a
+$XFS_IO_PROG -c "exchangerange -f -w $SCRATCH_MNT/b" $SCRATCH_MNT/a
_scratch_cycle_mount
md5sum $SCRATCH_MNT/a | _filter_scratch
diff --git a/tests/generic/725 b/tests/generic/725
index 3c6180fcbb..e5e2139c6e 100755
--- a/tests/generic/725
+++ b/tests/generic/725
@@ -9,7 +9,7 @@
# perform the scattered update.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
diff --git a/tests/generic/726 b/tests/generic/726
index 05d8a2372a..3b186ab6ac 100755
--- a/tests/generic/726
+++ b/tests/generic/726
@@ -8,7 +8,7 @@
# commit.
#
. ./common/preamble
-_begin_fstest auto fiexchange swapext quick
+_begin_fstest auto fiexchange quick
# Override the default cleanup function.
# _cleanup()
diff --git a/tests/generic/727 b/tests/generic/727
index 4b0d5bd372..f737d4dd39 100755
--- a/tests/generic/727
+++ b/tests/generic/727
@@ -8,7 +8,7 @@
# commit.
#
. ./common/preamble
-_begin_fstest auto fiexchange swapext quick
+_begin_fstest auto fiexchange quick
# Override the default cleanup function.
# _cleanup()
diff --git a/tests/xfs/300 b/tests/xfs/300
index bc1f0efc6a..e21ea2e320 100755
--- a/tests/xfs/300
+++ b/tests/xfs/300
@@ -4,7 +4,7 @@
#
# FS QA Test No. 300
#
-# Test xfs_fsr / swapext management of di_forkoff w/ selinux
+# Test xfs_fsr / exchangerange management of di_forkoff w/ selinux
#
. ./common/preamble
_begin_fstest auto fsr
diff --git a/tests/xfs/443 b/tests/xfs/443
index 56828decae..069d976cb8 100755
--- a/tests/xfs/443
+++ b/tests/xfs/443
@@ -29,7 +29,7 @@ _require_scratch
_require_test_program "punch-alternating"
_require_xfs_io_command "falloc"
_require_xfs_io_command "fpunch"
-_require_xfs_io_command "swapext"
+_require_xfs_io_command "exchangerange"
_require_xfs_io_command "fiemap"
_scratch_mkfs | _filter_mkfs >> $seqres.full 2> $tmp.mkfs
@@ -56,7 +56,7 @@ $here/src/punch-alternating $file2
for i in $(seq 1 2 399); do
# punch one extent from the tmpfile and swap
$XFS_IO_PROG -c "fpunch $((i * dbsize)) $dbsize" $file2
- $XFS_IO_PROG -c "swapext $file2" $file1
+ $XFS_IO_PROG -c "exchangerange $file2" $file1
# punch the same extent from the old fork (now in file2) to resync the
# extent counts and repeat
diff --git a/tests/xfs/790 b/tests/xfs/790
index 62bbd1fea6..88b79611ef 100755
--- a/tests/xfs/790
+++ b/tests/xfs/790
@@ -4,11 +4,11 @@
#
# FS QA Test No. 790
#
-# Make sure an atomic swapext actually runs to completion even if we shut
+# Make sure an atomic exchangerange actually runs to completion even if we shut
# down the filesystem midway through.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -49,9 +49,9 @@ _pwrite_byte 0x59 0 $((blksz * nrblks)) $dir/c >> $seqres.full
_pwrite_byte 0x58 0 $((blksz * nrblks)) $dir/a >> $seqres.full
sync
-# Inject a bmap error and trigger it via swapext.
+# Inject a bmap error and trigger it via exchangerange.
filesnap "before commit"
-$XFS_IO_PROG -x -c 'inject bmap_finish_one' -c "swapext $dir/b" $dir/a
+$XFS_IO_PROG -x -c 'inject bmap_finish_one' -c "exchangerange $dir/b" $dir/a
# Check the file afterwards.
_test_cycle_mount
diff --git a/tests/xfs/790.out b/tests/xfs/790.out
index 70ebb2f18f..d1321e8342 100644
--- a/tests/xfs/790.out
+++ b/tests/xfs/790.out
@@ -3,7 +3,7 @@ before commit
c7221b1494117327570a0958b0abca51 TEST_DIR/test-790/a
30cc2b6b307081e10972317013efb0f3 TEST_DIR/test-790/b
30cc2b6b307081e10972317013efb0f3 TEST_DIR/test-790/c
-swapext: Input/output error
+exchangerange: Input/output error
after commit
30cc2b6b307081e10972317013efb0f3 TEST_DIR/test-790/a
c7221b1494117327570a0958b0abca51 TEST_DIR/test-790/b
diff --git a/tests/xfs/791 b/tests/xfs/791
index b4ded88d68..37f58972c4 100755
--- a/tests/xfs/791
+++ b/tests/xfs/791
@@ -5,12 +5,12 @@
# FS QA Test No. 791
#
# Test scatter-gather atomic file writes. We create a temporary file, write
-# sparsely to it, then use XFS_EXCH_RANGE_FILE1_WRITTEN flag to swap
+# sparsely to it, then use XFS_EXCHRANGE_FILE1_WRITTEN flag to swap
# atomicallly only the ranges that we wrote. Inject an error so that we can
# test that log recovery finishes the swap.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
@@ -45,10 +45,10 @@ sync
md5sum $SCRATCH_MNT/a | _filter_scratch
md5sum $SCRATCH_MNT/b | _filter_scratch
-# Test swapext. -h means skip holes in /b, and -e means operate to EOF
+# Test exchangerange. -w means skip holes in /b
echo swap | tee -a $seqres.full
$XFS_IO_PROG -x -c 'inject bmap_finish_one' \
- -c "exchangerange -f -u -h -e $SCRATCH_MNT/b" $SCRATCH_MNT/a
+ -c "exchangerange -f -w $SCRATCH_MNT/b" $SCRATCH_MNT/a
_scratch_cycle_mount
md5sum $SCRATCH_MNT/a | _filter_scratch
diff --git a/tests/xfs/791.out b/tests/xfs/791.out
index 015b6d3c46..2153548e91 100644
--- a/tests/xfs/791.out
+++ b/tests/xfs/791.out
@@ -2,6 +2,6 @@ QA output created by 791
310f146ce52077fcd3308dcbe7632bb2 SCRATCH_MNT/a
c9fb827e2e3e579dc2a733ddad486d1d SCRATCH_MNT/b
swap
-swapext: Input/output error
+exchangerange: Input/output error
e9cbfe8489a68efaa5fcf40cf3106118 SCRATCH_MNT/a
faf8ed02a5b0638096a817abcc6c2127 SCRATCH_MNT/b
diff --git a/tests/xfs/792 b/tests/xfs/792
index fded7a5a52..1da36fb97c 100755
--- a/tests/xfs/792
+++ b/tests/xfs/792
@@ -10,7 +10,7 @@
# recovery finishes the swap.
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext
+_begin_fstest auto quick fiexchange
# Override the default cleanup function.
_cleanup()
diff --git a/tests/xfs/795 b/tests/xfs/795
index a381db320f..a4e65921a5 100755
--- a/tests/xfs/795
+++ b/tests/xfs/795
@@ -6,7 +6,7 @@
#
# Ensure that the sysadmin won't hit EDQUOT while repairing file data contents
# even if the file's quota limits have been exceeded. This tests the quota
-# reservation handling inside the swapext code used by repair.
+# reservation handling inside the exchangerange code used by repair.
#
. ./common/preamble
_begin_fstest online_repair
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
2024-06-18 0:47 ` [PATCH 01/10] misc: split swapext and exchangerange Darrick J. Wong
2024-06-18 0:47 ` [PATCH 02/10] misc: change xfs_io -c swapext to exchangerange Darrick J. Wong
@ 2024-06-18 0:47 ` Darrick J. Wong
2024-06-19 6:08 ` Christoph Hellwig
2024-06-18 0:47 ` [PATCH 04/10] generic/717: remove obsolete check Darrick J. Wong
` (6 subsequent siblings)
9 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:47 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
The exchange-range implementation is now completely separate from the
old swapext ioctl. We're deprecating the old swapext ioctl, so let's
move this test to use exchangerange.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/generic/710 | 14 +++++++-------
tests/generic/710.out | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/tests/generic/710 b/tests/generic/710
index 6c6aa08f63..c344bd898b 100755
--- a/tests/generic/710
+++ b/tests/generic/710
@@ -4,17 +4,17 @@
#
# FS QA Test No. 710
#
-# Can we use swapext to exceed the quota enforcement?
+# Can we use exchangerange to exceed the quota enforcement?
. ./common/preamble
-_begin_fstest auto quick fiexchange swapext quota
+_begin_fstest auto quick fiexchange quota
# Import common functions.
. ./common/filter
. ./common/quota
# real QA test starts here
-_require_xfs_io_command swapext
+_require_xfs_io_command exchangerange
_require_user
_require_nobody
_require_quota
@@ -35,14 +35,14 @@ chown nobody $SCRATCH_MNT/b
# Set up a quota limit
$XFS_QUOTA_PROG -x -c "limit -u bhard=70k nobody" $SCRATCH_MNT
-echo before swapext >> $seqres.full
+echo before exchangerange >> $seqres.full
$XFS_QUOTA_PROG -x -c 'report -a' $SCRATCH_MNT >> $seqres.full
stat $SCRATCH_MNT/* >> $seqres.full
-# Now try to swapext
-$XFS_IO_PROG -c "swapext $SCRATCH_MNT/b" $SCRATCH_MNT/a
+# Now try to exchangerange
+$XFS_IO_PROG -c "exchangerange $SCRATCH_MNT/b" $SCRATCH_MNT/a
-echo after swapext >> $seqres.full
+echo after exchangerange >> $seqres.full
$XFS_QUOTA_PROG -x -c 'report -a' $SCRATCH_MNT >> $seqres.full
stat $SCRATCH_MNT/* >> $seqres.full
diff --git a/tests/generic/710.out b/tests/generic/710.out
index a2aa981919..fcc006c279 100644
--- a/tests/generic/710.out
+++ b/tests/generic/710.out
@@ -1,4 +1,4 @@
QA output created by 710
-swapext: Disk quota exceeded
+exchangerange: Disk quota exceeded
Comparing user usage
Comparing group usage
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 04/10] generic/717: remove obsolete check
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
` (2 preceding siblings ...)
2024-06-18 0:47 ` [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing Darrick J. Wong
@ 2024-06-18 0:47 ` Darrick J. Wong
2024-06-19 6:09 ` Christoph Hellwig
2024-06-18 0:48 ` [PATCH 05/10] ltp/{fsstress,fsx}: make the exchangerange naming consistent Darrick J. Wong
` (5 subsequent siblings)
9 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:47 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
The latest draft of the EXCHANGERANGE ioctl has dropped the flag that
enforced that the two files being operated upon were exactly the same
length as was specified in the ioctl parameters. Remove this check
since it's now defunct.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/generic/717 | 5 -----
tests/generic/717.out | 2 --
2 files changed, 7 deletions(-)
diff --git a/tests/generic/717 b/tests/generic/717
index ffabe2eaa1..7bc917e555 100755
--- a/tests/generic/717
+++ b/tests/generic/717
@@ -77,11 +77,6 @@ $XFS_IO_PROG -c "exchangerange -d 0 -s $(( blksz * nrblks )) -l 37 $dir/b" $dir/
echo file2 unaligned EOF to file1 nowhere near EOF
$XFS_IO_PROG -c "exchangerange -s 0 -d $(( blksz * nrblks )) -l 37 $dir/b" $dir/a
-echo Files of unequal length
-_pwrite_byte 0x58 $((blksz * nrblks)) $((blksz * 2)) $dir/a >> $seqres.full
-_pwrite_byte 0x59 $((blksz * nrblks)) $blksz $dir/b >> $seqres.full
-$XFS_IO_PROG -c "exchangerange $dir/b" $dir/a
-
echo Files on different filesystems
_pwrite_byte 0x58 0 $((blksz * nrblks)) $SCRATCH_MNT/c >> $seqres.full
$XFS_IO_PROG -c "exchangerange $SCRATCH_MNT/c" $dir/a
diff --git a/tests/generic/717.out b/tests/generic/717.out
index 85137bf412..e2c630d6d9 100644
--- a/tests/generic/717.out
+++ b/tests/generic/717.out
@@ -23,8 +23,6 @@ file1 unaligned EOF to file2 nowhere near EOF
exchangerange: Invalid argument
file2 unaligned EOF to file1 nowhere near EOF
exchangerange: Invalid argument
-Files of unequal length
-exchangerange: Bad address
Files on different filesystems
exchangerange: Invalid cross-device link
Files on different mounts
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 05/10] ltp/{fsstress,fsx}: make the exchangerange naming consistent
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
` (3 preceding siblings ...)
2024-06-18 0:47 ` [PATCH 04/10] generic/717: remove obsolete check Darrick J. Wong
@ 2024-06-18 0:48 ` Darrick J. Wong
2024-06-19 6:09 ` Christoph Hellwig
2024-06-18 0:48 ` [PATCH 06/10] misc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic Darrick J. Wong
` (4 subsequent siblings)
9 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:48 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
xchg_range/xchgrange -> exchangerange, since that's what the name has
become.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
ltp/fsstress.c | 24 ++++++++++++------------
ltp/fsx.c | 24 ++++++++++++------------
2 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 9d2631f7f9..70e0616521 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -143,7 +143,7 @@ typedef enum {
OP_URING_WRITE,
OP_WRITE,
OP_WRITEV,
- OP_XCHGRANGE,
+ OP_EXCHANGE_RANGE,
OP_LAST
} opty_t;
@@ -273,7 +273,7 @@ void uring_read_f(opnum_t, long);
void uring_write_f(opnum_t, long);
void write_f(opnum_t, long);
void writev_f(opnum_t, long);
-void xchgrange_f(opnum_t, long);
+void exchangerange_f(opnum_t, long);
char *xattr_flag_to_string(int);
@@ -343,7 +343,7 @@ struct opdesc ops[OP_LAST] = {
[OP_URING_WRITE] = {"uring_write", uring_write_f, 1, 1 },
[OP_WRITE] = {"write", write_f, 4, 1 },
[OP_WRITEV] = {"writev", writev_f, 4, 1 },
- [OP_XCHGRANGE] = {"xchgrange", xchgrange_f, 2, 1 },
+ [OP_EXCHANGE_RANGE]= {"exchangerange", exchangerange_f, 2, 1 },
}, *ops_end;
flist_t flist[FT_nft] = {
@@ -2604,7 +2604,7 @@ chown_f(opnum_t opno, long r)
/* exchange some arbitrary range of f1 to f2...fn. */
void
-xchgrange_f(
+exchangerange_f(
opnum_t opno,
long r)
{
@@ -2634,7 +2634,7 @@ xchgrange_f(
init_pathname(&fpath1);
if (!get_fname(FT_REGm, r, &fpath1, NULL, NULL, &v1)) {
if (v1)
- printf("%d/%lld: xchgrange read - no filename\n",
+ printf("%d/%lld: exchangerange read - no filename\n",
procid, opno);
goto out_fpath1;
}
@@ -2642,7 +2642,7 @@ xchgrange_f(
init_pathname(&fpath2);
if (!get_fname(FT_REGm, random(), &fpath2, NULL, NULL, &v2)) {
if (v2)
- printf("%d/%lld: xchgrange write - no filename\n",
+ printf("%d/%lld: exchangerange write - no filename\n",
procid, opno);
goto out_fpath2;
}
@@ -2653,7 +2653,7 @@ xchgrange_f(
check_cwd();
if (fd1 < 0) {
if (v1)
- printf("%d/%lld: xchgrange read - open %s failed %d\n",
+ printf("%d/%lld: exchangerange read - open %s failed %d\n",
procid, opno, fpath1.path, e);
goto out_fpath2;
}
@@ -2663,7 +2663,7 @@ xchgrange_f(
check_cwd();
if (fd2 < 0) {
if (v2)
- printf("%d/%lld: xchgrange write - open %s failed %d\n",
+ printf("%d/%lld: exchangerange write - open %s failed %d\n",
procid, opno, fpath2.path, e);
goto out_fd1;
}
@@ -2671,7 +2671,7 @@ xchgrange_f(
/* Get file stats */
if (fstat64(fd1, &stat1) < 0) {
if (v1)
- printf("%d/%lld: xchgrange read - fstat64 %s failed %d\n",
+ printf("%d/%lld: exchangerange read - fstat64 %s failed %d\n",
procid, opno, fpath1.path, errno);
goto out_fd2;
}
@@ -2679,7 +2679,7 @@ xchgrange_f(
if (fstat64(fd2, &stat2) < 0) {
if (v2)
- printf("%d/%lld: xchgrange write - fstat64 %s failed %d\n",
+ printf("%d/%lld: exchangerange write - fstat64 %s failed %d\n",
procid, opno, fpath2.path, errno);
goto out_fd2;
}
@@ -2688,7 +2688,7 @@ xchgrange_f(
if (stat1.st_size < (stat1.st_blksize * 2) ||
stat2.st_size < (stat2.st_blksize * 2)) {
if (v2)
- printf("%d/%lld: xchgrange - files are too small\n",
+ printf("%d/%lld: exchangerange - files are too small\n",
procid, opno);
goto out_fd2;
}
@@ -2745,7 +2745,7 @@ xchgrange_f(
goto retry;
}
if (v1 || v2) {
- printf("%d/%lld: xchgrange %s%s [%lld,%lld] -> %s%s [%lld,%lld]",
+ printf("%d/%lld: exchangerange %s%s [%lld,%lld] -> %s%s [%lld,%lld]",
procid, opno,
fpath1.path, inoinfo1, (long long)off1, (long long)len,
fpath2.path, inoinfo2, (long long)off2, (long long)len);
diff --git a/ltp/fsx.c b/ltp/fsx.c
index 777ba0de5d..6ff5e3720f 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -176,7 +176,7 @@ int check_file = 0; /* -X flag enables */
int clone_range_calls = 1; /* -J flag disables */
int dedupe_range_calls = 1; /* -B flag disables */
int copy_range_calls = 1; /* -E flag disables */
-int xchg_range_calls = 1; /* -0 flag disables */
+int exchange_range_calls = 1; /* -0 flag disables */
int integrity = 0; /* -i flag */
int fsxgoodfd = 0;
int o_direct; /* -Z */
@@ -272,7 +272,7 @@ static const char *op_names[] = {
[OP_DEDUPE_RANGE] = "dedupe_range",
[OP_COPY_RANGE] = "copy_range",
[OP_FSYNC] = "fsync",
- [OP_EXCHANGE_RANGE] = "xchg_range",
+ [OP_EXCHANGE_RANGE] = "exchange_range",
};
static const char *op_name(int operation)
@@ -1393,7 +1393,7 @@ do_insert_range(unsigned offset, unsigned length)
static __u64 swap_flags = 0;
int
-test_xchg_range(void)
+test_exchange_range(void)
{
struct xfs_exch_range fsr = {
.file1_fd = fd,
@@ -1425,7 +1425,7 @@ test_xchg_range(void)
}
void
-do_xchg_range(unsigned offset, unsigned length, unsigned dest)
+do_exchange_range(unsigned offset, unsigned length, unsigned dest)
{
struct xfs_exch_range fsr = {
.file1_fd = fd,
@@ -1473,7 +1473,7 @@ do_xchg_range(unsigned offset, unsigned length, unsigned dest)
if (ioctl(fd, XFS_IOC_EXCHANGE_RANGE, &fsr) == -1) {
prt("exchange range: 0x%x to 0x%x at 0x%x\n", offset,
offset + length, dest);
- prterr("do_xchg_range: XFS_IOC_EXCHANGE_RANGE");
+ prterr("do_exchange_range: XFS_IOC_EXCHANGE_RANGE");
report_failure(161);
goto out_free;
}
@@ -1487,13 +1487,13 @@ do_xchg_range(unsigned offset, unsigned length, unsigned dest)
#else
int
-test_xchg_range(void)
+test_exchange_range(void)
{
return 0;
}
void
-do_xchg_range(unsigned offset, unsigned length, unsigned dest)
+do_exchange_range(unsigned offset, unsigned length, unsigned dest)
{
return;
}
@@ -2231,7 +2231,7 @@ test(void)
}
break;
case OP_EXCHANGE_RANGE:
- if (!xchg_range_calls) {
+ if (!exchange_range_calls) {
log5(op, offset, size, offset2, FL_SKIPPED);
goto out;
}
@@ -2330,7 +2330,7 @@ test(void)
goto out;
}
- do_xchg_range(offset, size, offset2);
+ do_exchange_range(offset, size, offset2);
break;
case OP_CLONE_RANGE:
if (size == 0) {
@@ -2936,7 +2936,7 @@ main(int argc, char **argv)
insert_range_calls = 0;
break;
case '0':
- xchg_range_calls = 0;
+ exchange_range_calls = 0;
break;
case 'J':
clone_range_calls = 0;
@@ -3199,8 +3199,8 @@ main(int argc, char **argv)
dedupe_range_calls = test_dedupe_range();
if (copy_range_calls)
copy_range_calls = test_copy_range();
- if (xchg_range_calls)
- xchg_range_calls = test_xchg_range();
+ if (exchange_range_calls)
+ exchange_range_calls = test_exchange_range();
while (keep_running())
if (!test())
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 06/10] misc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
` (4 preceding siblings ...)
2024-06-18 0:48 ` [PATCH 05/10] ltp/{fsstress,fsx}: make the exchangerange naming consistent Darrick J. Wong
@ 2024-06-18 0:48 ` Darrick J. Wong
2024-06-19 6:09 ` Christoph Hellwig
2024-06-18 0:48 ` [PATCH 07/10] src/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions Darrick J. Wong
` (3 subsequent siblings)
9 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:48 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
We only need to include src/fiexchange.h if the system's xfslibs package
either doesn't define it or is so old that we want a newer definition.
Invert the logic so that we only use src/fiexchange if we need the
override.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
configure.ac | 2 +-
include/builddefs.in | 2 +-
ltp/Makefile | 4 ++--
m4/package_xfslibs.m4 | 13 +++++++------
src/Makefile | 4 ++--
src/global.h | 2 +-
src/vfs/Makefile | 4 ++--
7 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4e567d3c96..c81411e735 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,7 +70,7 @@ AC_HAVE_SEEK_DATA
AC_HAVE_BMV_OF_SHARED
AC_HAVE_NFTW
AC_HAVE_RLIMIT_NOFILE
-AC_HAVE_XFS_IOC_EXCHANGE_RANGE
+AC_NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE
AC_HAVE_FICLONE
AC_CHECK_FUNCS([renameat2])
diff --git a/include/builddefs.in b/include/builddefs.in
index ce95fe7d4b..7274cde8d0 100644
--- a/include/builddefs.in
+++ b/include/builddefs.in
@@ -72,7 +72,7 @@ HAVE_SEEK_DATA = @have_seek_data@
HAVE_NFTW = @have_nftw@
HAVE_BMV_OF_SHARED = @have_bmv_of_shared@
HAVE_RLIMIT_NOFILE = @have_rlimit_nofile@
-HAVE_XFS_IOC_EXCHANGE_RANGE = @have_xfs_ioc_exchange_range@
+NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE = @need_internal_xfs_ioc_exchange_range@
HAVE_FICLONE = @have_ficlone@
GCCFLAGS = -funsigned-char -fno-strict-aliasing -Wall
diff --git a/ltp/Makefile b/ltp/Makefile
index c0b2824076..0611c5efe9 100644
--- a/ltp/Makefile
+++ b/ltp/Makefile
@@ -36,8 +36,8 @@ ifeq ($(HAVE_COPY_FILE_RANGE),yes)
LCFLAGS += -DHAVE_COPY_FILE_RANGE
endif
-ifeq ($(HAVE_XFS_IOC_EXCHANGE_RANGE),yes)
-LCFLAGS += -DHAVE_XFS_IOC_EXCHANGE_RANGE
+ifeq ($(NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE),yes)
+LCFLAGS += -DNEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE
endif
default: depend $(TARGETS)
diff --git a/m4/package_xfslibs.m4 b/m4/package_xfslibs.m4
index 2f1dbc6951..3cc88a27d2 100644
--- a/m4/package_xfslibs.m4
+++ b/m4/package_xfslibs.m4
@@ -92,16 +92,17 @@ AC_DEFUN([AC_HAVE_BMV_OF_SHARED],
AC_SUBST(have_bmv_of_shared)
])
-# Check if we have XFS_IOC_EXCHANGE_RANGE
-AC_DEFUN([AC_HAVE_XFS_IOC_EXCHANGE_RANGE],
- [ AC_MSG_CHECKING([for XFS_IOC_EXCHANGE_RANGE])
+# Check if we need to override the system XFS_IOC_EXCHANGE_RANGE
+AC_DEFUN([AC_NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE],
+ [ AC_MSG_CHECKING([for new enough XFS_IOC_EXCHANGE_RANGE])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <xfs/xfs.h>
]], [[
struct xfs_exch_range obj;
ioctl(-1, XFS_IOC_EXCHANGE_RANGE, &obj);
- ]])],[have_xfs_ioc_exchange_range=yes
- AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
- AC_SUBST(have_xfs_ioc_exchange_range)
+ ]])],[AC_MSG_RESULT(yes)],
+ [need_internal_xfs_ioc_exchange_range=yes
+ AC_MSG_RESULT(no)])
+ AC_SUBST(need_internal_xfs_ioc_exchange_range)
])
diff --git a/src/Makefile b/src/Makefile
index ab98a06f49..9979613711 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -99,8 +99,8 @@ ifeq ($(HAVE_FICLONE),yes)
TARGETS += t_reflink_read_race
endif
-ifeq ($(HAVE_XFS_IOC_EXCHANGE_RANGE),yes)
-LCFLAGS += -DHAVE_XFS_IOC_EXCHANGE_RANGE
+ifeq ($(NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE),yes)
+LCFLAGS += -DNEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE
endif
CFILES = $(TARGETS:=.c)
diff --git a/src/global.h b/src/global.h
index 4f92308d6c..157c898065 100644
--- a/src/global.h
+++ b/src/global.h
@@ -171,7 +171,7 @@
#include <sys/mman.h>
#endif
-#ifndef HAVE_XFS_IOC_EXCHANGE_RANGE
+#ifdef NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE
# include "fiexchange.h"
#endif
diff --git a/src/vfs/Makefile b/src/vfs/Makefile
index 868540f578..a9c37e92ea 100644
--- a/src/vfs/Makefile
+++ b/src/vfs/Makefile
@@ -19,8 +19,8 @@ ifeq ($(HAVE_URING), true)
LLDLIBS += -luring
endif
-ifeq ($(HAVE_XFS_IOC_EXCHANGE_RANGE),yes)
-LCFLAGS += -DHAVE_XFS_IOC_EXCHANGE_RANGE
+ifeq ($(NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE),yes)
+LCFLAGS += -DNEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE
endif
default: depend $(TARGETS)
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 07/10] src/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
` (5 preceding siblings ...)
2024-06-18 0:48 ` [PATCH 06/10] misc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic Darrick J. Wong
@ 2024-06-18 0:48 ` Darrick J. Wong
2024-06-19 6:10 ` Christoph Hellwig
2024-06-18 0:48 ` [PATCH 08/10] xfs/122: fix for exchrange conversion Darrick J. Wong
` (2 subsequent siblings)
9 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:48 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Update to use our new file content exchange ioctl definitions.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
ltp/fsstress.c | 10 +-----
ltp/fsx.c | 19 ++---------
m4/package_xfslibs.m4 | 2 +
src/fiexchange.h | 84 ++++++++++++-------------------------------------
src/global.h | 10 ++++++
src/xfsfind.c | 1 -
tests/generic/724 | 2 +
tests/xfs/791 | 2 +
8 files changed, 37 insertions(+), 93 deletions(-)
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 70e0616521..3749da0e9a 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -2609,8 +2609,7 @@ exchangerange_f(
long r)
{
#ifdef XFS_IOC_EXCHANGE_RANGE
- struct xfs_exch_range fxr = { 0 };
- static __u64 swap_flags = 0;
+ struct xfs_exchange_range fxr = { 0 };
struct pathname fpath1;
struct pathname fpath2;
struct stat64 stat1;
@@ -2734,16 +2733,9 @@ exchangerange_f(
fxr.file1_offset = off1;
fxr.length = len;
fxr.file2_offset = off2;
- fxr.flags = swap_flags;
-retry:
ret = ioctl(fd2, XFS_IOC_EXCHANGE_RANGE, &fxr);
e = ret < 0 ? errno : 0;
- if (e == EOPNOTSUPP && !(swap_flags & XFS_EXCH_RANGE_NONATOMIC)) {
- swap_flags = XFS_EXCH_RANGE_NONATOMIC;
- fxr.flags |= swap_flags;
- goto retry;
- }
if (v1 || v2) {
printf("%d/%lld: exchangerange %s%s [%lld,%lld] -> %s%s [%lld,%lld]",
procid, opno,
diff --git a/ltp/fsx.c b/ltp/fsx.c
index 6ff5e3720f..2dc59b06fc 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -1390,29 +1390,17 @@ do_insert_range(unsigned offset, unsigned length)
#endif
#ifdef XFS_IOC_EXCHANGE_RANGE
-static __u64 swap_flags = 0;
-
int
test_exchange_range(void)
{
- struct xfs_exch_range fsr = {
+ struct xfs_exchange_range fsr = {
.file1_fd = fd,
- .flags = XFS_EXCH_RANGE_DRY_RUN | swap_flags,
+ .flags = XFS_EXCHANGE_RANGE_DRY_RUN,
};
int ret, e;
-retry:
ret = ioctl(fd, XFS_IOC_EXCHANGE_RANGE, &fsr);
e = ret < 0 ? errno : 0;
- if (e == EOPNOTSUPP && !(swap_flags & XFS_EXCH_RANGE_NONATOMIC)) {
- /*
- * If the call fails with atomic mode, try again with non
- * atomic mode.
- */
- swap_flags = XFS_EXCH_RANGE_NONATOMIC;
- fsr.flags |= swap_flags;
- goto retry;
- }
if (e == EOPNOTSUPP || errno == ENOTTY) {
if (!quiet)
fprintf(stderr,
@@ -1427,12 +1415,11 @@ test_exchange_range(void)
void
do_exchange_range(unsigned offset, unsigned length, unsigned dest)
{
- struct xfs_exch_range fsr = {
+ struct xfs_exchange_range fsr = {
.file1_fd = fd,
.file1_offset = offset,
.file2_offset = dest,
.length = length,
- .flags = swap_flags,
};
void *p;
diff --git a/m4/package_xfslibs.m4 b/m4/package_xfslibs.m4
index 3cc88a27d2..5604989e34 100644
--- a/m4/package_xfslibs.m4
+++ b/m4/package_xfslibs.m4
@@ -99,7 +99,7 @@ AC_DEFUN([AC_NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE],
#define _GNU_SOURCE
#include <xfs/xfs.h>
]], [[
- struct xfs_exch_range obj;
+ struct xfs_exchange_range obj;
ioctl(-1, XFS_IOC_EXCHANGE_RANGE, &obj);
]])],[AC_MSG_RESULT(yes)],
[need_internal_xfs_ioc_exchange_range=yes
diff --git a/src/fiexchange.h b/src/fiexchange.h
index 6a3ae8964d..1f556e69dc 100644
--- a/src/fiexchange.h
+++ b/src/fiexchange.h
@@ -16,86 +16,42 @@
* called against (which we'll call file2). Filesystems must be able to
* restart and complete the operation even after the system goes down.
*/
-struct xfs_exch_range {
- __s64 file1_fd;
- __s64 file1_offset; /* file1 offset, bytes */
- __s64 file2_offset; /* file2 offset, bytes */
- __s64 length; /* bytes to exchange */
+struct xfs_exchange_range {
+ __s32 file1_fd;
+ __u32 pad; /* must be zeroes */
+ __u64 file1_offset; /* file1 offset, bytes */
+ __u64 file2_offset; /* file2 offset, bytes */
+ __u64 length; /* bytes to exchange */
- __u64 flags; /* see XFS_EXCH_RANGE_* below */
-
- /* file2 metadata for optional freshness checks */
- __s64 file2_ino; /* inode number */
- __s64 file2_mtime; /* modification time */
- __s64 file2_ctime; /* change time */
- __s32 file2_mtime_nsec; /* mod time, nsec */
- __s32 file2_ctime_nsec; /* change time, nsec */
-
- __u64 pad[6]; /* must be zeroes */
+ __u64 flags; /* see XFS_EXCHANGE_RANGE_* below */
};
-/*
- * Atomic exchange operations are not required. This relaxes the requirement
- * that the filesystem must be able to complete the operation after a crash.
- */
-#define XFS_EXCH_RANGE_NONATOMIC (1 << 0)
-
-/*
- * Check that file2's inode number, mtime, and ctime against the values
- * provided, and return -EBUSY if there isn't an exact match.
- */
-#define XFS_EXCH_RANGE_FILE2_FRESH (1 << 1)
-
-/*
- * Check that the file1's length is equal to file1_offset + length, and that
- * file2's length is equal to file2_offset + length. Returns -EDOM if there
- * isn't an exact match.
- */
-#define XFS_EXCH_RANGE_FULL_FILES (1 << 2)
-
/*
* Exchange file data all the way to the ends of both files, and then exchange
* the file sizes. This flag can be used to replace a file's contents with a
* different amount of data. length will be ignored.
*/
-#define XFS_EXCH_RANGE_TO_EOF (1 << 3)
+#define XFS_EXCHANGE_RANGE_TO_EOF (1ULL << 0)
/* Flush all changes in file data and file metadata to disk before returning. */
-#define XFS_EXCH_RANGE_FSYNC (1 << 4)
+#define XFS_EXCHANGE_RANGE_DSYNC (1ULL << 1)
/* Dry run; do all the parameter verification but do not change anything. */
-#define XFS_EXCH_RANGE_DRY_RUN (1 << 5)
+#define XFS_EXCHANGE_RANGE_DRY_RUN (1ULL << 2)
/*
- * Only exchange ranges where file1's range maps to a written extent. This can
- * be used to emulate scatter-gather atomic writes with a temp file.
+ * Exchange only the parts of the two files where the file allocation units
+ * mapped to file1's range have been written to. This can accelerate
+ * scatter-gather atomic writes with a temp file if all writes are aligned to
+ * the file allocation unit.
*/
-#define XFS_EXCH_RANGE_FILE1_WRITTEN (1 << 6)
+#define XFS_EXCHANGE_RANGE_FILE1_WRITTEN (1ULL << 3)
-/*
- * Commit the contents of file1 into file2 if file2 has the same inode number,
- * mtime, and ctime as the arguments provided to the call. The old contents of
- * file2 will be moved to file1.
- *
- * With this flag, all committed information can be retrieved even if the
- * system crashes or is rebooted. This includes writing through or flushing a
- * disk cache if present. The call blocks until the device reports that the
- * commit is complete.
- *
- * This flag should not be combined with NONATOMIC. It can be combined with
- * FILE1_WRITTEN.
- */
-#define XFS_EXCH_RANGE_COMMIT (XFS_EXCH_RANGE_FILE2_FRESH | \
- XFS_EXCH_RANGE_FSYNC)
-
-#define XFS_EXCH_RANGE_ALL_FLAGS (XFS_EXCH_RANGE_NONATOMIC | \
- XFS_EXCH_RANGE_FILE2_FRESH | \
- XFS_EXCH_RANGE_FULL_FILES | \
- XFS_EXCH_RANGE_TO_EOF | \
- XFS_EXCH_RANGE_FSYNC | \
- XFS_EXCH_RANGE_DRY_RUN | \
- XFS_EXCH_RANGE_FILE1_WRITTEN)
+#define XFS_EXCHANGE_RANGE_ALL_FLAGS (XFS_EXCHANGE_RANGE_TO_EOF | \
+ XFS_EXCHANGE_RANGE_DSYNC | \
+ XFS_EXCHANGE_RANGE_DRY_RUN | \
+ XFS_EXCHANGE_RANGE_FILE1_WRITTEN)
-#define XFS_IOC_EXCHANGE_RANGE _IOWR('X', 129, struct xfs_exch_range)
+#define XFS_IOC_EXCHANGE_RANGE _IOWR('X', 129, struct xfs_exchange_range)
#endif /* _LINUX_FIEXCHANGE_H */
diff --git a/src/global.h b/src/global.h
index 157c898065..fc48d82e03 100644
--- a/src/global.h
+++ b/src/global.h
@@ -9,10 +9,20 @@
#include <config.h>
+#ifdef NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE
+/* Override struct xfs_exchange_range in xfslibs */
+# define xfs_exchange_range sys_xfs_exchange_range
+#endif
+
#ifdef HAVE_XFS_XFS_H
#include <xfs/xfs.h>
#endif
+#ifdef NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE
+# undef xfs_exchange_range
+# undef XFS_IOC_EXCHANGE_RANGE
+#endif
+
#ifdef HAVE_XFS_LIBXFS_H
#include <xfs/libxfs.h>
#endif
diff --git a/src/xfsfind.c b/src/xfsfind.c
index 6b0a93e793..c81deaf64f 100644
--- a/src/xfsfind.c
+++ b/src/xfsfind.c
@@ -10,7 +10,6 @@
#include <unistd.h>
#include <ftw.h>
#include <linux/fs.h>
-#include <xfs/xfs.h>
#include "global.h"
diff --git a/tests/generic/724 b/tests/generic/724
index 4cc02946dd..2d58ccb9d5 100755
--- a/tests/generic/724
+++ b/tests/generic/724
@@ -5,7 +5,7 @@
# FS QA Test No. 724
#
# Test scatter-gather atomic file writes. We create a temporary file, write
-# sparsely to it, then use XFS_EXCHRANGE_FILE1_WRITTEN flag to swap
+# sparsely to it, then use XFS_EXCHANGE_RANGE_FILE1_WRITTEN flag to swap
# atomicallly only the ranges that we wrote.
. ./common/preamble
diff --git a/tests/xfs/791 b/tests/xfs/791
index 37f58972c4..62d89f71bc 100755
--- a/tests/xfs/791
+++ b/tests/xfs/791
@@ -5,7 +5,7 @@
# FS QA Test No. 791
#
# Test scatter-gather atomic file writes. We create a temporary file, write
-# sparsely to it, then use XFS_EXCHRANGE_FILE1_WRITTEN flag to swap
+# sparsely to it, then use XFS_EXCHANGE_RANGE_FILE1_WRITTEN flag to swap
# atomicallly only the ranges that we wrote. Inject an error so that we can
# test that log recovery finishes the swap.
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 08/10] xfs/122: fix for exchrange conversion
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
` (6 preceding siblings ...)
2024-06-18 0:48 ` [PATCH 07/10] src/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions Darrick J. Wong
@ 2024-06-18 0:48 ` Darrick J. Wong
2024-06-19 6:10 ` Christoph Hellwig
2024-06-18 0:49 ` [PATCH 09/10] xfs/206: screen out exchange-range from golden output Darrick J. Wong
2024-06-18 0:49 ` [PATCH 10/10] swapext: make sure that we don't swap unwritten extents unless they're part of a rt extent(??) Darrick J. Wong
9 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:48 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Fix this test for the swapext -> exchrange conversion.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/xfs/122.out | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/xfs/122.out b/tests/xfs/122.out
index a2b57cfb9b..86c806d4b5 100644
--- a/tests/xfs/122.out
+++ b/tests/xfs/122.out
@@ -92,7 +92,7 @@ sizeof(struct xfs_disk_dquot) = 104
sizeof(struct xfs_dqblk) = 136
sizeof(struct xfs_dsb) = 264
sizeof(struct xfs_dsymlink_hdr) = 56
-sizeof(struct xfs_exch_range) = 120
+sizeof(struct xfs_exchange_range) = 40
sizeof(struct xfs_extent_data) = 24
sizeof(struct xfs_extent_data_info) = 32
sizeof(struct xfs_fs_eofblocks) = 128
@@ -121,9 +121,9 @@ sizeof(struct xfs_rud_log_format) = 16
sizeof(struct xfs_rui_log_format) = 16
sizeof(struct xfs_scrub_metadata) = 64
sizeof(struct xfs_swap_extent) = 64
-sizeof(struct xfs_sxd_log_format) = 16
-sizeof(struct xfs_sxi_log_format) = 80
sizeof(struct xfs_unmount_log_format) = 8
+sizeof(struct xfs_xmd_log_format) = 16
+sizeof(struct xfs_xmi_log_format) = 88
sizeof(union xfs_rtword_raw) = 4
sizeof(union xfs_suminfo_raw) = 4
sizeof(xfs_agf_t) = 224
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 09/10] xfs/206: screen out exchange-range from golden output
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
` (7 preceding siblings ...)
2024-06-18 0:48 ` [PATCH 08/10] xfs/122: fix for exchrange conversion Darrick J. Wong
@ 2024-06-18 0:49 ` Darrick J. Wong
2024-06-19 6:10 ` Christoph Hellwig
2024-06-18 0:49 ` [PATCH 10/10] swapext: make sure that we don't swap unwritten extents unless they're part of a rt extent(??) Darrick J. Wong
9 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:49 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Fix this so that exchange-range doesn't trigger test failures.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/xfs/206 | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/xfs/206 b/tests/xfs/206
index cb346b6dc9..f973980eb2 100755
--- a/tests/xfs/206
+++ b/tests/xfs/206
@@ -64,6 +64,7 @@ mkfs_filter()
-e "s/\(sunit=\)\([0-9]* blks,\)/\10 blks,/" \
-e "s/, lazy-count=[0-9]//" \
-e "/.*crc=/d" \
+ -e "/exchange=/d" \
-e "/^Default configuration/d"
}
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [PATCH 10/10] swapext: make sure that we don't swap unwritten extents unless they're part of a rt extent(??)
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
` (8 preceding siblings ...)
2024-06-18 0:49 ` [PATCH 09/10] xfs/206: screen out exchange-range from golden output Darrick J. Wong
@ 2024-06-18 0:49 ` Darrick J. Wong
2024-06-19 6:11 ` Christoph Hellwig
9 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:49 UTC (permalink / raw)
To: djwong, zlang; +Cc: fstests, guan, linux-xfs
From: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/xfs/1213 | 73 ++++++++++++++++
tests/xfs/1213.out | 2
tests/xfs/1214 | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/1214.out | 2
4 files changed, 309 insertions(+)
create mode 100755 tests/xfs/1213
create mode 100644 tests/xfs/1213.out
create mode 100755 tests/xfs/1214
create mode 100644 tests/xfs/1214.out
diff --git a/tests/xfs/1213 b/tests/xfs/1213
new file mode 100755
index 0000000000..a9f7e3706e
--- /dev/null
+++ b/tests/xfs/1213
@@ -0,0 +1,73 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023-2024 Oracle. All Rights Reserved.
+#
+# FS QA Test No. 1213
+#
+# Make sure that the XFS_EXCHANGE_RANGE_FILE1_WRITTEN actually skips holes and
+# unwritten extents on the data device and the rt device when the rextsize
+# is 1 fsblock.
+#
+. ./common/preamble
+_begin_fstest auto fiexchange
+
+. ./common/filter
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs generic
+_require_xfs_io_command "falloc"
+_require_xfs_io_command exchangerange
+_require_scratch
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount
+
+# This test doesn't deal with the unwritten extents that must be created when
+# the realtime file allocation unit is larger than the fs blocksize.
+file_blksz=$(_get_file_block_size $SCRATCH_MNT)
+fs_blksz=$(_get_block_size $SCRATCH_MNT)
+test "$file_blksz" -eq "$fs_blksz" || \
+ _notrun "test requires file alloc unit ($file_blksz) == fs block size ($fs_blksz)"
+
+swap_and_check_contents() {
+ local a="$1"
+ local b="$2"
+ local tag="$3"
+
+ local a_md5_before=$(md5sum $a | awk '{print $1}')
+ local b_md5_before=$(md5sum $b | awk '{print $1}')
+
+ # Test exchangerange. -w means skip holes in /b
+ echo "swap $tag" >> $seqres.full
+ $XFS_IO_PROG -c fsync -c 'bmap -elpvvvv' $a $b >> $seqres.full
+ $XFS_IO_PROG -c "exchangerange -f -w $b" $a >> $seqres.full
+ $XFS_IO_PROG -c 'bmap -elpvvvv' $a $b >> $seqres.full
+ _scratch_cycle_mount
+
+ local a_md5_after=$(md5sum $a | awk '{print $1}')
+ local b_md5_after=$(md5sum $b | awk '{print $1}')
+
+ test "$a_md5_before" != "$a_md5_after" && \
+ echo "$a: md5 $a_md5_before -> $a_md5_after in $tag"
+
+ test "$b_md5_before" != "$b_md5_after" && \
+ echo "$b: md5 $b_md5_before -> $b_md5_after in $tag"
+}
+
+# plain preallocations on the data device
+$XFS_IO_PROG -c 'extsize 0' $SCRATCH_MNT
+_pwrite_byte 0x58 0 1m $SCRATCH_MNT/dar >> $seqres.full
+$XFS_IO_PROG -f -c 'truncate 1m' -c "falloc 640k 64k" $SCRATCH_MNT/dbr
+swap_and_check_contents $SCRATCH_MNT/dar $SCRATCH_MNT/dbr "plain prealloc"
+
+# extent size hints on the data device
+$XFS_IO_PROG -c 'extsize 1m' $SCRATCH_MNT
+_pwrite_byte 0x58 0 1m $SCRATCH_MNT/dae >> $seqres.full
+$XFS_IO_PROG -f -c 'truncate 1m' -c "falloc 640k 64k" $SCRATCH_MNT/dbe
+swap_and_check_contents $SCRATCH_MNT/dae $SCRATCH_MNT/dbe "data dev extsize prealloc"
+
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/1213.out b/tests/xfs/1213.out
new file mode 100644
index 0000000000..5a28b8b45f
--- /dev/null
+++ b/tests/xfs/1213.out
@@ -0,0 +1,2 @@
+QA output created by 1213
+Silence is golden
diff --git a/tests/xfs/1214 b/tests/xfs/1214
new file mode 100755
index 0000000000..3451565445
--- /dev/null
+++ b/tests/xfs/1214
@@ -0,0 +1,232 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023-2024 Oracle. All Rights Reserved.
+#
+# FS QA Test No. 1214
+#
+# Make sure that the XFS_EXCHANGE_RANGE_FILE1_WRITTEN actually skips holes and
+# unwritten extents on the realtime device when the rextsize is larger than 1
+# fs block.
+#
+. ./common/preamble
+_begin_fstest auto fiexchange
+
+. ./common/filter
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs generic
+_require_xfs_io_command "falloc"
+_require_xfs_io_command exchangerange
+_require_realtime
+_require_scratch
+
+_scratch_mkfs >> $seqres.full
+_scratch_mount
+
+# This test only deals with the unwritten extents that must be created when
+# the realtime file allocation unit is larger than the fs blocksize.
+file_blksz=$(_get_file_block_size $SCRATCH_MNT)
+fs_blksz=$(_get_block_size $SCRATCH_MNT)
+test "$file_blksz" -ge "$((3 * fs_blksz))" || \
+ _notrun "test requires file alloc unit ($file_blksz) >= 3 * fs block size ($fs_blksz)"
+
+swap_and_check_contents() {
+ local a="$1"
+ local b="$2"
+ local tag="$3"
+
+ sync
+
+ # Test exchangerange. -w means skip holes in /b
+ echo "swap $tag" >> $seqres.full
+ $XFS_IO_PROG -c 'bmap -elpvvvv' $a $b >> $seqres.full
+ $XFS_IO_PROG -c "exchangerange -f -w $b" $a >> $seqres.full
+ $XFS_IO_PROG -c 'bmap -elpvvvv' $a $b >> $seqres.full
+
+ local a_md5_before=$(md5sum $a | awk '{print $1}')
+ local b_md5_before=$(md5sum $b | awk '{print $1}')
+
+ _scratch_cycle_mount
+
+ local a_md5_check=$(md5sum $a.chk | awk '{print $1}')
+ local b_md5_check=$(md5sum $b.chk | awk '{print $1}')
+
+ local a_md5_after=$(md5sum $a | awk '{print $1}')
+ local b_md5_after=$(md5sum $b | awk '{print $1}')
+
+ test "$a_md5_before" != "$a_md5_after" && \
+ echo "$a: md5 $a_md5_before -> $a_md5_after in $tag"
+
+ test "$b_md5_before" != "$b_md5_after" && \
+ echo "$b: md5 $b_md5_before -> $b_md5_after in $tag"
+
+ if [ "$a_md5_check" != "$a_md5_after" ]; then
+ echo "$a: md5 $a_md5_after, expected $a_md5_check in $tag" | tee -a $seqres.full
+ echo "$a contents" >> $seqres.full
+ od -tx1 -Ad -c $a >> $seqres.full
+ echo "$a.chk contents" >> $seqres.full
+ od -tx1 -Ad -c $a.chk >> $seqres.full
+ fi
+
+ if [ "$b_md5_check" != "$b_md5_after" ]; then
+ echo "$b: md5 $b_md5_after, expected $b_md5_check in $tag" | tee -a $seqres.full
+ echo "$b contents" >> $seqres.full
+ od -tx1 -Ad -c $b >> $seqres.full
+ echo "$b.chk contents" >> $seqres.full
+ od -tx1 -Ad -c $b.chk >> $seqres.full
+ fi
+}
+
+filesz=$((5 * file_blksz))
+
+# first rtblock of the second rtextent is unwritten
+rm -f $SCRATCH_MNT/da $SCRATCH_MNT/db $SCRATCH_MNT/*.chk
+_pwrite_byte 0x58 0 $filesz $SCRATCH_MNT/da >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x59 $((file_blksz + fs_blksz)) $((file_blksz - fs_blksz))" \
+ $SCRATCH_MNT/db >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 0 $file_blksz" \
+ -c "pwrite -S 0x00 $file_blksz $fs_blksz" \
+ -c "pwrite -S 0x59 $((file_blksz + fs_blksz)) $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x58 $((file_blksz * 2)) $((filesz - (file_blksz * 2) ))" \
+ $SCRATCH_MNT/da.chk >> /dev/null
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 $file_blksz $file_blksz" \
+ $SCRATCH_MNT/db.chk >> /dev/null
+swap_and_check_contents $SCRATCH_MNT/da $SCRATCH_MNT/db \
+ "first rtb of second rtx"
+
+# second rtblock of the second rtextent is unwritten
+rm -f $SCRATCH_MNT/da $SCRATCH_MNT/db $SCRATCH_MNT/*.chk
+_pwrite_byte 0x58 0 $filesz $SCRATCH_MNT/da >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x59 $file_blksz $fs_blksz" \
+ -c "pwrite -S 0x59 $((file_blksz + (2 * fs_blksz) )) $((file_blksz - (2 * fs_blksz) ))" \
+ $SCRATCH_MNT/db >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 0 $file_blksz" \
+ -c "pwrite -S 0x59 $file_blksz $fs_blksz" \
+ -c "pwrite -S 0x00 $((file_blksz + fs_blksz)) $fs_blksz" \
+ -c "pwrite -S 0x59 $((file_blksz + (2 * fs_blksz) )) $((file_blksz - (2 * fs_blksz) ))" \
+ -c "pwrite -S 0x58 $((file_blksz * 2)) $((filesz - (file_blksz * 2) ))" \
+ $SCRATCH_MNT/da.chk >> /dev/null
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 $file_blksz $file_blksz" \
+ $SCRATCH_MNT/db.chk >> /dev/null
+swap_and_check_contents $SCRATCH_MNT/da $SCRATCH_MNT/db \
+ "second rtb of second rtx"
+
+# last rtblock of the second rtextent is unwritten
+rm -f $SCRATCH_MNT/da $SCRATCH_MNT/db $SCRATCH_MNT/*.chk
+_pwrite_byte 0x58 0 $filesz $SCRATCH_MNT/da >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x59 $file_blksz $((file_blksz - fs_blksz))" \
+ $SCRATCH_MNT/db >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 0 $file_blksz" \
+ -c "pwrite -S 0x59 $file_blksz $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x00 $(( (2 * file_blksz) - fs_blksz)) $fs_blksz" \
+ -c "pwrite -S 0x58 $((file_blksz * 2)) $((filesz - (file_blksz * 2) ))" \
+ $SCRATCH_MNT/da.chk >> /dev/null
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 $file_blksz $file_blksz" \
+ $SCRATCH_MNT/db.chk >> /dev/null
+swap_and_check_contents $SCRATCH_MNT/da $SCRATCH_MNT/db \
+ "last rtb of second rtx"
+
+# last rtb of the 2nd rtx and first rtb of the 3rd rtx is unwritten
+rm -f $SCRATCH_MNT/da $SCRATCH_MNT/db $SCRATCH_MNT/*.chk
+_pwrite_byte 0x58 0 $filesz $SCRATCH_MNT/da >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "falloc $file_blksz $((2 * file_blksz))" \
+ -c "pwrite -S 0x59 $file_blksz $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x59 $(( (2 * file_blksz) + fs_blksz)) $((file_blksz - fs_blksz))" \
+ $SCRATCH_MNT/db >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 0 $file_blksz" \
+ -c "pwrite -S 0x59 $file_blksz $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x00 $(( (2 * file_blksz) - fs_blksz)) $((2 * fs_blksz))" \
+ -c "pwrite -S 0x59 $(( (2 * file_blksz) + fs_blksz)) $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x58 $((file_blksz * 3)) $((filesz - (file_blksz * 3) ))" \
+ $SCRATCH_MNT/da.chk >> /dev/null
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 $file_blksz $((2 * file_blksz))" \
+ $SCRATCH_MNT/db.chk >> /dev/null
+swap_and_check_contents $SCRATCH_MNT/da $SCRATCH_MNT/db \
+ "last rtb of 2nd rtx and first rtb of 3rd rtx"
+
+# last rtb of the 2nd rtx and first rtb of the 4th rtx is unwritten; 3rd rtx
+# is a hole
+rm -f $SCRATCH_MNT/da $SCRATCH_MNT/db $SCRATCH_MNT/*.chk
+_pwrite_byte 0x58 0 $filesz $SCRATCH_MNT/da >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x59 $file_blksz $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x59 $(( (3 * file_blksz) + fs_blksz)) $((file_blksz - fs_blksz))" \
+ -c "fpunch $((2 * file_blksz)) $file_blksz" \
+ $SCRATCH_MNT/db >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 0 $file_blksz" \
+ -c "pwrite -S 0x59 $file_blksz $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x00 $(( (2 * file_blksz) - fs_blksz)) $fs_blksz" \
+ -c "pwrite -S 0x58 $((file_blksz * 2)) $file_blksz" \
+ -c "pwrite -S 0x00 $((3 * file_blksz)) $fs_blksz" \
+ -c "pwrite -S 0x59 $(( (3 * file_blksz) + fs_blksz)) $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x58 $((file_blksz * 4)) $((filesz - (file_blksz * 4) ))" \
+ $SCRATCH_MNT/da.chk >> /dev/null
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 $file_blksz $file_blksz" \
+ -c "pwrite -S 0x58 $((file_blksz * 3)) $file_blksz" \
+ $SCRATCH_MNT/db.chk >> /dev/null
+swap_and_check_contents $SCRATCH_MNT/da $SCRATCH_MNT/db \
+ "last rtb of 2nd rtx and first rtb of 4th rtx; 3rd rtx is hole"
+
+# last rtb of the 2nd rtx and first rtb of the 4th rtx is unwritten; 3rd rtx
+# is preallocated
+rm -f $SCRATCH_MNT/da $SCRATCH_MNT/db $SCRATCH_MNT/*.chk
+_pwrite_byte 0x58 0 $filesz $SCRATCH_MNT/da >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "falloc $file_blksz $((file_blksz * 3))" \
+ -c "pwrite -S 0x59 $file_blksz $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x59 $(( (3 * file_blksz) + fs_blksz)) $((file_blksz - fs_blksz))" \
+ $SCRATCH_MNT/db >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 0 $file_blksz" \
+ -c "pwrite -S 0x59 $file_blksz $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x00 $(( (2 * file_blksz) - fs_blksz)) $fs_blksz" \
+ -c "pwrite -S 0x58 $((file_blksz * 2)) $file_blksz" \
+ -c "pwrite -S 0x00 $((3 * file_blksz)) $fs_blksz" \
+ -c "pwrite -S 0x59 $(( (3 * file_blksz) + fs_blksz)) $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x58 $((file_blksz * 4)) $((filesz - (file_blksz * 4) ))" \
+ $SCRATCH_MNT/da.chk >> /dev/null
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 $file_blksz $file_blksz" \
+ -c "pwrite -S 0x58 $((file_blksz * 3)) $file_blksz" \
+ $SCRATCH_MNT/db.chk >> /dev/null
+swap_and_check_contents $SCRATCH_MNT/da $SCRATCH_MNT/db \
+ "last rtb of 2nd rtx and first rtb of 4th rtx; 3rd rtx is prealloc"
+
+# 2nd rtx is preallocated and first rtb of 3rd rtx is unwritten
+rm -f $SCRATCH_MNT/da $SCRATCH_MNT/db $SCRATCH_MNT/*.chk
+_pwrite_byte 0x58 0 $filesz $SCRATCH_MNT/da >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "falloc $file_blksz $((file_blksz * 2))" \
+ -c "pwrite -S 0x59 $(( (2 * file_blksz) + fs_blksz)) $((file_blksz - fs_blksz))" \
+ $SCRATCH_MNT/db >> $seqres.full
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 0 $((2 * file_blksz))" \
+ -c "pwrite -S 0x00 $((2 * file_blksz)) $fs_blksz" \
+ -c "pwrite -S 0x59 $(( (2 * file_blksz) + fs_blksz)) $((file_blksz - fs_blksz))" \
+ -c "pwrite -S 0x58 $((file_blksz * 3)) $((filesz - (file_blksz * 3) ))" \
+ $SCRATCH_MNT/da.chk >> /dev/null
+$XFS_IO_PROG -f -c "truncate $filesz" \
+ -c "pwrite -S 0x58 $((2 * file_blksz)) $file_blksz" \
+ $SCRATCH_MNT/db.chk >> /dev/null
+swap_and_check_contents $SCRATCH_MNT/da $SCRATCH_MNT/db \
+ "2nd rtx is prealloc and first rtb of 3rd rtx is unwritten"
+
+echo Silence is golden
+status=0
+exit
diff --git a/tests/xfs/1214.out b/tests/xfs/1214.out
new file mode 100644
index 0000000000..a529e42333
--- /dev/null
+++ b/tests/xfs/1214.out
@@ -0,0 +1,2 @@
+QA output created by 1214
+Silence is golden
^ permalink raw reply related [flat|nested] 29+ messages in thread
* Re: [PATCH 01/10] misc: split swapext and exchangerange
2024-06-18 0:47 ` [PATCH 01/10] misc: split swapext and exchangerange Darrick J. Wong
@ 2024-06-19 6:06 ` Christoph Hellwig
0 siblings, 0 replies; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:06 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, guan, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 02/10] misc: change xfs_io -c swapext to exchangerange
2024-06-18 0:47 ` [PATCH 02/10] misc: change xfs_io -c swapext to exchangerange Darrick J. Wong
@ 2024-06-19 6:07 ` Christoph Hellwig
0 siblings, 0 replies; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:07 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, guan, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing
2024-06-18 0:47 ` [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing Darrick J. Wong
@ 2024-06-19 6:08 ` Christoph Hellwig
2024-06-19 17:23 ` Darrick J. Wong
0 siblings, 1 reply; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:08 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, guan, linux-xfs
On Mon, Jun 17, 2024 at 05:47:32PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> The exchange-range implementation is now completely separate from the
> old swapext ioctl. We're deprecating the old swapext ioctl, so let's
> move this test to use exchangerange.
Do we really want to lost the swapext test coverage? Even if it is
deprecated, it will be with us for a long time. My vote for copy and
pasting this into a new test for exchrange.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 04/10] generic/717: remove obsolete check
2024-06-18 0:47 ` [PATCH 04/10] generic/717: remove obsolete check Darrick J. Wong
@ 2024-06-19 6:09 ` Christoph Hellwig
2024-06-19 16:31 ` Darrick J. Wong
0 siblings, 1 reply; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:09 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, guan, linux-xfs
On Mon, Jun 17, 2024 at 05:47:48PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> The latest draft of the EXCHANGERANGE ioctl has dropped the flag that
> enforced that the two files being operated upon were exactly the same
> length as was specified in the ioctl parameters. Remove this check
> since it's now defunct.
The last draft is what got merged into 6.10-rc as far as I can tell,
so maybe update the commit message for that?
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 05/10] ltp/{fsstress,fsx}: make the exchangerange naming consistent
2024-06-18 0:48 ` [PATCH 05/10] ltp/{fsstress,fsx}: make the exchangerange naming consistent Darrick J. Wong
@ 2024-06-19 6:09 ` Christoph Hellwig
0 siblings, 0 replies; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:09 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, guan, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 06/10] misc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic
2024-06-18 0:48 ` [PATCH 06/10] misc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic Darrick J. Wong
@ 2024-06-19 6:09 ` Christoph Hellwig
0 siblings, 0 replies; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:09 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, guan, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 07/10] src/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions
2024-06-18 0:48 ` [PATCH 07/10] src/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions Darrick J. Wong
@ 2024-06-19 6:10 ` Christoph Hellwig
0 siblings, 0 replies; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:10 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, guan, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 08/10] xfs/122: fix for exchrange conversion
2024-06-18 0:48 ` [PATCH 08/10] xfs/122: fix for exchrange conversion Darrick J. Wong
@ 2024-06-19 6:10 ` Christoph Hellwig
0 siblings, 0 replies; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:10 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, guan, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 09/10] xfs/206: screen out exchange-range from golden output
2024-06-18 0:49 ` [PATCH 09/10] xfs/206: screen out exchange-range from golden output Darrick J. Wong
@ 2024-06-19 6:10 ` Christoph Hellwig
0 siblings, 0 replies; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:10 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, guan, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 10/10] swapext: make sure that we don't swap unwritten extents unless they're part of a rt extent(??)
2024-06-18 0:49 ` [PATCH 10/10] swapext: make sure that we don't swap unwritten extents unless they're part of a rt extent(??) Darrick J. Wong
@ 2024-06-19 6:11 ` Christoph Hellwig
2024-06-19 16:58 ` Darrick J. Wong
0 siblings, 1 reply; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:11 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, fstests, guan, linux-xfs
On Mon, Jun 17, 2024 at 05:49:21PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Can you add a commit message explaining what this test does and why
you wrote it?
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 04/10] generic/717: remove obsolete check
2024-06-19 6:09 ` Christoph Hellwig
@ 2024-06-19 16:31 ` Darrick J. Wong
2024-06-20 18:58 ` Zorro Lang
0 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-19 16:31 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: zlang, fstests, guan, linux-xfs
On Tue, Jun 18, 2024 at 11:09:22PM -0700, Christoph Hellwig wrote:
> On Mon, Jun 17, 2024 at 05:47:48PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > The latest draft of the EXCHANGERANGE ioctl has dropped the flag that
> > enforced that the two files being operated upon were exactly the same
> > length as was specified in the ioctl parameters. Remove this check
> > since it's now defunct.
>
> The last draft is what got merged into 6.10-rc as far as I can tell,
> so maybe update the commit message for that?
"The final version of the EXCHANGERANGE ioctl..."
> Otherwise looks good:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
Thanks!
--D
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 10/10] swapext: make sure that we don't swap unwritten extents unless they're part of a rt extent(??)
2024-06-19 6:11 ` Christoph Hellwig
@ 2024-06-19 16:58 ` Darrick J. Wong
2024-06-20 4:24 ` Christoph Hellwig
0 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-19 16:58 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: zlang, fstests, guan, linux-xfs
On Tue, Jun 18, 2024 at 11:11:26PM -0700, Christoph Hellwig wrote:
> On Mon, Jun 17, 2024 at 05:49:21PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
>
> Can you add a commit message explaining what this test does and why
> you wrote it?
Whoops, another one escaped:
exchangerange: make sure that we don't swap unwritten extents unless they're part of a rt extent
By default, the FILE1_WRITTEN flag for the EXCHANGERANGE ioctl isn't
supposed to touch anything except for written extents. In other words,
it shouldn't exchange delalloc reservations, unwritten preallocations,
or holes. The XFS implementation flushes dirty pagecache to disk so
there should never be delalloc reservations running through the
exchangerange machinery, but there can be unwritten extents.
Hence, write a test to make sure that unwritten extents don't get moved
around. This test opts itself out for realtime filesystems where the
allocation unit is larger than 1 fsblock because xfs has to move full
allocation units, and that requires exchanging of partially written rt
extents.
--D
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing
2024-06-19 6:08 ` Christoph Hellwig
@ 2024-06-19 17:23 ` Darrick J. Wong
2024-06-20 16:55 ` Darrick J. Wong
0 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-19 17:23 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: zlang, fstests, guan, linux-xfs
On Tue, Jun 18, 2024 at 11:08:37PM -0700, Christoph Hellwig wrote:
> On Mon, Jun 17, 2024 at 05:47:32PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > The exchange-range implementation is now completely separate from the
> > old swapext ioctl. We're deprecating the old swapext ioctl, so let's
> > move this test to use exchangerange.
>
> Do we really want to lost the swapext test coverage? Even if it is
> deprecated, it will be with us for a long time. My vote for copy and
> pasting this into a new test for exchrange.
Yeah, you're right that we should retain this test for the old swapext
ioctl. I'll fork the test into two -- one for swapext, another for
exchangerange.
--D
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 10/10] swapext: make sure that we don't swap unwritten extents unless they're part of a rt extent(??)
2024-06-19 16:58 ` Darrick J. Wong
@ 2024-06-20 4:24 ` Christoph Hellwig
0 siblings, 0 replies; 29+ messages in thread
From: Christoph Hellwig @ 2024-06-20 4:24 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, zlang, fstests, guan, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing
2024-06-19 17:23 ` Darrick J. Wong
@ 2024-06-20 16:55 ` Darrick J. Wong
2024-06-20 19:06 ` Zorro Lang
0 siblings, 1 reply; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-20 16:55 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: zlang, fstests, guan, linux-xfs
On Wed, Jun 19, 2024 at 10:23:18AM -0700, Darrick J. Wong wrote:
> On Tue, Jun 18, 2024 at 11:08:37PM -0700, Christoph Hellwig wrote:
> > On Mon, Jun 17, 2024 at 05:47:32PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > >
> > > The exchange-range implementation is now completely separate from the
> > > old swapext ioctl. We're deprecating the old swapext ioctl, so let's
> > > move this test to use exchangerange.
> >
> > Do we really want to lost the swapext test coverage? Even if it is
> > deprecated, it will be with us for a long time. My vote for copy and
> > pasting this into a new test for exchrange.
>
> Yeah, you're right that we should retain this test for the old swapext
> ioctl. I'll fork the test into two -- one for swapext, another for
> exchangerange.
...except that the swapext ioctl doesn't support swapping forks if quota
is enabled and any of the user/group/project ids are different:
/* User/group/project quota ids must match if quotas are enforced. */
if (XFS_IS_QUOTA_ON(ip->i_mount) &&
(!uid_eq(VFS_I(ip)->i_uid, VFS_I(tip)->i_uid) ||
!gid_eq(VFS_I(ip)->i_gid, VFS_I(tip)->i_gid) ||
ip->i_projid != tip->i_projid))
return -EINVAL;
I'll amend the commit message:
"There's no point in maintaining this test for the legacy swapext code
because it returns EINVAL if any quota is enabled and the two files have
different user/group/project ids. Originally I had forward ported the
old swapext ioctl to use commitrange as its backend, but that will be
dropped in favor of porting xfs_fsr to use commitrange directly."
--D
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 04/10] generic/717: remove obsolete check
2024-06-19 16:31 ` Darrick J. Wong
@ 2024-06-20 18:58 ` Zorro Lang
0 siblings, 0 replies; 29+ messages in thread
From: Zorro Lang @ 2024-06-20 18:58 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, fstests, guan, linux-xfs
On Wed, Jun 19, 2024 at 09:31:48AM -0700, Darrick J. Wong wrote:
> On Tue, Jun 18, 2024 at 11:09:22PM -0700, Christoph Hellwig wrote:
> > On Mon, Jun 17, 2024 at 05:47:48PM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > >
> > > The latest draft of the EXCHANGERANGE ioctl has dropped the flag that
> > > enforced that the two files being operated upon were exactly the same
> > > length as was specified in the ioctl parameters. Remove this check
> > > since it's now defunct.
> >
> > The last draft is what got merged into 6.10-rc as far as I can tell,
> > so maybe update the commit message for that?
>
> "The final version of the EXCHANGERANGE ioctl..."
Will change "The latest draft" to "The final version" when I merge it.
Thanks,
Zorro
>
> > Otherwise looks good:
> >
> > Reviewed-by: Christoph Hellwig <hch@lst.de>
>
> Thanks!
>
> --D
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing
2024-06-20 16:55 ` Darrick J. Wong
@ 2024-06-20 19:06 ` Zorro Lang
2024-06-20 19:20 ` Darrick J. Wong
0 siblings, 1 reply; 29+ messages in thread
From: Zorro Lang @ 2024-06-20 19:06 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Christoph Hellwig, fstests, linux-xfs
On Thu, Jun 20, 2024 at 09:55:26AM -0700, Darrick J. Wong wrote:
> On Wed, Jun 19, 2024 at 10:23:18AM -0700, Darrick J. Wong wrote:
> > On Tue, Jun 18, 2024 at 11:08:37PM -0700, Christoph Hellwig wrote:
> > > On Mon, Jun 17, 2024 at 05:47:32PM -0700, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > >
> > > > The exchange-range implementation is now completely separate from the
> > > > old swapext ioctl. We're deprecating the old swapext ioctl, so let's
> > > > move this test to use exchangerange.
> > >
> > > Do we really want to lost the swapext test coverage? Even if it is
> > > deprecated, it will be with us for a long time. My vote for copy and
> > > pasting this into a new test for exchrange.
> >
> > Yeah, you're right that we should retain this test for the old swapext
> > ioctl. I'll fork the test into two -- one for swapext, another for
> > exchangerange.
>
> ...except that the swapext ioctl doesn't support swapping forks if quota
> is enabled and any of the user/group/project ids are different:
>
>
> /* User/group/project quota ids must match if quotas are enforced. */
> if (XFS_IS_QUOTA_ON(ip->i_mount) &&
> (!uid_eq(VFS_I(ip)->i_uid, VFS_I(tip)->i_uid) ||
> !gid_eq(VFS_I(ip)->i_gid, VFS_I(tip)->i_gid) ||
> ip->i_projid != tip->i_projid))
> return -EINVAL;
>
> I'll amend the commit message:
>
> "There's no point in maintaining this test for the legacy swapext code
> because it returns EINVAL if any quota is enabled and the two files have
> different user/group/project ids. Originally I had forward ported the
> old swapext ioctl to use commitrange as its backend, but that will be
> dropped in favor of porting xfs_fsr to use commitrange directly."
Hi Darrick,
I can help to change the patch [4/10] and [10/10] if you need. But for this
one, will you re-send this patch or the whole patchset?
Thanks,
Zorro
>
> --D
>
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing
2024-06-20 19:06 ` Zorro Lang
@ 2024-06-20 19:20 ` Darrick J. Wong
0 siblings, 0 replies; 29+ messages in thread
From: Darrick J. Wong @ 2024-06-20 19:20 UTC (permalink / raw)
To: Zorro Lang; +Cc: Christoph Hellwig, fstests, linux-xfs
On Fri, Jun 21, 2024 at 03:06:28AM +0800, Zorro Lang wrote:
> On Thu, Jun 20, 2024 at 09:55:26AM -0700, Darrick J. Wong wrote:
> > On Wed, Jun 19, 2024 at 10:23:18AM -0700, Darrick J. Wong wrote:
> > > On Tue, Jun 18, 2024 at 11:08:37PM -0700, Christoph Hellwig wrote:
> > > > On Mon, Jun 17, 2024 at 05:47:32PM -0700, Darrick J. Wong wrote:
> > > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > >
> > > > > The exchange-range implementation is now completely separate from the
> > > > > old swapext ioctl. We're deprecating the old swapext ioctl, so let's
> > > > > move this test to use exchangerange.
> > > >
> > > > Do we really want to lost the swapext test coverage? Even if it is
> > > > deprecated, it will be with us for a long time. My vote for copy and
> > > > pasting this into a new test for exchrange.
> > >
> > > Yeah, you're right that we should retain this test for the old swapext
> > > ioctl. I'll fork the test into two -- one for swapext, another for
> > > exchangerange.
> >
> > ...except that the swapext ioctl doesn't support swapping forks if quota
> > is enabled and any of the user/group/project ids are different:
> >
> >
> > /* User/group/project quota ids must match if quotas are enforced. */
> > if (XFS_IS_QUOTA_ON(ip->i_mount) &&
> > (!uid_eq(VFS_I(ip)->i_uid, VFS_I(tip)->i_uid) ||
> > !gid_eq(VFS_I(ip)->i_gid, VFS_I(tip)->i_gid) ||
> > ip->i_projid != tip->i_projid))
> > return -EINVAL;
> >
> > I'll amend the commit message:
> >
> > "There's no point in maintaining this test for the legacy swapext code
> > because it returns EINVAL if any quota is enabled and the two files have
> > different user/group/project ids. Originally I had forward ported the
> > old swapext ioctl to use commitrange as its backend, but that will be
> > dropped in favor of porting xfs_fsr to use commitrange directly."
>
> Hi Darrick,
>
> I can help to change the patch [4/10] and [10/10] if you need. But for this
> one, will you re-send this patch or the whole patchset?
I plan on resending this patchset, since I've found a couple more
swapext tests that need correcting.
--D
> Thanks,
> Zorro
>
> >
> > --D
> >
>
>
^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2024-06-20 19:20 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-18 0:46 [PATCHSET v30.6 2/6] fstests: atomic file updates Darrick J. Wong
2024-06-18 0:47 ` [PATCH 01/10] misc: split swapext and exchangerange Darrick J. Wong
2024-06-19 6:06 ` Christoph Hellwig
2024-06-18 0:47 ` [PATCH 02/10] misc: change xfs_io -c swapext to exchangerange Darrick J. Wong
2024-06-19 6:07 ` Christoph Hellwig
2024-06-18 0:47 ` [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing Darrick J. Wong
2024-06-19 6:08 ` Christoph Hellwig
2024-06-19 17:23 ` Darrick J. Wong
2024-06-20 16:55 ` Darrick J. Wong
2024-06-20 19:06 ` Zorro Lang
2024-06-20 19:20 ` Darrick J. Wong
2024-06-18 0:47 ` [PATCH 04/10] generic/717: remove obsolete check Darrick J. Wong
2024-06-19 6:09 ` Christoph Hellwig
2024-06-19 16:31 ` Darrick J. Wong
2024-06-20 18:58 ` Zorro Lang
2024-06-18 0:48 ` [PATCH 05/10] ltp/{fsstress,fsx}: make the exchangerange naming consistent Darrick J. Wong
2024-06-19 6:09 ` Christoph Hellwig
2024-06-18 0:48 ` [PATCH 06/10] misc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic Darrick J. Wong
2024-06-19 6:09 ` Christoph Hellwig
2024-06-18 0:48 ` [PATCH 07/10] src/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions Darrick J. Wong
2024-06-19 6:10 ` Christoph Hellwig
2024-06-18 0:48 ` [PATCH 08/10] xfs/122: fix for exchrange conversion Darrick J. Wong
2024-06-19 6:10 ` Christoph Hellwig
2024-06-18 0:49 ` [PATCH 09/10] xfs/206: screen out exchange-range from golden output Darrick J. Wong
2024-06-19 6:10 ` Christoph Hellwig
2024-06-18 0:49 ` [PATCH 10/10] swapext: make sure that we don't swap unwritten extents unless they're part of a rt extent(??) Darrick J. Wong
2024-06-19 6:11 ` Christoph Hellwig
2024-06-19 16:58 ` Darrick J. Wong
2024-06-20 4:24 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox