Hardcoded subvolids break noholes test runs, so change the test to use _btrfs_get_subvolid instead of assuming 256, 257, etc... Signed-off-by: Boris Burkov <boris@xxxxxx> --- tests/btrfs/301 | 138 ++++++++++++++++++++++++------------------------ 1 file changed, 70 insertions(+), 68 deletions(-) diff --git a/tests/btrfs/301 b/tests/btrfs/301 index 7a0b4c0e1..5bb6b16a6 100755 --- a/tests/btrfs/301 +++ b/tests/btrfs/301 @@ -172,25 +172,27 @@ prepare() _scratch_mount enable_quota "s" $BTRFS_UTIL_PROG subvolume create $subv >> $seqres.full - set_subvol_limit 256 $limit - check_subvol_usage 256 0 + subvid=$(_btrfs_get_subvolid $SCRATCH_MNT subv) + set_subvol_limit $subvid $limit + check_subvol_usage $subvid 0 # Create a bunch of little filler files to generate several levels in # the btree, to make snapshotting sharing scenarios complex enough. $FIO_PROG $prep_fio_config --output=$fio_out - check_subvol_usage 256 $total_fill + check_subvol_usage $subvid $total_fill # Create a single file whose extents we will explicitly share/unshare. do_write $subv/f $ext_sz - check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage $subvid $(($total_fill + $ext_sz)) } prepare_snapshotted() { prepare $BTRFS_UTIL_PROG subvolume snapshot $subv $snap >> $seqres.full - check_subvol_usage 256 $(($total_fill + $ext_sz)) - check_subvol_usage 257 0 + snapid=$(_btrfs_get_subvolid $SCRATCH_MNT snap) + check_subvol_usage $subvid $(($total_fill + $ext_sz)) + check_subvol_usage $snapid 0 } prepare_nested() @@ -198,13 +200,13 @@ prepare_nested() prepare $BTRFS_UTIL_PROG qgroup create 1/100 $SCRATCH_MNT $BTRFS_UTIL_PROG qgroup limit $limit 1/100 $SCRATCH_MNT - $BTRFS_UTIL_PROG qgroup assign 0/256 1/100 $SCRATCH_MNT >> $seqres.full + $BTRFS_UTIL_PROG qgroup assign 0/$subvid 1/100 $SCRATCH_MNT >> $seqres.full $BTRFS_UTIL_PROG subvolume create $nested >> $seqres.full do_write $nested/f $ext_sz - check_subvol_usage 257 $ext_sz - check_subvol_usage 256 $(($total_fill + $ext_sz)) - local subv_usage=$(get_subvol_usage 256) - local nested_usage=$(get_subvol_usage 257) + check_subvol_usage $snapid $ext_sz + check_subvol_usage $subvid $(($total_fill + $ext_sz)) + local subv_usage=$(get_subvol_usage $subvid) + local nested_usage=$(get_subvol_usage $snapid) check_qgroup_usage 1/100 $(($subv_usage + $nested_usage)) } @@ -214,8 +216,8 @@ basic_accounting() echo "basic accounting" prepare rm $subv/f - check_subvol_usage 256 $total_fill - cycle_mount_check_subvol_usage 256 $total_fill + check_subvol_usage $subvid $total_fill + cycle_mount_check_subvol_usage $subvid $total_fill do_write $subv/tmp 512M rm $subv/tmp do_write $subv/tmp 512M @@ -245,19 +247,19 @@ snapshot_accounting() echo "snapshot accounting" prepare_snapshotted touch $snap/f - check_subvol_usage 256 $(($total_fill + $ext_sz)) - check_subvol_usage 257 0 + check_subvol_usage $subvid $(($total_fill + $ext_sz)) + check_subvol_usage $snapid 0 do_write $snap/f $ext_sz - check_subvol_usage 256 $(($total_fill + $ext_sz)) - check_subvol_usage 257 $ext_sz + check_subvol_usage $subvid $(($total_fill + $ext_sz)) + check_subvol_usage $snapid $ext_sz rm $snap/f - check_subvol_usage 256 $(($total_fill + $ext_sz)) - check_subvol_usage 257 0 + check_subvol_usage $subvid $(($total_fill + $ext_sz)) + check_subvol_usage $snapid 0 rm $subv/f - check_subvol_usage 256 $total_fill - check_subvol_usage 257 0 - cycle_mount_check_subvol_usage 256 $total_fill - check_subvol_usage 257 0 + check_subvol_usage $subvid $total_fill + check_subvol_usage $snapid 0 + cycle_mount_check_subvol_usage $subvid $total_fill + check_subvol_usage $snapid 0 _scratch_unmount } @@ -267,14 +269,14 @@ delete_snapshot_src_ref() echo "delete src ref first" prepare_snapshotted rm $subv/f - check_subvol_usage 256 $(($total_fill + $ext_sz)) - check_subvol_usage 257 0 + check_subvol_usage $subvid $(($total_fill + $ext_sz)) + check_subvol_usage $snapid 0 rm $snap/f trigger_cleaner - check_subvol_usage 256 $total_fill - check_subvol_usage 257 0 - cycle_mount_check_subvol_usage 256 $total_fill - check_subvol_usage 257 0 + check_subvol_usage $subvid $total_fill + check_subvol_usage $snapid 0 + cycle_mount_check_subvol_usage $subvid $total_fill + check_subvol_usage $snapid 0 _scratch_unmount } @@ -284,13 +286,13 @@ delete_snapshot_ref() echo "delete snapshot ref first" prepare_snapshotted rm $snap/f - check_subvol_usage 256 $(($total_fill + $ext_sz)) - check_subvol_usage 257 0 + check_subvol_usage $subvid $(($total_fill + $ext_sz)) + check_subvol_usage $snapid 0 rm $subv/f - check_subvol_usage 256 $total_fill - check_subvol_usage 257 0 - cycle_mount_check_subvol_usage 256 $total_fill - check_subvol_usage 257 0 + check_subvol_usage $subvid $total_fill + check_subvol_usage $snapid 0 + cycle_mount_check_subvol_usage $subvid $total_fill + check_subvol_usage $snapid 0 _scratch_unmount } @@ -300,18 +302,18 @@ delete_snapshot_src() echo "delete snapshot src first" prepare_snapshotted $BTRFS_UTIL_PROG subvolume delete $subv >> $seqres.full - check_subvol_usage 256 $(($total_fill + $ext_sz)) - check_subvol_usage 257 0 + check_subvol_usage $subvid $(($total_fill + $ext_sz)) + check_subvol_usage $snapid 0 rm $snap/f trigger_cleaner - check_subvol_usage 256 $total_fill - check_subvol_usage 257 0 + check_subvol_usage $subvid $total_fill + check_subvol_usage $snapid 0 $BTRFS_UTIL_PROG subvolume delete $snap >> $seqres.full trigger_cleaner - check_subvol_usage 256 0 - check_subvol_usage 257 0 - cycle_mount_check_subvol_usage 256 0 - check_subvol_usage 257 0 + check_subvol_usage $subvid 0 + check_subvol_usage $snapid 0 + cycle_mount_check_subvol_usage $subvid 0 + check_subvol_usage $snapid 0 _scratch_unmount } @@ -321,12 +323,12 @@ delete_snapshot() echo "delete snapshot first" prepare_snapshotted $BTRFS_UTIL_PROG subvolume delete $snap >> $seqres.full - check_subvol_usage 256 $(($total_fill + $ext_sz)) - check_subvol_usage 257 0 + check_subvol_usage $subvid $(($total_fill + $ext_sz)) + check_subvol_usage $snapid 0 $BTRFS_UTIL_PROG subvolume delete $subv >> $seqres.full trigger_cleaner - check_subvol_usage 256 0 - check_subvol_usage 257 0 + check_subvol_usage $subvid 0 + check_subvol_usage $snapid 0 _scratch_unmount } @@ -337,16 +339,16 @@ nested_accounting() echo "nested accounting" prepare_nested rm $subv/f - check_subvol_usage 256 $total_fill - check_subvol_usage 257 $ext_sz - local subv_usage=$(get_subvol_usage 256) - local nested_usage=$(get_subvol_usage 257) + check_subvol_usage $subvid $total_fill + check_subvol_usage $snapid $ext_sz + local subv_usage=$(get_subvol_usage $subvid) + local nested_usage=$(get_subvol_usage $snapid) check_qgroup_usage 1/100 $(($subv_usage + $nested_usage)) rm $nested/f - check_subvol_usage 256 $total_fill - check_subvol_usage 257 0 - subv_usage=$(get_subvol_usage 256) - nested_usage=$(get_subvol_usage 257) + check_subvol_usage $subvid $total_fill + check_subvol_usage $snapid 0 + subv_usage=$(get_subvol_usage $subvid) + nested_usage=$(get_subvol_usage $snapid) check_qgroup_usage 1/100 $(($subv_usage + $nested_usage)) do_enospc_falloc $nested/large_falloc 2G do_enospc_write $nested/large 2G @@ -365,21 +367,21 @@ enable_mature() # we did before enabling. sync enable_quota "s" - set_subvol_limit 256 $limit + set_subvol_limit $subvid $limit _scratch_cycle_mount - usage=$(get_subvol_usage 256) + usage=$(get_subvol_usage $subvid) [ $usage -lt $ext_sz ] || \ echo "captured usage from before enable $usage >= $ext_sz" do_write $subv/g $ext_sz - usage=$(get_subvol_usage 256) + usage=$(get_subvol_usage $subvid) [ $usage -lt $ext_sz ] && \ echo "failed to capture usage after enable $usage < $ext_sz" - check_subvol_usage 256 $ext_sz + check_subvol_usage $subvid $ext_sz rm $subv/f - check_subvol_usage 256 $ext_sz + check_subvol_usage $subvid $ext_sz _scratch_cycle_mount rm $subv/g - check_subvol_usage 256 0 + check_subvol_usage $subvid 0 _scratch_unmount } @@ -394,7 +396,7 @@ reflink_accounting() _cp_reflink $subv/f $subv/f.i done # Confirm that there is no additional data usage from the reflinks. - check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage $subvid $(($total_fill + $ext_sz)) _scratch_unmount } @@ -404,11 +406,11 @@ delete_reflink_src_ref() echo "delete reflink src ref" prepare _cp_reflink $subv/f $subv/f.link - check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage $subvid $(($total_fill + $ext_sz)) rm $subv/f - check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage $subvid $(($total_fill + $ext_sz)) rm $subv/f.link - check_subvol_usage 256 $(($total_fill)) + check_subvol_usage $subvid $(($total_fill)) _scratch_unmount } @@ -418,11 +420,11 @@ delete_reflink_ref() echo "delete reflink ref" prepare _cp_reflink $subv/f $subv/f.link - check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage $subvid $(($total_fill + $ext_sz)) rm $subv/f.link - check_subvol_usage 256 $(($total_fill + $ext_sz)) + check_subvol_usage $subvid $(($total_fill + $ext_sz)) rm $subv/f - check_subvol_usage 256 $(($total_fill)) + check_subvol_usage $subvid $(($total_fill)) _scratch_unmount } -- 2.42.0