From patchwork Tue Jun 18 00:47:01 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: 13701619 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 3BD9DE556; Tue, 18 Jun 2024 00:47:01 +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=1718671622; cv=none; b=TuTydOD9gpGPkmjMSoICIaDRQdoUXnpl47usSCxjMY7HVBIgXO4yy8Dg0zwVwQbSzCNVitTDFtWwIQckLnH5UtJv4pyirQgjRVogJHyNPsw7Wcsmy81dUObhr3IzjN07zqTSAmLdrEiJdNF+7S6jS5OLG96uguQTONxX9aQyv5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671622; c=relaxed/simple; bh=LSy6zAYvc9vtjsr8+Ahyr+UWU1RB63mxR8kqQv9+lWE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hF3NJexV84LmFuoWb9N+PdOJ+kChmWGhBfAOdA6N9/vndEk5Vep+pmIvtxFFvKXrOD0w2nkb8NgcORvnHrcGvGibTqW+xdhozVoS4nWDcX3/v1NWtEi+eF3KKe+NEfBlO+CKQI2U6kIR//XuYzrPS1cr7UQ4exuavT4h+883JwQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P4FsSd1h; 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="P4FsSd1h" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6726C2BD10; Tue, 18 Jun 2024 00:47:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718671621; bh=LSy6zAYvc9vtjsr8+Ahyr+UWU1RB63mxR8kqQv9+lWE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=P4FsSd1h5W9qhEnPo0PegI/Y7i1XgIh+pB1zVOa7L2yMEZI9BXTDjozavhqD9LHpX UfmQt+6t+YObBBcBysAkvbbFWHnygR78nGUfKwsTZpTZH7/cXl5Zz89SD6QnQyMVb/ FLfs8dI4LFe/gSydK6GShRnhUM78fcTxSJkhcyZxrohD74ocP5PeCM39Of0n6mj5G8 2IHraXdY5iwDza7YGecwlBnW61tQyrdBulRPe4TvSLPTlwqf5Px5+E777ncM/PchUW cJ357MvTAIrAY0mb8se08SGLdCW6nU6VuO2MEd4jrE2Ylq3rL37HtORIkTvAmy0fA1 lbX4swIEW50CQ== Date: Mon, 17 Jun 2024 17:47:01 -0700 Subject: [PATCH 01/10] misc: split swapext and exchangerange From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, guan@eryu.me, linux-xfs@vger.kernel.org Message-ID: <171867145313.793463.3476248924058022268.stgit@frogsfrogsfrogs> In-Reply-To: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> References: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@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 Tue Jun 18 00:47:16 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: 13701620 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 CAF2AEEA5; Tue, 18 Jun 2024 00:47:17 +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=1718671637; cv=none; b=XXvbOX7LWWA+9G7kKKTjIn4HjXdTRNLwTOWb6zWA0ebbPZgEEMxADo2csJMOJV/IXNOge/ER3lN38n5396Di1kdgb+d4Ntt3P9zxKvP3ULhHoCWi/g+k/bzNm5hjWzrYa594g5KxGizPN6w/D8PvsMnVUK7KvtZ6XF6oz6pvDCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671637; c=relaxed/simple; bh=OOFYC0SbKNWby8Jk8ugmg7IDwb84Fs6Xl9CIrDNP0lE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jQw3pPkMLRPvKQGO7eyfjnpxB8qq99gIEpzAfUzobFHvzLY5GFQO1LlD+qjUGxZ0tjrxSqlt5OutNACPDnZQYCHqPorGHu8tn2OlmAtBtK8N5pgqkh4qkGZKlfxha1dudmoQsGrUFbCNyPcFHANGxjrM/4j2R3IkvW5Q5gDYrsc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Yxjw9rO1; 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="Yxjw9rO1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57DC4C2BD10; Tue, 18 Jun 2024 00:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718671637; bh=OOFYC0SbKNWby8Jk8ugmg7IDwb84Fs6Xl9CIrDNP0lE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Yxjw9rO1KvK5yyxBvD13RjByrKo3oV5D82BJ4FkTjU4kx1N1/3ILLkPCyGsVqhSkS LrFh84ZrSqyWH3ILGTeTVFM6mqWRGL5nKFaWnRwlawUnlS6e666YaefQXyE/hik6ng EU1PDxf2HrH58LU889FTELId+wuYaAdybElrc6nixb0N1MbnNbzJGJbRBbOMVOl36Q YvvlZVqiK0j2qNHbQiUQZ9eCIjFUmd+O/xtKD4uXUCPwMA9J9GNkSPffiamaV/4+gA nIf6NjWMloUIrLfxCpVfWBK7rS82fX5OODqq5tqQH2ewxiJqRT/BAFTAcgd8NOF50o /LGN80qOwhFWg== Date: Mon, 17 Jun 2024 17:47:16 -0700 Subject: [PATCH 02/10] misc: change xfs_io -c swapext to exchangerange From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, guan@eryu.me, linux-xfs@vger.kernel.org Message-ID: <171867145328.793463.10222758181268779892.stgit@frogsfrogsfrogs> In-Reply-To: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> References: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@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 Tue Jun 18 00:47:32 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: 13701621 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 7183CEEA5; Tue, 18 Jun 2024 00:47:33 +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=1718671653; cv=none; b=AsQdi5+cFRdLVM9mlqtTUosiW/Hjc6mqaGHRhmWlbEL7GY0A4oVAh+w+DdcZREvdLQmann8B+60tv1bok6QaW9IJqe8UWICm0sdQCoiIR0TAjcsUle+UhAzd4TJ2JI5KJldVN/tXAg53RMGpwVCNP4lWFydh/37aFGhJiTJ982g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671653; c=relaxed/simple; bh=V9gOnn5BI/UZmY8z2G5WlT1v9755M5sAcx7olObhYMo=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fsifp75fm9LbD2zLdkdt33bnPv1n1AypojR0UV43ymrkKH3s2SVb/7cIIskh83pXVFiKnBEcjs39P6AzivxroqfI2R4QXWtWZG6D8Fky0EFf4LB6aA6mvTXM4lcEsCg1IdkNOO5C08GJ4MDamwgtunkqPhujV3n+cCRJt5Yif00= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=V/W5WLh8; 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="V/W5WLh8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0346EC2BD10; Tue, 18 Jun 2024 00:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718671653; bh=V9gOnn5BI/UZmY8z2G5WlT1v9755M5sAcx7olObhYMo=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=V/W5WLh8IIIoz1M0vvhWh3HsqJBKOaOAUoz05ZyFpvL3N0RfXV5rP7xYy/jCY2CnV 6NcU09gLE8HiqXxqyfzNQ1AHbIKeWHAbLvIReBbbTXrNyNYqTCVuen7zKWBuKLPPn4 KsS7AYDpC9IEgdbyHXu0SHlz5zjuqXmFdmMQdGGQN3MsLTToBYUmEgYru6i/AwUG0Q 94mrykPXsuCJnNHw+oQq0RFCUfrzE7pub0jM9AaxkkMEMmqFEXfKK1Va7ks7yWcOqX Ug6os0JLhbw2Rom6BaRL/B3hUSd8sCNCn7RB/FOu4Wu2YX8FfFwMw77iOE0YrvYQDK 5z07ZCv/0Y3iw== Date: Mon, 17 Jun 2024 17:47:32 -0700 Subject: [PATCH 03/10] generic/710: repurpose this for exchangerange vs. quota testing From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, guan@eryu.me, linux-xfs@vger.kernel.org Message-ID: <171867145344.793463.2045134533110555641.stgit@frogsfrogsfrogs> In-Reply-To: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> References: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@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. We're deprecating the old swapext ioctl, so let's move this test to use exchangerange. Signed-off-by: Darrick J. Wong --- tests/generic/710 | 14 +++++++------- tests/generic/710.out | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/generic/710 b/tests/generic/710 index 6c6aa08f63..c344bd898b 100755 --- a/tests/generic/710 +++ b/tests/generic/710 @@ -4,17 +4,17 @@ # # FS QA Test No. 710 # -# Can we use swapext to exceed the quota enforcement? +# Can we use exchangerange to exceed the quota enforcement? . ./common/preamble -_begin_fstest auto quick fiexchange swapext quota +_begin_fstest auto quick fiexchange quota # Import common functions. . ./common/filter . ./common/quota # real QA test starts here -_require_xfs_io_command swapext +_require_xfs_io_command exchangerange _require_user _require_nobody _require_quota @@ -35,14 +35,14 @@ chown nobody $SCRATCH_MNT/b # Set up a quota limit $XFS_QUOTA_PROG -x -c "limit -u bhard=70k nobody" $SCRATCH_MNT -echo before swapext >> $seqres.full +echo before exchangerange >> $seqres.full $XFS_QUOTA_PROG -x -c 'report -a' $SCRATCH_MNT >> $seqres.full stat $SCRATCH_MNT/* >> $seqres.full -# Now try to swapext -$XFS_IO_PROG -c "swapext $SCRATCH_MNT/b" $SCRATCH_MNT/a +# Now try to exchangerange +$XFS_IO_PROG -c "exchangerange $SCRATCH_MNT/b" $SCRATCH_MNT/a -echo after swapext >> $seqres.full +echo after exchangerange >> $seqres.full $XFS_QUOTA_PROG -x -c 'report -a' $SCRATCH_MNT >> $seqres.full stat $SCRATCH_MNT/* >> $seqres.full diff --git a/tests/generic/710.out b/tests/generic/710.out index a2aa981919..fcc006c279 100644 --- a/tests/generic/710.out +++ b/tests/generic/710.out @@ -1,4 +1,4 @@ QA output created by 710 -swapext: Disk quota exceeded +exchangerange: Disk quota exceeded Comparing user usage Comparing group usage From patchwork Tue Jun 18 00:47:48 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: 13701622 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 BBBA4EEA5; Tue, 18 Jun 2024 00:47:48 +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=1718671668; cv=none; b=AZxj8VDwxiPX/iIprgUHIK+z0Kf/o0dY0yvotHLHC6lCoQHjrUv3tLFsw/Dg9UdDUZs1JK00igCMCOZM1ZEiTlC7M3Ehr8Qg0U9dVJsAcDn6V043GSL3cm4GlGBjbRuQCjkcvWZ1hJqNtiIEVNbwR/n5zYn8Nty//gXqqOoiPZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671668; c=relaxed/simple; bh=2OzCVDM1pd8yg0t/scKdigkMce1yBY1X6EplPmmVspA=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=F9jLwJiK8XhOcZimnhGIyHJnxRFMpK/+gwAPc9kA1nDbslgMlP+3Yn+7ApJDWAX2uSTu/oC+CAevTcl/p0UmP9h00icSmlLRa9xCUj+C++dVv64s/f23cX7+n6QD+jbFoYxTHxxhUFNc7UdCa7lEoTHGtXYp6bIGfDfYOQawD/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eMFxvL3i; 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="eMFxvL3i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96A1BC2BD10; Tue, 18 Jun 2024 00:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718671668; bh=2OzCVDM1pd8yg0t/scKdigkMce1yBY1X6EplPmmVspA=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=eMFxvL3iNs7iyhgHp3BOtbXEJ174kNW1clzOVGjm6KX1i9iq5OvGCHSOLwu2b2hnj 9vinSqgWVRdJOzqtvHoOX2Yaou9vcLfYV1inGo+Y54fz24/OJ37vZK5yYgIvk6Pdoc 3MipiEb52feB3PHaHE9Q9kvDkyKmj9cR4bnIdsxtGtwoWe3NKr+2BRjlRfUYCuvzyU HbsRpWNaattDj52Uc5hCODnWCm2YF93JLQyapmfx4cjaelfGbHUFF4Q8Amt9eVSEug uqGcHPktFwUoRiMaQpCmO3RYPeIDSgWqsgFuUX5gqGOosn55Yx7x/10yQ/KjcLY20J 9xfZRbkFJ/w/Q== Date: Mon, 17 Jun 2024 17:47:48 -0700 Subject: [PATCH 04/10] generic/717: remove obsolete check From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, guan@eryu.me, linux-xfs@vger.kernel.org Message-ID: <171867145359.793463.11533521582429286273.stgit@frogsfrogsfrogs> In-Reply-To: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> References: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The latest draft of the EXCHANGERANGE ioctl has dropped the flag that enforced that the two files being operated upon were exactly the same length as was specified in the ioctl parameters. Remove this check since it's now defunct. Signed-off-by: Darrick J. Wong 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 Tue Jun 18 00:48:03 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: 13701623 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 71F2A4A1A; Tue, 18 Jun 2024 00:48:04 +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=1718671684; cv=none; b=FK+5tBRQ8ncdgoFzu2njgVGaw0Ab5gbX99IRlDmpVkrh/48tJSNPVjTBR+XjQO1Nh3Gj++IOOC8FTadOXSfZGdWkMo0rUvx/SDQ5UW0o97W1cK9v5EK4pfftQB1EF7v1H0iAgyq/3Rfc+5c5lbL+V3r/wfHb1In11739ff22qo4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671684; c=relaxed/simple; bh=OTfh1oUgVYu+QF6laA8iKglQs++UoiLKA97akeAUzlo=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kBdsfP2EoRC5xwWR4kdFhx6cTAvqyWAs0UXHifif5wUf61zfMrdW3qpUmue6KqACeGFL0FQjthTZAChkVTUO5WbyrZvYwGKhiSXORc3U6y5OWUNeLUdIn4+6YorPznhZ5a5H9tQv4T2CVoOX2EmfPGmlDxhs10LLTKp1c7VvL14= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JRu5x7V4; 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="JRu5x7V4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B41CC2BD10; Tue, 18 Jun 2024 00:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718671684; bh=OTfh1oUgVYu+QF6laA8iKglQs++UoiLKA97akeAUzlo=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=JRu5x7V4/6rtn7K42kWBvWdRYtYmwQu5bBjQj2rDsFKD0btJ+lKFHy+w7tJVbTaDq H4l3CTkMrKJRelZxDe+c8TUyHOD5Wlc3DD9Zp9Yi2nJEyWeS8syyDZuqNsNhw1PVXb xmZffTQ0QVEUgpTAFifpusYNzLbiOge9zX5GVky6B6tF2+XHCiWioEY5w1xru4ti+c 9e0Fu9mmnXcMegKQGWJXM6HTi4QAoMFdX2V68KlHI3asjCA8MiZhMq/XhG0Zlf65JF 4jBkiGcRTKl/q1MBY+38eJxYclULA8TNaVQydqhBqTHe8mUKG4uisISrstNu42kBE8 VavdW8ACTP+Gg== Date: Mon, 17 Jun 2024 17:48:03 -0700 Subject: [PATCH 05/10] ltp/{fsstress,fsx}: make the exchangerange naming consistent From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, guan@eryu.me, linux-xfs@vger.kernel.org Message-ID: <171867145374.793463.652926155831384070.stgit@frogsfrogsfrogs> In-Reply-To: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> References: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@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 Tue Jun 18 00:48: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: 13701624 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 50A925672; Tue, 18 Jun 2024 00:48: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=1718671700; cv=none; b=tjJIKy0UpUNjoMqjBJEsQ0CLleHlC5WjORjxYnETdYdxbaytGk2ZYUwRDDZIhN9zH9dUSd3RPVwSbCS1ZxAwdi5W0U0dTdrHspN5R/hzeR1M4cLxWViQCL4BZKCdDur6+pDrejLbQ7drAgYV4t3jiDRpfMNZ7SJ1Xqg1TGHqpWA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671700; c=relaxed/simple; bh=BK91fSJNvcM9g4Xe+fJR2S9hey9dLz9CISk8CoCCdr8=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RJVwRBfCRXt+d2E6FrTZ1L9j7vYTelt6EIxS9RzWYOziJyoiqzB3lQTJ0TtkcPMOrSbwwk0nrxUWCNSiC7DCHibtYpIMQ0UKcDYzAb8fMfl3KREqCuZaU/P0cgy8rpApThlVH/afedKIyNUe7HC+6t2HXcAGrNb5guUh2rAfCNY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JvT6we5M; 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="JvT6we5M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDD11C2BD10; Tue, 18 Jun 2024 00:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718671699; bh=BK91fSJNvcM9g4Xe+fJR2S9hey9dLz9CISk8CoCCdr8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=JvT6we5MLLYpVoXzEkh2VgN91dsgnkNyPWXzwo1+VQCGS0M0MiihgIL1ykfZk6uHO nxQa1gla9+rrbofFh+jpf5Kp9Rsuxeg3nZmQK94rD0qWK+UUv1tmTKZHgqOO/FS9KJ d/8x7kgsanqJx2lQGmd43/4ZyE5GNLFZTiWa1c8T1Wb/pIzp6AVehleG+rzP7h1Rnv bMNHcETqc8/npgOXHiFELH4J9DcfdqWt9AqmJjvRlciubG1b1LMTrxhzNXmx0mRrEU Hdt7V7CtMlnUJV8LiWxnC42O93dhDFQznU1MEYNxpfpCN1uxmjsaGy1GNrc/ENhBmj fgyicnfT7aQWQ== Date: Mon, 17 Jun 2024 17:48:19 -0700 Subject: [PATCH 06/10] misc: flip HAVE_XFS_IOC_EXCHANGE_RANGE logic From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, guan@eryu.me, linux-xfs@vger.kernel.org Message-ID: <171867145390.793463.9133351291514672371.stgit@frogsfrogsfrogs> In-Reply-To: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> References: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@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 Tue Jun 18 00:48:35 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: 13701625 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 ABBD8568A; Tue, 18 Jun 2024 00:48: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=1718671715; cv=none; b=tPGXrbI3ccpDCkTWSjWl96nftcOnWOkOvGQ6eQmVp28DlLsATJ46jkqjsBDg6m37wez2KJEaLz0J9K5kQpzTyUxNkNbaRe3/d+4mBmKc1szy3DCcdI7EoZYtNmDqDH2jNIyLv3BG6IbaeCdH1EiR7wtXf8fLDg+87F0pz6zKXGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671715; c=relaxed/simple; bh=BzThRy86r8ztwFGUdUJsU/bHYNo+ZhWfd0g7yMF4+JI=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nbvqSNVw4St6yJTrvCJejCt0vsD76hd9WyJNXQ/3+xeVIPvoQAqV2fYAnHOvmkaeayaZO086VLPg5BoeZ2E8rMa0hIBVbQq+VW2naxqk1jXR7aPfj7XY4Dv3ny/zcp0tG6M2BAEQ+WvWnzScpdh2yhsZmvqcjrzRACxplKs4J+k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QVFtpwBB; 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="QVFtpwBB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81977C2BD10; Tue, 18 Jun 2024 00:48:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718671715; bh=BzThRy86r8ztwFGUdUJsU/bHYNo+ZhWfd0g7yMF4+JI=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=QVFtpwBB/u1D2U5/Z7PrNjFdz7pAuRy0kCFOGWaC70eJsmt7DQh4Nk6lqjfU3mU2G 2BzMTo9EDDvAeyMfrl76ectHevcCaCbn88cDqH6TRjfTmdPRo/RBVRz40zxXykEYW8 eMbVGm5Od3VGhZgc7G9J5KJNsFXpYI60q9tXgC9/PzZf3oTJuUQqreiXrgSTZE2Lzc 0s6s6GB7m6Xl95upfDlpYrf1ZJYjBv8TN01+o8MvbbHCNX14ZobM+fD0P5flO6mZSk u7Ki9IqjKxmrYEgjmT850oC5ajgRNYpiiF4FmA2CPcwRVYxctAp9NWxjr3vIpHSNHB i30Vg6SSdpHjw== Date: Mon, 17 Jun 2024 17:48:35 -0700 Subject: [PATCH 07/10] src/fiexchange.h: update XFS_IOC_EXCHANGE_RANGE definitions From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, guan@eryu.me, linux-xfs@vger.kernel.org Message-ID: <171867145405.793463.11941083120880917446.stgit@frogsfrogsfrogs> In-Reply-To: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> References: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@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 Tue Jun 18 00:48: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: 13701626 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 B23846AC0; Tue, 18 Jun 2024 00:48: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=1718671731; cv=none; b=nwqt4VePQMmFA54m3r0k7vFYHeUeHiZKHOSLv6bb5bkna7wy10AZ8re1Mazce5G70rzZoDswuADQ4icosezHrhWWy075u3awjeZNRqGOhU27FZluefjoAGUA5fMrtfHAkn6t2LOGQ9qsLGbROXFom9rGaLRi4jNikM7IEJHtPGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671731; c=relaxed/simple; bh=ZsyVYuUsVbVv/KGw6BUQYAbf2An1C0zhfadymfVs9E4=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=G8zV7R7bOKLDqpv4uL9BkjaTQHGyYSIFh+M+w8eDdfAOrQS3HBhuvMW+3vbWQhC1ZToxSIHvB2QRBhI19/IJyHu4o1/xujWh7HdK+0zYv5Uk0AETaVlriBo4LSN93G1z7piCTl9fSPneobkKRKK14DYtgu/W41Ipf47D1NvgCuI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L50x1MCY; 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="L50x1MCY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30903C2BD10; Tue, 18 Jun 2024 00:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718671731; bh=ZsyVYuUsVbVv/KGw6BUQYAbf2An1C0zhfadymfVs9E4=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=L50x1MCYmaSPmcboQtz402OfoULpkz8TXDN0+FFmJDHya+Q7XuJePg9wQUMH6a/DT naxRmtizqmQxupxCxc+55DXOi25knAfq4TRS4hvBW9Njbi2SpdN21UHDlLcU6WkRH2 xbAJFg13IJlhDpOSJZHI/jmglHxoM1aU2YBU88bIptz3kFxDfBdUo/3Bs2gYurdJsF 7TAdEbnDsgN6kj5Aol5YzXURA5twFENr7yf2qXeTLNXKC65ttn1iPp5+oywcZsrXNZ NsEFJQGP4G0oeSBQWUgyViE0joWArwx24aV2yP6nbPjDxzAawHByG9GQZkrK9C7nJP ZpIk556pvYQjg== Date: Mon, 17 Jun 2024 17:48:50 -0700 Subject: [PATCH 08/10] xfs/122: fix for exchrange conversion From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, guan@eryu.me, linux-xfs@vger.kernel.org Message-ID: <171867145421.793463.13590004698802326563.stgit@frogsfrogsfrogs> In-Reply-To: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> References: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@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 Tue Jun 18 00:49: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: 13701627 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 3E00B79D1; Tue, 18 Jun 2024 00:49: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=1718671747; cv=none; b=KRFVLrr2AfY/UqClc+GwakTbJjgtr2+W8BBWVG9/0BSjkPxRsFtWryi/xDKU31QjZoaj00qw5T0PGTXJdLEiHW3RnZ4rG76Xu2RM+eSE7NDjwafC1LB6iInHtkAh/0bHtddOUzYdL+Da9GBbowRr+gSiCTFSkAa2384UlOxLvGE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671747; c=relaxed/simple; bh=ZpgrX+wV3Ey9ZLqfyhRuSMp4PABw3ImqatSnG0tJJ5g=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JyJDNK3i9KTkBGbM4IK1iTZzNFMQ/Q5jSxiT8fky3jzXNFS1DjpMmzcJId16Uh6XeJYG4LWyv+pO8COPB+LWWkrMQ0MfKdQkzPKxugvvKgPyLB/MGVClT04mZG4lWS6kCRatKNg7oeCZr7NsN23waxJbwt+1HDvLBmtCNNaEMhk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=urbRfXFM; 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="urbRfXFM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C464DC2BD10; Tue, 18 Jun 2024 00:49:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718671746; bh=ZpgrX+wV3Ey9ZLqfyhRuSMp4PABw3ImqatSnG0tJJ5g=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=urbRfXFMWM9NYT+gf/ko5Hwk5L3KQXQSbHD2hMm6twRP7guzPD1p1dcwliFnp/5kb PQ4e/cUkkE53FTQINSzr+fb6Kdbdpu/EbMSmSOrRvIpuN7lx9PUh9QHMKTF68IFRPK blD9Ed2PSuHSjBaeCzRD08OuxJibnrqQB6D94Fd5V7YqFX2nO5rS3UePWxXyFgeivg sz2+xayjCkdQ9OgOz+QwGbjtgaxOBVB+EECYmW0BaYIcY3x81da/HZjP+UoYikFTb6 xWQNVsCpgZPslovCM5S/5ANuRekGqzubyvWk4+bAIsLoflTi3+zT2dk05kyxDk2KN8 2ry5xdjlZ/qoA== Date: Mon, 17 Jun 2024 17:49:06 -0700 Subject: [PATCH 09/10] xfs/206: screen out exchange-range from golden output From: "Darrick J. Wong" To: djwong@kernel.org, zlang@redhat.com Cc: fstests@vger.kernel.org, guan@eryu.me, linux-xfs@vger.kernel.org Message-ID: <171867145436.793463.8960807127589028072.stgit@frogsfrogsfrogs> In-Reply-To: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> References: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@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 Tue Jun 18 00:49: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: 13701628 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 9E5B4D26A; Tue, 18 Jun 2024 00:49: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=1718671762; cv=none; b=vCQDryTReCGgkoOMDJEpWIbUXLdZmccO515OrlxGpk0ca5e0zM2vMkWhm4RaQQACS4vJo7pyBUXct8Em52Krj57/Pptw2fCqGVlFplhulUiAm02WjH3HHlMNLOzOVKp7+twPZUfhGdimaVuEp3T9DVAxOBx3nZOGnoh5OtpS6sQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718671762; c=relaxed/simple; bh=ZL5mEFJsWf0wQZYiFogbDZJyIjjm20QAoYC2R20UYR4=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hYcWI4ea24JEgcsKgXdKhq1eEyJ+AXnXIMKASesXELTy/f7d+IDArWWhfPLr1WML5m6qsSn2iZ2N4eWm7l4KGopCe1okO3SKHC7pItExKHqqXVPnyTrEt+qzm19DhI5ZqF2qpmqExkth8EGY839NCNWSoeqchmwckAl2SPFce8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ueqJquaL; 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="ueqJquaL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68389C2BD10; Tue, 18 Jun 2024 00:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718671762; bh=ZL5mEFJsWf0wQZYiFogbDZJyIjjm20QAoYC2R20UYR4=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ueqJquaLcch0EKyxZnYaaJ07SSF8WmIHvJtfKSWZzsWwY35ppJjzPwLlZGwDmBrTz n6cOR3oh5Stziqmgedi7kS0ocBKwKXPyXKHwIdUezIawdYZAaGBjV6y9WmeXMDQLp9 cKbAht2/SvuOMRg1RoUIH54K63EyV3Ry4lZUqZvmopKESnuO1/2O55pcFW9JoBwxmt V1YED+47i7KjhtkTdYS6CIzEz7giELKDgw87f1cVrsYqGpgaag+2t13TeXD7FMlqEC EJQSXj2FFL4XQdJ+mEwGMPd9qtZY6RIY8t/d0+BXNSGktTOPvRKHoH1UylFlN21pqc 3eCLo9y6WZfcQ== Date: Mon, 17 Jun 2024 17:49:21 -0700 Subject: [PATCH 10/10] swapext: 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: fstests@vger.kernel.org, guan@eryu.me, linux-xfs@vger.kernel.org Message-ID: <171867145451.793463.2794238931520323458.stgit@frogsfrogsfrogs> In-Reply-To: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> References: <171867145284.793463.16426642605476089750.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: fstests@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong 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