Re: [PATCH v2] btrfs: Test proper interaction between skip_balance and paused balance

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]




  * Extended the test to ensure all exclusive ops are forbidden apart from device
  add. >   * Also ensures exclusive ops are still forbidden following device add


+_begin_fstest quick balance auto
+
+# real QA test starts here
+
+_supported_fs btrfs
+_require_scratch_dev_pool 3
+
+external_device=$(echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $3}')

 Pls use _spare_dev_get().
 Because _scratch_dev_pool_get() can change devices it gets.

+
+_scratch_dev_pool_get 2
+
+_scratch_pool_mkfs >/dev/null
+_scratch_mount
+
+check_exclusive_ops()
+{
+	$BTRFS_UTIL_PROG device remove 2 $SCRATCH_MNT &>/dev/null
+	[ $? -ne 0 ] || _fail "Successfully removed device"
+	$BTRFS_UTIL_PROG filesystem resize -5m $SCRATCH_MNT &> /dev/null
+	[ $? -ne 0 ] || _fail "Successfully resized filesystem"
+	$BTRFS_UTIL_PROG replace start -B 2 $external_device $SCRATCH_MNT &> /dev/null
+	[ $? -ne 0 ] || _fail "Successfully replaced device"

 Also, add the exclusive ops swap activate.
 We had a couple of bugs with excl-ops with swap earlier.

+}
+
+uuid=$(findmnt -n -o UUID $SCRATCH_MNT)
+
+# Create some files on the so that balance doesn't complete instantly
+args=`_scale_fsstress_args -z \
+	-f write=10 -f creat=10 \
+	-n 1000 -p 2 -d $SCRATCH_MNT/stress_dir`
+echo "Run fsstress $args" >>$seqres.full
+$FSSTRESS_PROG $args >/dev/null 2>&1
+
+# Start and pause balance to ensure it will be restored on remount
+echo "Start balance" >>$seqres.full
+_run_btrfs_balance_start --bg "$SCRATCH_MNT"
+$BTRFS_UTIL_PROG balance pause "$SCRATCH_MNT"

Here it depends on the synchronizations between the balance start and the pause.
Pls, use btrfs balance status to check if the pause is successful.
Then call _fail("Couldn't pause balance on this system") if it isn't. Which is better than letting the further of the commands to fail.




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux