Skip to contentSkip to conversation

btrfs/150: add _scratch_dev_pool_get/put to run the test as expected

PATCH In review Misono, Tomohiro 2 participants 2 messages Feb 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs/150: add _scratch_dev_pool_get/put to run the test as expected

btrfs/150 uses RAID1 profile and make SCRATCH_DEV fail for test. However, if SCRATCH_DEV_POOL consists more than two devices, SCRATCH_DEV may not be used for RAID1 pair and the tests may not run as expected.

Fix this by add _scratch_dev_pool_get/put like other tests (141, 143 etc.) do.

---
 tests/btrfs/150 | 2 ++
 1 file changed, 2 insertions(+)
tests/btrfs/150 +2 -0
index 97041b6c..1e4586be 100755
@@ -55,6 +55,7 @@ _supported_os Linux
 _require_scratch
 _require_fail_make_request
 _require_scratch_dev_pool 2
+_scratch_dev_pool_get 2
 
 SYSFS_BDEV=`_sysfs_dev $SCRATCH_DEV`
 enable_io_failure()
@@ -100,6 +101,7 @@ while [[ -z $result ]]; do
 	disable_io_failure
 done
 
+_scratch_dev_pool_put
 # success, all done
 status=0
 exit
Signature · 1 line
2.14.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Tomohiro

btrfs/150 uses RAID1 profile and make SCRATCH_DEV fail for test. However, if SCRATCH_DEV_POOL consists more than two devices, SCRATCH_DEV may not be used for RAID1 pair and the tests may not run as expected.

Fix this by add _scratch_dev_pool_get/put like other tests (141, 143 etc.) do.

Indeed, if we have more devices, it's highly possible that the first device doesn't have data stripe of the raid1 chunk on it.

(And under most case it won't have data stripe, since during mkfs we use the first device to contain temporary chunks, so unallocated space of devid 1 is smaller compared to other devices, and chunk allocator will use device with more unallocated space)

Thanks,
Qu

Quoted 25 lines
---
 tests/btrfs/150 | 2 ++
 1 file changed, 2 insertions(+)
tests/btrfs/150 +2 -0
index 97041b6c..1e4586be 100755
@@ -55,6 +55,7 @@ _supported_os Linux
 _require_scratch
 _require_fail_make_request
 _require_scratch_dev_pool 2
+_scratch_dev_pool_get 2
 
 SYSFS_BDEV=`_sysfs_dev $SCRATCH_DEV`
 enable_io_failure()
@@ -100,6 +101,7 @@ while [[ -z $result ]]; do
 	disable_io_failure
 done
 
+_scratch_dev_pool_put
 # success, all done
 status=0
 exit