From patchwork Thu Jun 20 20:54:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706311 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8DD37350E; Thu, 20 Jun 2024 20:54:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916859; cv=none; b=q8BU/P0Hid8dYbVe7nVb6u+7cmczNnjJbVNoDqcZXhqGm9Ua7pwyQP2oa7kMNrpggIG+Cfth7Tmq5AjURi+3VZV+j+5GAfLMXu/DtPXPM6lxTHVA5CpiL49TS2472RennMNkNBMK0z5Z6vm+dFmKP9A0Bj6NT0E6WSJs5i0wHdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916859; c=relaxed/simple; bh=r/B1duBFFhSb6RuPmkvzs99d3fVDJX/BzIvr3z5R1H0=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eeoefK+cL7K3pnoYvj56V8DUkpaRLsleTfkB4yqglY1bKtcSps3h4O4xeRLD6lRAaDIeQJwDe3Bv7YTqvBQh/Q3VzAJ8KtJl5Y+jNsCtOhyr8WE8377TKY7D24l4Hr5wWmO8rdy5sLZKz3erCc5GfHPWMNAE9Y02Wi7o379uu4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B8kUns2S; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B8kUns2S" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B509EC2BD10; Thu, 20 Jun 2024 20:54:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718916859; bh=r/B1duBFFhSb6RuPmkvzs99d3fVDJX/BzIvr3z5R1H0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=B8kUns2S/ZxrCXJYe2Q/xfx1geFCwsym3SZX9PHzDoJMSSU1VXDlwfXHLZBzndfsE KyTLI6xPgUF4WCyRpHj0b19wvHxZ3NFBk9dJcOOFcmAcW2c1RYojFM6JBL+lYNgNkg RcCZDh0qk3/POmi1vOq+lHMhRI+oVBQDmtRIXag9uHmBSu+btz/DRtdALDiBJTFBhp rPeGp1iLmSGenM0V0Hqe486bGk7tqH5ewuDOfGUA2u5kw1+yNFbJpLJu+H0uysEQhv z4o+BPz1kVp9EKppB+moxH3qyjn2+kGdj6WUTgHjXvc6V9ZXXfiutMrtcTpFOmShTr vCAcC6+RhKd6g== Date: Thu, 20 Jun 2024 13:54:19 -0700 Subject: [PATCH 01/11] misc: split swapext and exchangerange From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: Christoph Hellwig , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669128.3034840.11871397344083311487.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong These two commands (and the kernel implementations) are splitting, so we need to split the xfs_io usage. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- 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" From patchwork Thu Jun 20 20:54:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706312 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8748174E25; Thu, 20 Jun 2024 20:54:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916875; cv=none; b=sR1yF2NHZ2kLblisQ861Wk7MUS+87tU2LL/xElx/qHMedUh7S8PEE6uUJ7aX8J+wyD67Z09SLzTPnp1Y98TK9M0UEdNuZAHB+Xolb0IJI74m0o9ZVlReReCuLxkc06gu6xeyYWXqKZVDSCGsqsH+4gQahkcGkUquA6Vlf6j6flw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916875; c=relaxed/simple; bh=YCLI2eJj4dlMPbg53WbgOQZwy7vBfGEo0aDQrYdeS3A=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jTe438TJE6kpVOe8leOqS6wxeHm2tqqAwkdFpaTDW81tjAAyDMAt30Mn/uabz7ANVjWFn3/cyknKz6QvRvd6WTsx2f6cw8UnPBxPCGYDCspFGvY+uppuigTGCvFi6v7guHSbGgYdGpDLJuBXikp7u9L4/cc8EVt6FYkh6TC+IBE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DnVbbjat; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DnVbbjat" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FFE7C2BD10; Thu, 20 Jun 2024 20:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718916875; bh=YCLI2eJj4dlMPbg53WbgOQZwy7vBfGEo0aDQrYdeS3A=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=DnVbbjatmJJP1lyOARrMXV+ZziPV4CHufTNYKxj6C6p7OwJgn9B7+RJYPbA2ZFMHO d7bc3xY32lgY8ds4RopOL3/uTIDa9PKAJ/eerGDftH5t2HllZum69+xSVysfkkn2TE a0uFI583gDHgq6s9RbLPnu1YYDNgx3h7OX+e/WoVoaIp7GYnB3LiCnSenmgHzHG2X0 VKO/X20/IP4maKQnPtTJYZe4AX6Rzz4qwJSvGOqwl+rN825Jjoo1qOUplmsA2aAg20 lCzU1ksS2LbXDlp4k55ejongUcgOpA7k/rtcv8ZgSI+XY3JX4XDq76zgcOB4KqoLjh H+CBum42F0Dsw== Date: Thu, 20 Jun 2024 13:54:34 -0700 Subject: [PATCH 02/11] misc: change xfs_io -c swapext to exchangerange From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: Christoph Hellwig , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669143.3034840.15267717495079465249.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong 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 Reviewed-by: Christoph Hellwig --- 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 From patchwork Thu Jun 20 20:54:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706313 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A8AB58AA7; Thu, 20 Jun 2024 20:54:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916891; cv=none; b=qRBPHJ/tA4fCfoCYKS9u773vcV1nlJQUR7hR5bE8vKYe+YcNGOPIP4ErQlNFzDtkBEJTJilxfOr1hcxNseForvC2J58gMaDsfvSRhQQX82hkro8nwQE5pxnbISPpdHvK3H9uQONWGYngigv231MZWN/LqA7omXUvF+aip5kNNg0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916891; c=relaxed/simple; bh=rOygqbToq+vFobGhkyww7kzoiDA1swL6P0+ly6lBLB8=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ks7duMR967tCPp9VG96YGWXD9FrsrboM+BaOtSIT+ILqvUYvXIsEZgXRiaMdCsoRQBjU2jUig+RYl9wGRFd+sH/8acPBhW2ZCBo0jsLAnCSURQ1Xhh11n+YZcZHx4s2CQMCBY0iwUJADVHPQ6EXLYEobCeLpp4vemu898GTmCEI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QCJtLezg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QCJtLezg" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 093A6C2BD10; Thu, 20 Jun 2024 20:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718916891; bh=rOygqbToq+vFobGhkyww7kzoiDA1swL6P0+ly6lBLB8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=QCJtLezgXdH2/9D/9C6JCaROqNNZpW+hIZuOJV2Ljgx3pgZiniR2dl2QQRKofE4MM YRHldWiSlMgphoJbOMcrlWkfLXKP+ivmriXTbIvbN91PbsDUQHgc/3yBU7vAhVoiB4 6lcBWBPr8c19x32YhAAGZiOmY3U+1RigOC9HGcbmtJsDLjt3XDCeHMzQ5tOxWUChMQ DMBd+Y5ngiMsD/G6qpfsoBwbNKDYVsYhZHhcmE6+qYaW65rJODjSLNJqEQ/lwbzl7M NIGjztoTU/GBqCnpK5P/hlZNvBx18W+w11WAUn6BfQJUxawGOfiXVhGeSFbgncgA/s Z+0A+tofWDrZA== Date: Thu, 20 Jun 2024 13:54:50 -0700 Subject: [PATCH 03/11] generic/709,710: rework these for exchangerange vs. quota testing From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669159.3034840.3701471459033486232.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The exchange-range implementation is now completely separate from the old swapext ioctl, so let's migrate these quota tests to exchangerange. There's no point in maintaining these tests 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. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- tests/generic/709 | 12 ++++++------ tests/generic/710 | 14 +++++++------- tests/generic/710.out | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/generic/709 b/tests/generic/709 index 4fc938bb6a..f3b827cb04 100755 --- a/tests/generic/709 +++ b/tests/generic/709 @@ -4,17 +4,17 @@ # # FS QA Test No. 709 # -# Can we use swapext to make the quota accounting incorrect? +# Can we use exchangerange to make the quota accounting incorrect? . ./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 @@ -32,7 +32,7 @@ chown $qa_user $SCRATCH_MNT/a $XFS_IO_PROG -f -c 'pwrite -S 0x59 0 64k -b 64k' -c 'truncate 256k' $SCRATCH_MNT/b >> $seqres.full chown nobody $SCRATCH_MNT/b -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 @@ -40,11 +40,11 @@ stat $SCRATCH_MNT/* >> $seqres.full # fail with -EINVAL (since that's what the first kernel fix does) or succeed # (because subsequent rewrites can handle quota). Whatever the outcome, the # quota usage check at the end should never show a discrepancy. -$XFS_IO_PROG -c "swapext $SCRATCH_MNT/b" $SCRATCH_MNT/a &> $tmp.swap +$XFS_IO_PROG -c "exchangerange $SCRATCH_MNT/b" $SCRATCH_MNT/a &> $tmp.swap cat $tmp.swap >> $seqres.full grep -v 'Invalid argument' $tmp.swap -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 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 From patchwork Thu Jun 20 20:55:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706314 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F11A58AA7; Thu, 20 Jun 2024 20:55:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916907; cv=none; b=WkhzT+UBxfsWl1TdZo7uXytU3J+sm/vZ6vchMiUqB5X+dMh9660QXfbgVN5lMuOWyirXXWv3TodAYq1Bvqy+Z05Dg5Bd1wAwpqIt+iTsHBqLgtQA3pUopVVuQuhBLGBl5ZcWXtQKuPoDgEXHjZPK+Ta7oveW3i+8zHvdoHhnySM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916907; c=relaxed/simple; bh=zCUhaelCLCGQ1F7h3QSl9KJRvFCbOHs819Yt7XN3zFU=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=L5QayIueuGPElItXk+QcTNyLkEPalzlzld4zkne1N/e7j27DxKAAN02XomN0C6zIrzpxvItez58K8SiURJ9jrXxrHzBZagl97siGmZqXKbKNFguIPiabybYS9J+mLXTiDHtpLtd74s3gmsjman7BSSSFuob1OwXhuHTDzrk3WUY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h7lJYz1d; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="h7lJYz1d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E0EAC2BD10; Thu, 20 Jun 2024 20:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718916906; bh=zCUhaelCLCGQ1F7h3QSl9KJRvFCbOHs819Yt7XN3zFU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=h7lJYz1dGA/uKU9hdL+8Bab6lFL/2vnLdehGkDeF1pEpM6imiIos4qw35yWhkd3Tl o3XlcrX3wjoOayIhCzTrHo1F7J3NJTfe0xGgGcvMB9Dk2FnGyJ9WwYHF6R1Fx339qO +JAv2S2YyotkGmKjBlNl2V8c1jffG8GJ+0A2rgQR6qJ8O5ep1DUH/3A+UeIa6Gr47m VzvTmWk6h/iAUxyss2AEq4HNdBdxg3c2/+0+ejJgbg9e3nkosV5HKXnrRHdUvCiMSm PlQOgiug3+DiC49rKaHK8M2GGsCTxWvVfUMA5zYceU5Xx8pMoRR82TlOmAFuW2Fm5h hHajXMIlJdAgw== Date: Thu, 20 Jun 2024 13:55:06 -0700 Subject: [PATCH 04/11] generic/711,xfs/537: actually fork these tests for exchange-range From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669174.3034840.5584811354339983628.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Fork these tests to check the same things with exchange-range as they do for swapext, since the code porting swapext to commit-range has been dropped. I was going to fork xfs/789 as well, but it turns out that generic/714 covers this sufficiently so for that one, we just strike fiexchange from the group tag. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- tests/generic/1221 | 45 ++++++++++++++++++++++++ tests/generic/1221.out | 2 + tests/generic/711 | 2 + tests/xfs/1215 | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ tests/xfs/1215.out | 13 +++++++ tests/xfs/789 | 2 + 6 files changed, 151 insertions(+), 2 deletions(-) create mode 100755 tests/generic/1221 create mode 100644 tests/generic/1221.out create mode 100755 tests/xfs/1215 create mode 100644 tests/xfs/1215.out diff --git a/tests/generic/1221 b/tests/generic/1221 new file mode 100755 index 0000000000..5569f59734 --- /dev/null +++ b/tests/generic/1221 @@ -0,0 +1,45 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2022 Oracle. All Rights Reserved. +# +# FS QA Test No. 1221 +# +# Make sure that exchangerange won't touch a swap file. + +. ./common/preamble +_begin_fstest auto quick fiexchange + +# Override the default cleanup function. +_cleanup() +{ + cd / + test -e "$dir/a" && swapoff $dir/a + rm -r -f $tmp.* $dir +} + +# Import common functions. +. ./common/filter + +# real QA test starts here +_require_xfs_io_command exchangerange +_require_test + +dir=$TEST_DIR/test-$seq +mkdir -p $dir + +# Set up a fragmented swapfile and a dummy donor file. +$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 32m -b 1m' -c fsync $dir/a >> $seqres.full +$here/src/punch-alternating $dir/a +$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 32m -b 1m' -c fsync $dir/a >> $seqres.full +$MKSWAP_PROG $dir/a >> $seqres.full + +$XFS_IO_PROG -f -c 'pwrite -S 0x59 0 32m -b 1m' $dir/b >> $seqres.full + +swapon $dir/a || _notrun 'failed to swapon' + +# Now try to exchangerange. +$XFS_IO_PROG -c "exchangerange $dir/b" $dir/a + +# success, all done +status=0 +exit diff --git a/tests/generic/1221.out b/tests/generic/1221.out new file mode 100644 index 0000000000..698ac87303 --- /dev/null +++ b/tests/generic/1221.out @@ -0,0 +1,2 @@ +QA output created by 1221 +exchangerange: Text file busy diff --git a/tests/generic/711 b/tests/generic/711 index b107f976ef..792136306c 100755 --- a/tests/generic/711 +++ b/tests/generic/711 @@ -7,7 +7,7 @@ # Make sure that swapext won't touch a swap file. . ./common/preamble -_begin_fstest auto quick fiexchange swapext +_begin_fstest auto quick swapext # Override the default cleanup function. _cleanup() diff --git a/tests/xfs/1215 b/tests/xfs/1215 new file mode 100755 index 0000000000..5e7633c5ea --- /dev/null +++ b/tests/xfs/1215 @@ -0,0 +1,89 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Oracle. All Rights Reserved. +# +# FS QA Test No. 1215 +# +# Verify that XFS does not cause inode fork's extent count to overflow when +# exchanging ranges between files +. ./common/preamble +_begin_fstest auto quick collapse fiexchange + +# Import common functions. +. ./common/filter +. ./common/inject + +# real QA test starts here + +_supported_fs xfs +_require_scratch +_require_xfs_debug +_require_xfs_scratch_rmapbt +_require_xfs_io_command "fcollapse" +_require_xfs_io_command "exchangerange" +_require_xfs_io_error_injection "reduce_max_iextents" + +echo "* Exchange extent forks" + +echo "Format and mount fs" +_scratch_mkfs >> $seqres.full +_scratch_mount >> $seqres.full + +bsize=$(_get_file_block_size $SCRATCH_MNT) + +srcfile=${SCRATCH_MNT}/srcfile +donorfile=${SCRATCH_MNT}/donorfile + +echo "Create \$donorfile having an extent of length 67 blocks" +$XFS_IO_PROG -f -s -c "pwrite -b $((17 * bsize)) 0 $((17 * bsize))" $donorfile \ + >> $seqres.full + +# After the for loop the donor file will have the following extent layout +# | 0-4 | 5 | 6 | 7 | 8 | 9 | 10 | +echo "Fragment \$donorfile" +for i in $(seq 5 10); do + start_offset=$((i * bsize)) + $XFS_IO_PROG -f -c "fcollapse $start_offset $bsize" $donorfile >> $seqres.full +done + +echo "Create \$srcfile having an extent of length 18 blocks" +$XFS_IO_PROG -f -s -c "pwrite -b $((18 * bsize)) 0 $((18 * bsize))" $srcfile \ + >> $seqres.full + +echo "Fragment \$srcfile" +# After the for loop the src file will have the following extent layout +# | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7-10 | +for i in $(seq 1 7); do + start_offset=$((i * bsize)) + $XFS_IO_PROG -f -c "fcollapse $start_offset $bsize" $srcfile >> $seqres.full +done + +echo "Collect \$donorfile's extent count" +donor_nr_exts=$(_xfs_get_fsxattr nextents $donorfile) + +echo "Collect \$srcfile's extent count" +src_nr_exts=$(_xfs_get_fsxattr nextents $srcfile) + +echo "Inject reduce_max_iextents error tag" +_scratch_inject_error reduce_max_iextents 1 + +echo "Exchange \$srcfile's and \$donorfile's extent forks" +$XFS_IO_PROG -f -c "exchangerange $donorfile" $srcfile >> $seqres.full 2>&1 + +echo "Check for \$donorfile's extent count overflow" +nextents=$(_xfs_get_fsxattr nextents $donorfile) + +if (( $nextents == $src_nr_exts )); then + echo "\$donorfile: Extent count overflow check failed" +fi + +echo "Check for \$srcfile's extent count overflow" +nextents=$(_xfs_get_fsxattr nextents $srcfile) + +if (( $nextents == $donor_nr_exts )); then + echo "\$srcfile: Extent count overflow check failed" +fi + +# success, all done +status=0 +exit diff --git a/tests/xfs/1215.out b/tests/xfs/1215.out new file mode 100644 index 0000000000..48edd56376 --- /dev/null +++ b/tests/xfs/1215.out @@ -0,0 +1,13 @@ +QA output created by 1215 +* Exchange extent forks +Format and mount fs +Create $donorfile having an extent of length 67 blocks +Fragment $donorfile +Create $srcfile having an extent of length 18 blocks +Fragment $srcfile +Collect $donorfile's extent count +Collect $srcfile's extent count +Inject reduce_max_iextents error tag +Exchange $srcfile's and $donorfile's extent forks +Check for $donorfile's extent count overflow +Check for $srcfile's extent count overflow diff --git a/tests/xfs/789 b/tests/xfs/789 index 00b98020f2..e3a332d7cf 100755 --- a/tests/xfs/789 +++ b/tests/xfs/789 @@ -7,7 +7,7 @@ # Simple tests of the old xfs swapext ioctl . ./common/preamble -_begin_fstest auto quick fiexchange swapext +_begin_fstest auto quick swapext # Override the default cleanup function. _cleanup() From patchwork Thu Jun 20 20:55:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706315 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1D7A58AA7; Thu, 20 Jun 2024 20:55:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916922; cv=none; b=BHO7pj41If5AyicG3xyHuznzbit+phVjlB+uYntJ1ThjSrIbu8NEN2hiES8DVmOE+PrVe33TLvm+p7/hVE87zCCUfxw39p5s+gtzkYn4jxMECcLdMYXU3vTdfEamor8AC6/K2iM4SbY/lQPqNpjlKjkx3oLVT2V+fwgxoRO9tRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916922; c=relaxed/simple; bh=NuDg+uNB45SMQOjJb0Ggs+biP0t1Q403Zcw4v3eRa3E=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V9yITzIyrHK2SyPruwjKBUx8V7bjH8o+lzNXIoWVEBee/38tPrXVXLJmvPAXdBhBhDZoYnR9dwA42igQhXF/h1coTyG5sajsOag0lBVlLrQEe/+OoMpEXYGNQf2hCFEUxNtHUdRIJ/ZS0PXpmpM5lEHmwtulxL6f/6Gl4Ny6/SE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lT8JBc5R; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lT8JBc5R" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44C44C2BD10; Thu, 20 Jun 2024 20:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718916922; bh=NuDg+uNB45SMQOjJb0Ggs+biP0t1Q403Zcw4v3eRa3E=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=lT8JBc5R/bH+X1rK9jerZrWs56BPQDANGKo26QMatSbqHREFjnVGGlQBDm8vaZl/Z OX8BwkgflAkuv65yB+Ja/FRpdnIgQrzzIf4bFnzFXY0IoKwJZgFEFafnQ1xUbUviUD ohXM1cyEPgYSzBo13u+EIBSHUkAP8e6aJ3ASPWROKSvVE0zBRIOHljb990ILv848Hb 0lZRkDlPES6W00i5gK2YWqkJSP93qaJL2POD24MHbMbGck+ckqhK2M7nG7pq6F5Yx+ BbSbpKyzZGRXul5aH7RYOrb36PVb444nybQrOJ9vUQLAZfavjMTQQ1vETAV31JcN1r qFcaulGEcqiEw== Date: Thu, 20 Jun 2024 13:55:21 -0700 Subject: [PATCH 05/11] generic/717: remove obsolete check From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: Christoph Hellwig , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669189.3034840.13099936847804900490.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The final version 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 Reviewed-by: Christoph Hellwig --- 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 From patchwork Thu Jun 20 20:55:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706316 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 199772BAF3; Thu, 20 Jun 2024 20:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916938; cv=none; b=hNpvdR0QqNsO7ej+xfjlL7FaEvTyBFJ4SO2zNa7yPm32aEoQW71/FTV2kFznkE9P66d6vTHbrxUt7zENWQMVZCfPzSujcYqCkUrq3dyAr9WQVjyg8zMjkJ3q6K/vFkDiOhXk0TUtMqF8LkJY/gyaZG8RBue+x45C6K/hS3qVlow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916938; c=relaxed/simple; bh=vKAKE6I1hbafZWd8FRpT3SI0azoqr0JyJnT7VcL4x/s=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UbiCovlYbJPD+UPLBEkKabvE769v9u22dR2T72ZD2spk2G3PMJEfQQatjq2dlvBuUnuoyw+gLcB3FALMWZJsz9MJmq5yGN+XI1EX1JXg0vRTH6NqZzP6rs8FLz/2k9Q2cBGy3E1HltOK9Xu0+KxBYfla+N8c8JQP8BeHjKAFYPg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SMek0EZL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SMek0EZL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E738AC2BD10; Thu, 20 Jun 2024 20:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718916938; bh=vKAKE6I1hbafZWd8FRpT3SI0azoqr0JyJnT7VcL4x/s=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=SMek0EZLaD3Y5VDibfuBMHuZfvi68CNSnAPXrcUFig7Xgzya5thHq1TmkvI1P0YcD dtF9AbxXiGkvy011ZWHZKqiqRDNaD8erFPaBMcm7/bVQVH/M8hcVovFq6Z9bGi6Oq3 cBzcD7YYHFOyvqojphXN9+Xh5aeqUPtLNYwqV+2nqju6undxvv90hsTO4gCHAY5+hg alpOgjRTKHAS9ar4XHoJynpzYHQSdTz8V8Ocl9bdU+fGC95xHapzV0LEMSn95DqFno sTm3mGdBi400VnbbesdpAjzw1av6EOv2aAz5gGEyMEVOV/V/r2Du2remI4sk3RfexU L41vEOGWwbKvQ== Date: Thu, 20 Jun 2024 13:55:37 -0700 Subject: [PATCH 06/11] ltp/{fsstress,fsx}: make the exchangerange naming consistent From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: Christoph Hellwig , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669204.3034840.12862965793300424312.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong xchg_range/xchgrange -> exchangerange, since that's what the name has become. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- 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()) From patchwork Thu Jun 20 20:55:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706317 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20F827581B; Thu, 20 Jun 2024 20:55:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916954; cv=none; b=mL+2SKfn/fe5VyokR2Nch4DwlbNsVEEsL1BuqXCFgaMYoN7DY6XG0hyKh3E7jOURgdyovEgyKIGUFE0tG/oaneAsaURILIaqeeLvi9Zn570bbwD5W6aztPYcJTtUw04HEKmJyn7g0XV29fMT34+Dflv1whc0J5+MTcsZ8Ae8wCM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916954; c=relaxed/simple; bh=1lvfiz4XL7xSSasLSonV6ApBUMT0iIBGWr1uPqzutlU=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WTGAtCSOyE8T9F21NJtQIrgVigiuWpK8Rz/xzVRwS9QSHL80Jky6xDPnWlacRbPJLpem3N8bN5t9sCfurtqrk8fSjNs9eZ2LpcNdg+88BN1GODo5kI2qN4kCUTNYlj1xaukN6SR9NHeploQt+CMb9pNP2yQQ9wCC8urCOr3sxdk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oVaQCrwZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="oVaQCrwZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D2B7C2BD10; Thu, 20 Jun 2024 20:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718916953; bh=1lvfiz4XL7xSSasLSonV6ApBUMT0iIBGWr1uPqzutlU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=oVaQCrwZ39QhxunUlh6ot4MGP6UbkZuMDoAvyopQZhdW+1uDFcviojDYOPvBrl9uk 4xie9ps1jSKF6HwY/8x9NGXgVgOv3jQqBWgQKKMfNZtSZACBuiuQtmTRz9sN9M75fU AO0aj7Ui+DKrXvGK/28Pk9wITKS8PN1pstq/7bPaB1N1GdA8SOteMTz0JCldT3W+rM FB/0AvTxJrH7Db6r5oY9/FC0R5L5URzJ/V2uoZoVOvFJaLmk9rWhBP08kqbwsoLz/L JU3EzGuR1/N1Vt4A1aa/B17iJ+aujl170V0VnGIWqjwUwfiNYl+ZruiTTdJuaXQvAA +RkV4LNkZvrgg== Date: Thu, 20 Jun 2024 13:55:53 -0700 Subject: [PATCH 07/11] misc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: Christoph Hellwig , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669219.3034840.8512307391269454618.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong 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 Reviewed-by: Christoph Hellwig --- 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 ]], [[ 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 #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) From patchwork Thu Jun 20 20:56:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706318 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A8FD768F0; Thu, 20 Jun 2024 20:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916969; cv=none; b=CHBo1x0L4KX4gfpaYuKMm8cMXwpBarz3aBGJA6rYkwpAP6LZMmPCyorJCW+x05KZPJSql4at6Z24xS25c9GVzWHQVIGW1+ZpS/9vGzYpfaUJvRfEln3Hqqnyf7Oy+uAfak51VxEyb9mMoZCziBj4YNCdbFQ8ehgC0clDvB4ziZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916969; c=relaxed/simple; bh=VyW4kCUIMLJvFQjGeIt/yoYNkIJDADdTQIE9bwSzhpQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RzdmW9aby38UqIuYZ2UbteRhJEy0hW/nQ0GK2yA+lRsfcf+05bGnBXjH+SZ0tlHtwBUwFwu6TCYvY+VYOgQRyfrFLNoj0P4URAYwuhunYqrg4CS9DMgsYzcdES/wRuk8vngVxFevwCmiyQs3/F2UM+7AxPDCpOHjUefZUiH3BYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NAdI4neW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NAdI4neW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44101C2BD10; Thu, 20 Jun 2024 20:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718916969; bh=VyW4kCUIMLJvFQjGeIt/yoYNkIJDADdTQIE9bwSzhpQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=NAdI4neWnU2yDii98MJoGNUZdyoW3WUy/pQSEXyHcz0N/QO72rN9XMLY3P0Yuvi8U hji0qUI/FmkIYPGoZG96i1KEOFz6Gvf64KAhVJgh9MQg3YlTzsdl5giTROfuw6vEmf tbivu0Tet80N0fkCB08tk6Q0ZOgeyv+xqoHl/WqlEE2SxAOeJHgz0CogwtJ05YEkcr E+vuklB/KBEQToM4fBkpevX4PiGqIKl7B4Na6ZSrqHseTaWmVTpGfvsSuC6xNi8OUM TZEZxLV0HZKVw5apV3Hw07TrxSBKuA6f7obJ9aCOkQzBYCMvGw1PCmlOQ88j3zPtNt VYwKsoThRliZA== Date: Thu, 20 Jun 2024 13:56:08 -0700 Subject: [PATCH 08/11] src/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: Christoph Hellwig , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669234.3034840.18048313139141371955.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Update to use our new file content exchange ioctl definitions. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- 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 ]], [[ - 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 +#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 #endif +#ifdef NEED_INTERNAL_XFS_IOC_EXCHANGE_RANGE +# undef xfs_exchange_range +# undef XFS_IOC_EXCHANGE_RANGE +#endif + #ifdef HAVE_XFS_LIBXFS_H #include #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 #include #include -#include #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. From patchwork Thu Jun 20 20:56:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706319 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B9D97D3EC; Thu, 20 Jun 2024 20:56:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916985; cv=none; b=ZydvLqaXrDR8VWmHH0iAidIYqd575Yl4X2GfE6dMtHngW4KjjufCW3TZta42Xvcb+6K4Iu8yZGrn5q+p9ta1/a4FTCr1iZ8IUUmfhPV3ostEZpOW63UG4qXi8aX3pBD83BWDS7V8sET5TXDRBrYiHlI2si2gcY7v1ENWKmsSEk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718916985; c=relaxed/simple; bh=bFwqhNuHERJqNF70IA4ZqT8dPRy9FK388CWFy1GELx8=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cJFnsgSU5rBlaroE6QHyOQJaHi5Jsn9xThqqxMZEU8P+Q7BsuRb1IOlKBffWCfp5+uhYlaEemi87ZrOZfT9g89sF/DTCTM1PBW9Htpg5LE1LfEhSDK3i6nDSpxf7lzCDhkZWzbFveA0No2Gdc1ThXVOasgLMQgef8xoorX7ToP0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Uq3joVC2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Uq3joVC2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D80FEC2BD10; Thu, 20 Jun 2024 20:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718916984; bh=bFwqhNuHERJqNF70IA4ZqT8dPRy9FK388CWFy1GELx8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Uq3joVC2b6mA3vJHBpzp7ifBQu7EqOHBF3r6CZqgWIJl6hHWr+r46XMpA3JSJv21Y y/znZ+c5pdrexOZlX64QPqNkZYriImKOVNad5/M8A94i8yUBK0P3F+70A01/Dy2t4L 9E58ZEdsWWhFY5LArqWRtPd0S+Kwt3go7JA9tN8kE7SQbLLKwrvwgFSog2ojI4obSd sFm/ZwF7SHxol3VrrLTqs31jq6jflNnpwUms0BnKg2gTDzXNvRAnKcCmle7WyCEiX4 qcaQWK1qJQ0hMY/z/DCl0UYgTKy+1FylcoPBfDBkw4nMs7BqxWW2Cax8/Dh+MFK+/N UMoZes9XbtFtg== Date: Thu, 20 Jun 2024 13:56:24 -0700 Subject: [PATCH 09/11] xfs/122: fix for exchrange conversion From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: Christoph Hellwig , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669249.3034840.8867712702649291413.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Fix this test for the swapext -> exchrange conversion. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- 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 From patchwork Thu Jun 20 20:56:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706336 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D98267C6EB; Thu, 20 Jun 2024 20:56:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718917001; cv=none; b=io2UM46wAJjjUJ+vZ2DwpvczXRQpVlyENfT2fBj80DvsWvWgUKBqRs7bcDVbrjClJG9c2JRucBFFkidgZ0/KRnfFoNlU1s9XQ5DZUCODOEy+yI4nvtAuOtTOm/j05JacP6pkOKgefADukMO8xw5hqc/3vzRCDLjnYOYeKycNero= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718917001; c=relaxed/simple; bh=dOoi0cY8/v7xXf2xAIR78zv9owA7CiegGw+mnFiQ1pI=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q8bjTJzAsA+z8FhOIKVBBhk5/KNA9O2KiL+mSVqEtpvlFfFMXCu2lI68TjhTmCG4JGxuG/6FUHuRTcUFrfRfFKrKSz/9SuNZD76NZ8fbs6A+K6uMth06Oku/SBLRUu++8meShNH0Hg17tz0n3Z7cmdnrqPqn8X10+E5yp2b++eM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DM2n+u35; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DM2n+u35" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82593C32781; Thu, 20 Jun 2024 20:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718917000; bh=dOoi0cY8/v7xXf2xAIR78zv9owA7CiegGw+mnFiQ1pI=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=DM2n+u35gM2mGEv/5imDcW/U0M/uYtJr/Nio5hQOIF8/0fV9PTurZBgkXjmbbXHqw 5baEOR2hImfkgqJxNBcAd2G7p9Ba2rNLSqnm3Sgb9t3fr7egxpH3uIkwEdIGxiB8kY vSJ20BZ1S+UEhRb/r4WcNvRhZTG5EjEhV1QrwA9S+oq9cFF8H2+v0z8kvWfF0lJu89 LA3tekB0DAlEeyKzdeliqOLgbpXBHz3XYlwGDAKgHkc0QSWld1UScbJ1JaYnefDAlb tK93LSSZwI0ZlmtnGEF1G1XIbcNFBmpr+U7n5auJ1NmJQ0xHx+PB3UwTYLSwSrWlLT F0IyEIf60kcIw== Date: Thu, 20 Jun 2024 13:56:40 -0700 Subject: [PATCH 10/11] xfs/206: screen out exchange-range from golden output From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: Christoph Hellwig , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669264.3034840.4662263364429761236.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Fix this so that exchange-range doesn't trigger test failures. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- 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" } From patchwork Thu Jun 20 20:56:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13706337 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D70274E25; Thu, 20 Jun 2024 20:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718917016; cv=none; b=BLESYzWrdXylrhcpAubD0UnHFjbTee62r05V7lp4TTXG4nFVmxK/NRg3sS2m3/8RTg44LQCHi0LlXNZIIB0uOz4Xq5q+GDjpBMO9q2KgmSKOu0WOsMoIBtFdfrG5f8OnaBqKwvZxTkLC+Y/qF+MXAByo37wRacdHOo+TLJF1BmM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718917016; c=relaxed/simple; bh=ydDxHCQWpsWPSZRrGvMokDKGNmvJT5jqWhjk8/lp5f0=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fSfzL4qWSfUZGQ3AlXlVrSCsouCFADJdHBxuHVfP3MxTIOAHrS3NWnk7Vmlo6uf9shQp4Jkk5OeGFJ92Zb9Mn64dLOh2hoO9talR6CRPoT61RAH6tYtdqyrUHtlD6z7z2XKL/f9/md2RqMsZmdCD41OwqcIKSI3wPaeau6NSAII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=u4EuDNIA; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="u4EuDNIA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31219C2BD10; Thu, 20 Jun 2024 20:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718917016; bh=ydDxHCQWpsWPSZRrGvMokDKGNmvJT5jqWhjk8/lp5f0=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=u4EuDNIAmtwB+5KFj9v/miCzqXRlwryLZI79IVWT4bp0h/y+Nk4As8ZuRdUSpaqY0 N5TGVnwYcLva6On2BXNvX3LNKS7ak3ERLiSXFgocxpDHZR/fKTeu1SEWVrJ6MRU48z 1YiFxxbHEyFUH+PR/na9lm2vhuGEHe6V8o26Lqgur4JGEMU4+vGt37yaOhtIVrSYNQ uY/DBECYm+CX+5fHHACxrkPUbS4zO3d0SwEg9LPAT7TnHTxGBOkaVIPuNYOAS9tpQC gHdA5o5rk6JM/Usrr0Q4nHaViSy4sf0Dl0SNNoG8GbNSZAzTHEupimY4p2jKWMR+n8 7uhAyDYi/Dx9g== Date: Thu, 20 Jun 2024 13:56:55 -0700 Subject: [PATCH 11/11] exchangerange: make sure that we don't swap unwritten extents unless they're part of a rt extent From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: Christoph Hellwig , fstests@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171891669279.3034840.200736938153015650.stgit@frogsfrogsfrogs> In-Reply-To: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> References: <171891669099.3034840.18163174628307465231.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong 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. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- 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