File tree 1 file changed +44
-0
lines changed
tests/misc-tests/058-replace-start-enqueue
1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Check that an enqueued replace over another replace will wait
3
+
4
+ source " $TEST_TOP /common" || exit
5
+
6
+ check_prereq mkfs.btrfs
7
+ check_prereq btrfs
8
+
9
+ setup_root_helper
10
+ setup_loopdevs 6
11
+ prepare_loopdevs
12
+
13
+ TEST_DEV=${loopdevs[1]}
14
+ REPLACE1=${loopdevs[6]}
15
+ REPLACE2=${loopdevs[5]}
16
+
17
+ # Use striped profile so all devices are at least partially filled
18
+ run_check $SUDO_HELPER " $TOP /mkfs.btrfs" -f -d raid0 -m raid0 " ${loopdevs[@]} "
19
+ run_check_mount_test_dev
20
+ # Remove the devices and then use them for replace
21
+ run_check $SUDO_HELPER " $TOP /btrfs" device remove " $REPLACE1 " " $TEST_MNT "
22
+ run_check $SUDO_HELPER " $TOP /btrfs" device remove " $REPLACE2 " " $TEST_MNT "
23
+
24
+ for i in ` seq 48` ; do
25
+ run_check $SUDO_HELPER dd if=/dev/zero of=" $TEST_MNT /file$i " bs=1M count=128 status=noxfer
26
+ done
27
+ # Sync so replace start does not block in unwritten IO
28
+ run_check " $TOP /btrfs" filesystem sync " $TEST_MNT "
29
+ run_check " $TOP /btrfs" filesystem usage -T " $TEST_MNT "
30
+
31
+ # Go background, should not be that fast, estimated 10 seconds
32
+ run_check $SUDO_HELPER " $TOP /btrfs" replace start 2 " $REPLACE1 " " $TEST_MNT "
33
+ run_check sleep 1
34
+ # No background, should wait
35
+ run_check $SUDO_HELPER " $TOP /btrfs" replace start --enqueue 3 " $REPLACE2 " " $TEST_MNT "
36
+ run_check $SUDO_HELPER " $TOP /btrfs" replace status " $TEST_MNT "
37
+
38
+ run_check " $TOP /btrfs" filesystem sync " $TEST_MNT "
39
+ run_check " $TOP /btrfs" filesystem usage -T " $TEST_MNT "
40
+ run_check $SUDO_HELPER " $TOP /btrfs" replace status " $TEST_MNT "
41
+
42
+ run_check_umount_test_dev
43
+
44
+ cleanup_loopdevs
You can’t perform that action at this time.
0 commit comments