diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-02-28 18:59:21 -0800 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2023-03-02 16:21:47 +0800 |
commit | 815ea93652305f0ebba36b3e0ed48602235b9b1c (patch) | |
tree | cb14cc83077aba486891e182706c210aa617bc82 /common | |
parent | 5d2aea2b1f6dc3ac84909bbd3c155edccc131aae (diff) |
generic: test new vfs swapext ioctl
Test the new vfs swapext ioctl.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/rc | 13 | ||||
-rw-r--r-- | common/reflink | 33 |
2 files changed, 46 insertions, 0 deletions
@@ -2581,6 +2581,17 @@ _require_xfs_io_command() echo $testio | grep -q "Inappropriate ioctl" && \ _notrun "xfs_io $command support is missing" ;; + "startupdate"|"commitupdate"|"cancelupdate") + $XFS_IO_PROG -f -c 'pwrite -S 0x58 0 128k -b 128k' $testfile > /dev/null + testio=$($XFS_IO_PROG -c "startupdate $param" \ + -c 'pwrite -S 0x59 0 192k' \ + -c 'commitupdate' $testfile 2>&1) + echo $testio | grep -q "Inappropriate ioctl" && \ + _notrun "xfs_io $command $param support is missing" + echo $testio | grep -q "Operation not supported" && \ + _notrun "xfs_io $command $param kernel support is missing" + param_checked="$param" + ;; "swapext") $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 @@ -2589,6 +2600,8 @@ _require_xfs_io_command() _notrun "xfs_io $command $param support is missing" echo $testio | grep -q "Inappropriate ioctl" && \ _notrun "xfs_io $command $param ioctl support is missing" + echo $testio | grep -q "Operation not supported" && \ + _notrun "xfs_io $command $param kernel support is missing" rm -f $testfile.1 param_checked="$param" ;; diff --git a/common/reflink b/common/reflink index 76e9cb7d..22adc444 100644 --- a/common/reflink +++ b/common/reflink @@ -325,6 +325,39 @@ _weave_reflink_regular() { done } +# Create a file of interleaved holes, unwritten blocks, and regular blocks. +_weave_file_rainbow() { + blksz=$1 + nr=$2 + dfile=$3 + + $XFS_IO_PROG -f -c "truncate $((blksz * nr))" $dfile + _pwrite_byte 0x00 0 $((blksz * nr)) $dfile.chk + # 0 blocks are unwritten + seq 1 5 $((nr - 1)) | while read i; do + $XFS_IO_PROG -f -c "falloc $((blksz * i)) $blksz" $dfile + _pwrite_byte 0x00 $((blksz * i)) $blksz $dfile.chk + done + # 1 blocks are holes + seq 2 5 $((nr - 1)) | while read i; do + _pwrite_byte 0x00 $((blksz * i)) $blksz $dfile.chk + done + # 2 blocks are regular + seq 3 5 $((nr - 1)) | while read i; do + _pwrite_byte 0x71 $((blksz * i)) $blksz $dfile + _pwrite_byte 0x71 $((blksz * i)) $blksz $dfile.chk + done + # 3 blocks are holes + seq 2 5 $((nr - 1)) | while read i; do + _pwrite_byte 0x00 $((blksz * i)) $blksz $dfile.chk + done + # 4 blocks are delalloc + seq 4 5 $((nr - 1)) | while read i; do + _pwrite_byte 0x62 $((blksz * i)) $blksz $dfile + _pwrite_byte 0x62 $((blksz * i)) $blksz $dfile.chk + done +} + # Create a file of interleaved holes, unwritten blocks, regular blocks, and # reflinked blocks _weave_reflink_rainbow() { |