fstests: test Btrfs swapfile support
cover fstests: test Btrfs swapfile support
From: Omar Sandoval <[email protected]>
This series fixes a couple of generic swapfile tests and adds some Btrfs-specific swapfile tests. Btrfs swapfile support is scheduled for 4.21 [1].
1: https://www.spinics.net/lists/linux-btrfs/msg83454.html
Thanks!
Omar Sandoval (7):
generic/{472,496,497}: fix $seeqres typo generic/{472,496}: fix swap file creation on Btrfs
btrfs: test swap file activation restrictions
btrfs: test invalid operations on a swap file
btrfs: test swap files on multiple devices
btrfs: test device add/remove/replace with an active swap file
btrfs: test balance and resize with an active swap file
tests/btrfs/173 | 55 ++++++++++++++++++++++++++++++ tests/btrfs/173.out | 5 +++ tests/btrfs/174 | 66 ++++++++++++++++++++++++++++++++++++ tests/btrfs/174.out | 10 ++++++ tests/btrfs/175 | 73 ++++++++++++++++++++++++++++++++++++++++ tests/btrfs/175.out | 8 +++++ tests/btrfs/176 | 82 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/176.out | 5 +++ tests/btrfs/177 | 64 +++++++++++++++++++++++++++++++++++ tests/btrfs/177.out | 6 ++++ tests/btrfs/group | 5 +++ tests/generic/472 | 16 ++++----- tests/generic/496 | 8 ++--- tests/generic/497 | 2 +- 14 files changed, 391 insertions(+), 14 deletions(-) create mode 100755 tests/btrfs/173 create mode 100644 tests/btrfs/173.out create mode 100755 tests/btrfs/174 create mode 100644 tests/btrfs/174.out create mode 100755 tests/btrfs/175 create mode 100644 tests/btrfs/175.out create mode 100755 tests/btrfs/176 create mode 100644 tests/btrfs/176.out create mode 100755 tests/btrfs/177 create mode 100644 tests/btrfs/177.out
Signature · 1 line
2.19.1
PATCH 1/7 generic/{472,496,497}: fix $seeqres typo
From: Omar Sandoval <[email protected]>
--- tests/generic/472 | 2 +- tests/generic/496 | 2 +- tests/generic/497 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
tests/generic/472 +1 -1
@@ -51,7 +51,7 @@ swapfile_cycle() { $CHATTR_PROG +C $swapfile >> $seqres.full 2>&1 "$here/src/mkswap" $swapfile >> $seqres.full "$here/src/swapon" $swapfile 2>&1 | _filter_scratch - swapoff $swapfile 2>> $seeqres.full + swapoff $swapfile 2>> $seqres.full rm -f $swapfile }
tests/generic/496 +1 -1
@@ -53,7 +53,7 @@ swapfile_cycle() { $CHATTR_PROG +C $swapfile >> $seqres.full 2>&1 "$here/src/mkswap" $swapfile >> $seqres.full "$here/src/swapon" $swapfile 2>&1 | _filter_scratch - swapoff $swapfile 2>> $seeqres.full + swapoff $swapfile 2>> $seqres.full rm -f $swapfile }
tests/generic/497 +1 -1
@@ -53,7 +53,7 @@ swapfile_cycle() { $CHATTR_PROG +C $swapfile >> $seqres.full 2>&1 "$here/src/mkswap" $swapfile >> $seqres.full "$here/src/swapon" $swapfile 2>&1 | _filter_scratch - swapoff $swapfile 2>> $seeqres.full + swapoff $swapfile 2>> $seqres.full rm -f $swapfile }
Signature · 1 line
2.19.1
PATCH 2/7 generic/{472,496}: fix swap file creation on Btrfs
In reply to Omar SandovalFrom: Omar Sandoval <[email protected]>
The swap file must be set nocow before it is written to, otherwise it is ignored and Btrfs refuses to activate it as swap.
--- tests/generic/472 | 14 ++++++-------- tests/generic/496 | 6 +++--- 2 files changed, 9 insertions(+), 11 deletions(-)
tests/generic/472 +6 -8
@@ -42,13 +42,15 @@ _scratch_mount >>$seqres.full 2>&1 swapfile=$SCRATCH_MNT/swap len=$((2 * 1048576)) -page_size=$(get_page_size) swapfile_cycle() { local swapfile="$1" + local len="$2" + touch $swapfile # Swap files must be nocow on Btrfs. $CHATTR_PROG +C $swapfile >> $seqres.full 2>&1 + _pwrite_byte 0x58 0 $len $swapfile >> $seqres.full "$here/src/mkswap" $swapfile >> $seqres.full "$here/src/swapon" $swapfile 2>&1 | _filter_scratch swapoff $swapfile 2>> $seqres.full
@@ -57,20 +59,16 @@ swapfile_cycle() { # Create a regular swap file echo "regular swap" | tee -a $seqres.full -_pwrite_byte 0x58 0 $len $swapfile >> $seqres.full -swapfile_cycle $swapfile +swapfile_cycle $swapfile $len # Create a swap file with a little too much junk on the end echo "too long swap" | tee -a $seqres.full -_pwrite_byte 0x58 0 $((len + 3)) $swapfile >> $seqres.full -swapfile_cycle $swapfile +swapfile_cycle $swapfile $((len + 3)) # Create a ridiculously small swap file. Each swap file must have at least # two pages after the header page. echo "tiny swap" | tee -a $seqres.full -tiny_len=$((page_size * 3)) -_pwrite_byte 0x58 0 $tiny_len $swapfile >> $seqres.full -swapfile_cycle $swapfile +swapfile_cycle $swapfile $(($(get_page_size) * 3)) status=0 exit
tests/generic/496 +3 -3
@@ -49,8 +49,6 @@ page_size=$(get_page_size) swapfile_cycle() { local swapfile="$1" - # Swap files must be nocow on Btrfs. - $CHATTR_PROG +C $swapfile >> $seqres.full 2>&1 "$here/src/mkswap" $swapfile >> $seqres.full "$here/src/swapon" $swapfile 2>&1 | _filter_scratch swapoff $swapfile 2>> $seqres.full
@@ -59,8 +57,10 @@ swapfile_cycle() { # Create a fallocated swap file echo "fallocate swap" | tee -a $seqres.full -$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full +touch $swapfile +# Swap files must be nocow on Btrfs. $CHATTR_PROG +C $swapfile >> $seqres.full 2>&1 +$XFS_IO_PROG -f -c "falloc 0 $len" $swapfile >> $seqres.full "$here/src/mkswap" $swapfile "$here/src/swapon" $swapfile >> $seqres.full 2>&1 || \ _notrun "fallocated swap not supported here"
Signature · 1 line
2.19.1
PATCH 3/7 btrfs: test swap file activation restrictions
In reply to Omar SandovalFrom: Omar Sandoval <[email protected]>
Swap files on Btrfs have some restrictions not applicable to other filesystems.
--- tests/btrfs/173 | 55 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/173.out | 5 +++++ tests/btrfs/group | 1 + 3 files changed, 61 insertions(+) create mode 100755 tests/btrfs/173 create mode 100644 tests/btrfs/173.out
tests/btrfs/173 new file +55 -0
@@ -0,0 +1,55 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Facebook. All Rights Reserved. +# +# FS QA Test 173 +# +# Test swap file activation restrictions specific to Btrfs. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +. ./common/rc +. ./common/filter + +rm -f $seqres.full + +_supported_fs generic +_supported_os Linux +_require_scratch_swapfile + +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +echo "COW file" +# We can't use _format_swapfile because we don't want chattr +C, and we can't +# unset it after the swap file has been created. +rm -f "$SCRATCH_MNT/swap" +touch "$SCRATCH_MNT/swap" +chmod 0600 "$SCRATCH_MNT/swap" +_pwrite_byte 0x61 0 $(($(get_page_size) * 10)) "$SCRATCH_MNT/swap" >> $seqres.full +mkswap "$SCRATCH_MNT/swap" >> $seqres.full +swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch +swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1 + +echo "Compressed file" +rm -f "$SCRATCH_MNT/swap" +_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) +$CHATTR_PROG +c "$SCRATCH_MNT/swap" +swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch +swapoff "$SCRATCH_MNT/swap" >/dev/null 2>&1 + +status=0 +exit
tests/btrfs/173.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 173 +COW file +swapon: SCRATCH_MNT/swap: swapon failed: Invalid argument +Compressed file +swapon: SCRATCH_MNT/swap: swapon failed: Invalid argument
tests/btrfs/group +1 -0
@@ -175,3 +175,4 @@ 170 auto quick snapshot 171 auto quick qgroup 172 auto quick punch +173 auto quick swap
Signature · 1 line
2.19.1
PATCH 4/7 btrfs: test invalid operations on a swap file
In reply to Omar SandovalFrom: Omar Sandoval <[email protected]>
Btrfs forbids some operations which should not be done on a swap file.
--- tests/btrfs/174 | 66 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/174.out | 10 +++++++ tests/btrfs/group | 1 + 3 files changed, 77 insertions(+) create mode 100755 tests/btrfs/174 create mode 100644 tests/btrfs/174.out
tests/btrfs/174 new file +66 -0
@@ -0,0 +1,66 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Facebook. All Rights Reserved. +# +# FS QA Test 174 +# +# Test restrictions on operations that can be done on an active swap file +# specific to Btrfs. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +. ./common/rc +. ./common/filter + +rm -f $seqres.full + +_supported_fs generic +_supported_os Linux +_require_scratch_swapfile + +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount + +$BTRFS_UTIL_PROG subvol create "$SCRATCH_MNT/swapvol" >> $seqres.full +swapfile="$SCRATCH_MNT/swapvol/swap" +_format_swapfile "$swapfile" $(($(get_page_size) * 10)) +swapon "$swapfile" + +# Turning off nowcow doesn't do anything because the file is not empty, not +# because the file is a swap file, but make sure this works anyways. +echo "Disable nocow" +$CHATTR_PROG -C "$swapfile" +lsattr -l "$swapfile" | _filter_scratch | _filter_spaces + +# Compression we reject outright. +echo "Enable compression" +$CHATTR_PROG +c "$swapfile" 2>&1 | grep -o "Text file busy" +lsattr -l "$swapfile" | _filter_scratch | _filter_spaces + +echo "Snapshot" +$BTRFS_UTIL_PROG subvol snap "$SCRATCH_MNT/swapvol" \ + "$SCRATCH_MNT/swapsnap" 2>&1 | grep -o "Text file busy" + +echo "Defrag" +# We pass the -c (compress) flag to force defrag even if the file isn't +# fragmented. +$BTRFS_UTIL_PROG filesystem defrag -c "$swapfile" 2>&1 | grep -o "Text file busy" + +swapoff "$swapfile" +_scratch_unmount + +status=0 +exit
tests/btrfs/174.out new file +10 -0
@@ -0,0 +1,10 @@ +QA output created by 174 +Disable nocow +SCRATCH_MNT/swapvol/swap No_COW +Enable compression +Text file busy +SCRATCH_MNT/swapvol/swap No_COW +Snapshot +Text file busy +Defrag +Text file busy
tests/btrfs/group +1 -0
@@ -176,3 +176,4 @@ 171 auto quick qgroup 172 auto quick punch 173 auto quick swap +174 auto quick swap
Signature · 1 line
2.19.1
PATCH 5/7 btrfs: test swap files on multiple devices
In reply to Omar SandovalFrom: Omar Sandoval <[email protected]>
Swap files currently need to exist on exactly one device in exactly one place.
--- tests/btrfs/175 | 73 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/175.out | 8 +++++ tests/btrfs/group | 1 + 3 files changed, 82 insertions(+) create mode 100755 tests/btrfs/175 create mode 100644 tests/btrfs/175.out
tests/btrfs/175 new file +73 -0
@@ -0,0 +1,73 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Facebook. All Rights Reserved. +# +# FS QA Test 175 +# +# Test swap file activation on multiple devices. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +. ./common/rc +. ./common/filter + +rm -f $seqres.full + +_supported_fs generic +_supported_os Linux +_require_scratch_dev_pool 2 +_require_scratch_swapfile + +cycle_swapfile() { + local sz=${1:-$(($(get_page_size) * 10))} + _format_swapfile "$SCRATCH_MNT/swap" "$sz" + swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch + swapoff "$SCRATCH_MNT/swap" > /dev/null 2>&1 +} + +echo "RAID 1" +_scratch_pool_mkfs -d raid1 -m raid1 >> $seqres.full 2>&1 +_scratch_mount +cycle_swapfile +_scratch_unmount + +echo "DUP" +_scratch_pool_mkfs -d dup -m dup >> $seqres.full 2>&1 +_scratch_mount +cycle_swapfile +_scratch_unmount + +echo "Single on multiple devices" +_scratch_pool_mkfs -d single -m raid1 -b $((1024 * 1024 * 1024)) >> $seqres.full 2>&1 +_scratch_mount +# Each device is only 1 GB, so 1.5 GB must be split across multiple devices. +cycle_swapfile $((3 * 1024 * 1024 * 1024 / 2)) +_scratch_unmount + +echo "Single on one device" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount +# Create the swap file, then add the device. That way we know it's all on one +# device. +_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) +scratch_dev2="$(echo "${SCRATCH_DEV_POOL}" | awk '{ print $2 }')" +$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" +swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch +swapoff "$SCRATCH_MNT/swap" > /dev/null 2>&1 +_scratch_unmount + +status=0 +exit
tests/btrfs/175.out new file +8 -0
@@ -0,0 +1,8 @@ +QA output created by 175 +RAID 1 +swapon: SCRATCH_MNT/swap: swapon failed: Invalid argument +DUP +swapon: SCRATCH_MNT/swap: swapon failed: Invalid argument +Single on multiple devices +swapon: SCRATCH_MNT/swap: swapon failed: Invalid argument +Single on one device
tests/btrfs/group +1 -0
@@ -177,3 +177,4 @@ 172 auto quick punch 173 auto quick swap 174 auto quick swap +175 auto quick swap
Signature · 1 line
2.19.1
PATCH 6/7 btrfs: test device add/remove/replace with an active swap file
In reply to Omar SandovalFrom: Omar Sandoval <[email protected]>
Make sure that we don't remove or replace a device with an active swap file but can add, remove, and replace other devices.
--- tests/btrfs/176 | 82 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/176.out | 5 +++ tests/btrfs/group | 1 + 3 files changed, 88 insertions(+) create mode 100755 tests/btrfs/176 create mode 100644 tests/btrfs/176.out
tests/btrfs/176 new file +82 -0
@@ -0,0 +1,82 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Facebook. All Rights Reserved. +# +# FS QA Test 176 +# +# Test device remove/replace with an active swap file. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# remove previous $seqres.full before test +rm -f $seqres.full + +# real QA test starts here + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_scratch_dev_pool 3 +_require_scratch_swapfile + +# We check the filesystem manually because we move devices around. +rm -f "${RESULT_DIR}/require_scratch" + +scratch_dev1="$(echo "${SCRATCH_DEV_POOL}" | awk '{ print $1 }')" +scratch_dev2="$(echo "${SCRATCH_DEV_POOL}" | awk '{ print $2 }')" +scratch_dev3="$(echo "${SCRATCH_DEV_POOL}" | awk '{ print $3 }')" + +echo "Remove device" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount +_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) +$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" +swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch +# We know the swap file is on device 1 because we added device 2 after it was +# already created. +$BTRFS_UTIL_PROG device delete "$scratch_dev1" "$SCRATCH_MNT" 2>&1 | grep -o "Text file busy" +# Deleting/readding device 2 should still work. +$BTRFS_UTIL_PROG device delete "$scratch_dev2" "$SCRATCH_MNT" +$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" +swapoff "$SCRATCH_MNT/swap" > /dev/null 2>&1 +# Deleting device 1 should work again after swapoff. +$BTRFS_UTIL_PROG device delete "$scratch_dev1" "$SCRATCH_MNT" +_scratch_unmount +_check_scratch_fs "$scratch_dev2" + +echo "Replace device" +_scratch_mkfs >> $seqres.full 2>&1 +_scratch_mount +_format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) +$BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" +swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch +# Again, we know the swap file is on device 1. +$BTRFS_UTIL_PROG replace start -fB "$scratch_dev1" "$scratch_dev3" "$SCRATCH_MNT" 2>&1 | grep -o "Text file busy" +# Replacing device 2 should still work. +$BTRFS_UTIL_PROG replace start -fB "$scratch_dev2" "$scratch_dev3" "$SCRATCH_MNT" +swapoff "$SCRATCH_MNT/swap" > /dev/null 2>&1 +# Replacing device 1 should work again after swapoff. +$BTRFS_UTIL_PROG replace start -fB "$scratch_dev1" "$scratch_dev2" "$SCRATCH_MNT" +_scratch_unmount +_check_scratch_fs "$scratch_dev2" + +# success, all done +status=0 +exit
tests/btrfs/176.out new file +5 -0
@@ -0,0 +1,5 @@ +QA output created by 176 +Remove device +Text file busy +Replace device +Text file busy
tests/btrfs/group +1 -0
@@ -178,3 +178,4 @@ 173 auto quick swap 174 auto quick swap 175 auto quick swap +176 auto quick swap
Signature · 1 line
2.19.1
PATCH 7/7 btrfs: test balance and resize with an active swap file
In reply to Omar SandovalFrom: Omar Sandoval <[email protected]>
Make sure we don't shrink the device past an active swap file, but allow shrinking otherwise, as well as growing and balance.
--- tests/btrfs/177 | 64 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/177.out | 6 +++++ tests/btrfs/group | 1 + 3 files changed, 71 insertions(+) create mode 100755 tests/btrfs/177 create mode 100644 tests/btrfs/177.out
tests/btrfs/177 new file +64 -0
@@ -0,0 +1,64 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Facebook. All Rights Reserved. +# +# FS QA Test 177 +# +# Test relocation (balance and resize) with an active swap file. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +. ./common/rc +. ./common/filter +. ./common/btrfs + +rm -f $seqres.full + +# Modify as appropriate. +_supported_fs generic +_supported_os Linux +_require_scratch_swapfile + +swapfile="$SCRATCH_MNT/swap" + +# First, create a 1GB filesystem and fill it up. +_scratch_mkfs_sized $((1024 * 1024 * 1024)) >> $seqres.full 2>&1 +_scratch_mount +dd if=/dev/zero of="$SCRATCH_MNT/fill" bs=1024k >> $seqres.full 2>&1 +# Now add more space and create a swap file. We know that the first 1GB of the +# filesystem was used, so the swap file must be in the new part of the +# filesystem. +$BTRFS_UTIL_PROG filesystem resize 2G "$SCRATCH_MNT" | _filter_scratch +_format_swapfile "$swapfile" $((32 * 1024 * 1024)) +swapon "$swapfile" +# Add even more space which we know is unused. +$BTRFS_UTIL_PROG filesystem resize 3G "$SCRATCH_MNT" | _filter_scratch +# Free up the first 1GB of the filesystem. +rm -f "$SCRATCH_MNT/fill" +# Get rid of empty block groups and also make sure that balance skips block +# groups containing active swap files. +_run_btrfs_balance_start "$SCRATCH_MNT" +# Shrink away the unused space. +$BTRFS_UTIL_PROG filesystem resize 2G "$SCRATCH_MNT" | _filter_scratch +# Try to shrink away the area occupied by the swap file, which should fail. +$BTRFS_UTIL_PROG filesystem resize 1G "$SCRATCH_MNT" 2>&1 | grep -o "Text file busy" +swapoff "$swapfile" +# It should work again after swapoff. +$BTRFS_UTIL_PROG filesystem resize 1G "$SCRATCH_MNT" | _filter_scratch +_scratch_unmount + +status=0 +exit
tests/btrfs/177.out new file +6 -0
@@ -0,0 +1,6 @@ +QA output created by 177 +Resize 'SCRATCH_MNT' of '2G' +Resize 'SCRATCH_MNT' of '3G' +Resize 'SCRATCH_MNT' of '2G' +Text file busy +Resize 'SCRATCH_MNT' of '1G'
tests/btrfs/group +1 -0
@@ -179,3 +179,4 @@ 174 auto quick swap 175 auto quick swap 176 auto quick swap +177 auto quick swap
Signature · 1 line
2.19.1
Re: [PATCH 7/7] btrfs: test balance and resize with an active swap file
Quoted 50 lines · Omar Sandoval
From: Omar Sandoval <[email protected]>
Make sure we don't shrink the device past an active swap file, but allow shrinking otherwise, as well as growing and balance.
Signed-off-by Omar Sandoval <[email protected]>--- tests/btrfs/177 | 64 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/177.out | 6 +++++ tests/btrfs/group | 1 + 3 files changed, 71 insertions(+) create mode 100755 tests/btrfs/177 create mode 100644 tests/btrfs/177.outtests/btrfs/177 new file +30
-0@@ -0,0 +1,64 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2018 Facebook. All Rights Reserved. +# +# FS QA Test 177 +# +# Test relocation (balance and resize) with an active swap file. +# +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +. ./common/rc +. ./common/filter +. ./common/btrfs + +rm -f $seqres.full + +# Modify as appropriate.
tests/btrfs/177 line 40
Quoted 10 lines
tests/btrfs/177 new file +10
-0+_supported_fs generic +_supported_os Linux +_require_scratch_swapfile + +swapfile="$SCRATCH_MNT/swap" + +# First, create a 1GB filesystem and fill it up. +_scratch_mkfs_sized $((1024 * 1024 * 1024)) >> $seqres.full 2>&1 +_scratch_mount +dd if=/dev/zero of="$SCRATCH_MNT/fill" bs=1024k >> $seqres.full 2>&1
Can this be replaced by fallocate? Though it's just a 1GiB of data, it still takes some seconds on rotational storage.
Quoted 9 lines · Omar Sandoval
From: Omar Sandoval <[email protected]>
This series fixes a couple of generic swapfile tests and adds some Btrfs-specific swapfile tests. Btrfs swapfile support is scheduled for 4.21 [1].
1: https://www.spinics.net/lists/linux-btrfs/msg83454.html
Thanks!
Thanks for the fixes and new tests!
Quoted 4 lines
Omar Sandoval (7):
generic/{472,496,497}: fix $seeqres typo generic/{472,496}: fix swap file creation on Btrfs
I've merged above two patches, they're two obvious bug fixes.
Quoted 5 lines
btrfs: test swap file activation restrictions
btrfs: test invalid operations on a swap file
btrfs: test swap files on multiple devices
btrfs: test device add/remove/replace with an active swap file
btrfs: test balance and resize with an active swap file
These tests look fine to me, but it'd be really great if btrfs folks could help review above tests and provide Reviewed-by tags.
And perhaps we could add test 17[56] to 'volume' group, as they do device operations. And similarly, add the last test to 'balance' group.
Thanks,
Eryu
Quoted 30 lines
tests/btrfs/173 | 55 ++++++++++++++++++++++++++++++ tests/btrfs/173.out | 5 +++ tests/btrfs/174 | 66 ++++++++++++++++++++++++++++++++++++ tests/btrfs/174.out | 10 ++++++ tests/btrfs/175 | 73 ++++++++++++++++++++++++++++++++++++++++ tests/btrfs/175.out | 8 +++++ tests/btrfs/176 | 82 +++++++++++++++++++++++++++++++++++++++++++++ tests/btrfs/176.out | 5 +++ tests/btrfs/177 | 64 +++++++++++++++++++++++++++++++++++ tests/btrfs/177.out | 6 ++++ tests/btrfs/group | 5 +++ tests/generic/472 | 16 ++++----- tests/generic/496 | 8 ++--- tests/generic/497 | 2 +- 14 files changed, 391 insertions(+), 14 deletions(-) create mode 100755 tests/btrfs/173 create mode 100644 tests/btrfs/173.out create mode 100755 tests/btrfs/174 create mode 100644 tests/btrfs/174.out create mode 100755 tests/btrfs/175 create mode 100644 tests/btrfs/175.out create mode 100755 tests/btrfs/176 create mode 100644 tests/btrfs/176.out create mode 100755 tests/btrfs/177 create mode 100644 tests/btrfs/177.outSignature · 1 line
2.19.1
David Sterba
Reviewed-byQuoted 20 lines · Eryu Guan
Quoted 9 lines · Omar Sandoval
From: Omar Sandoval <[email protected]>
This series fixes a couple of generic swapfile tests and adds some Btrfs-specific swapfile tests. Btrfs swapfile support is scheduled for 4.21 [1].
1: https://www.spinics.net/lists/linux-btrfs/msg83454.html
Thanks!
Thanks for the fixes and new tests!
Quoted 4 lines
Omar Sandoval (7):
generic/{472,496,497}: fix $seeqres typo generic/{472,496}: fix swap file creation on BtrfsI've merged above two patches, they're two obvious bug fixes.
Quoted 8 lines
Quoted 5 lines
btrfs: test swap file activation restrictions
btrfs: test invalid operations on a swap file
btrfs: test swap files on multiple devices
btrfs: test device add/remove/replace with an active swap file
btrfs: test balance and resize with an active swap fileThese tests look fine to me, but it'd be really great if btrfs folks could help review above tests and provide Reviewed-by tags.
All look good to me,
A few nits I saw:
- the command names should not be shortened, ie. 'btrfs subvolume snapshot' instead of 'btrfs subvol snap'
- the test description (eg. 3/7 and 4/7) could mention which case is tested, eg. swapfile with compression or COW or snapshot
- 4/7 has typo 'nowcow' in a comment
Quoted 27 lines · David Sterba
Quoted 26 lines · Eryu Guan
Quoted 9 lines · Omar Sandoval
From: Omar Sandoval <[email protected]>
This series fixes a couple of generic swapfile tests and adds some Btrfs-specific swapfile tests. Btrfs swapfile support is scheduled for 4.21 [1].
1: https://www.spinics.net/lists/linux-btrfs/msg83454.html
Thanks!
Thanks for the fixes and new tests!
Quoted 4 lines
Omar Sandoval (7):
generic/{472,496,497}: fix $seeqres typo generic/{472,496}: fix swap file creation on BtrfsI've merged above two patches, they're two obvious bug fixes.
Quoted 5 lines
btrfs: test swap file activation restrictions
btrfs: test invalid operations on a swap file
btrfs: test swap files on multiple devices
btrfs: test device add/remove/replace with an active swap file
btrfs: test balance and resize with an active swap file
Quoted 6 lines
Quoted 2 lines
These tests look fine to me, but it'd be really great if btrfs folks could help review above tests and provide Reviewed-by tags.
All look good to me,
Reviewed-by David Sterba <[email protected]>
Thanks a lot for the review!
Quoted 8 lines
A few nits I saw:
- the command names should not be shortened, ie. 'btrfs subvolume snapshot' instead of 'btrfs subvol snap'
- the test description (eg. 3/7 and 4/7) could mention which case is tested, eg. swapfile with compression or COW or snapshot
- 4/7 has typo 'nowcow' in a comment
I've addressed these nits on commit.
Thanks,
Eryu