btrfs-progs: test: add simple test for defrag recursion depth
The documentation lacks clarity about depth to which recursive defragmentation go, and was pointed out by a user. The problem here is that the subvolume behaves the same as mount point regarding path traversal. The nftw stops on mount boundary (FTW_MOUNT). Add test that verifies this behaviour. Defrag has to be updated to allow descending to subvolumes (and not mountpoints). Issue: #185 Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
064341dca9
commit
88f4bcb351
|
@ -16,7 +16,7 @@ and metadata blocks from all devices and verify checksums. Automatically repair
|
||||||
corrupted blocks if there's a correct copy available.
|
corrupted blocks if there's a correct copy available.
|
||||||
|
|
||||||
NOTE: Scrub is not a filesystem checker (fsck) and does not verify nor repair
|
NOTE: Scrub is not a filesystem checker (fsck) and does not verify nor repair
|
||||||
structural damage in the filesystem. It really only checks checksums of of data
|
structural damage in the filesystem. It really only checks checksums of data
|
||||||
and tree blocks, it doesn't ensure the content of tree blocks is valid and
|
and tree blocks, it doesn't ensure the content of tree blocks is valid and
|
||||||
consistent. There's some validation performed when metadata blocks are read
|
consistent. There's some validation performed when metadata blocks are read
|
||||||
from disk but it's not extensive and cannot substitute full 'btrfs check' run.
|
from disk but it's not extensive and cannot substitute full 'btrfs check' run.
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# check how deep does recursive defrag go, currently it has to stop at
|
||||||
|
# mountpoint and subvolume boundary, ie. only the first file should
|
||||||
|
# appear in the list of processed files
|
||||||
|
|
||||||
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
|
check_prereq mkfs.btrfs
|
||||||
|
check_prereq btrfs
|
||||||
|
|
||||||
|
setup_root_helper
|
||||||
|
prepare_test_dev
|
||||||
|
|
||||||
|
run_check_mkfs_test_dev
|
||||||
|
run_check_mount_test_dev
|
||||||
|
|
||||||
|
run_check $SUDO_HELPER dd if=/dev/zero bs=1M count=10 of="$TEST_MNT"/file1
|
||||||
|
run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$TEST_MNT"/subv1
|
||||||
|
run_check $SUDO_HELPER dd if=/dev/zero bs=1M count=10 of="$TEST_MNT"/subv1/file2
|
||||||
|
run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot "$TEST_MNT"/subv1 "$TEST_MNT"/snap1
|
||||||
|
run_check $SUDO_HELPER dd if=/dev/zero bs=1M count=10 of="$TEST_MNT"/snap1/file3
|
||||||
|
|
||||||
|
run_check $SUDO_HELPER find "$TEST_MNT"
|
||||||
|
run_check_stdout $SUDO_HELPER "$TOP/btrfs" filesystem defrag -v -r "$TEST_MNT" |
|
||||||
|
grep -q 'file[23]' && _fail "recursive defrag went to subvolumes"
|
||||||
|
|
||||||
|
run_check_umount_test_dev
|
Loading…
Reference in New Issue