Refactor *_fs_sysfs_* helpers
cover Refactor *_fs_sysfs_* helpers
As we talked in:
https://lore.kernel.org/fstests/amhKovVDjwawoWdQ@zlang-mailbox/
This patchset refactors two redundant and messy sets of *_fs_sysfs_* helpers (PATCH 1/5 2/5), introduces helpers for /sys/fs/$FSTYP/features (PATCH 3/5 4/5), and replaces the original btrfs-specific helpers with these common ones (PATCH 5/5).
Thanks,
Zorro
Zorro Lang (5):
fstests: consolidate _require_fs_sysfs and _require_fs_sysfs_attr common/sysfs: adjust function naming
common/rc: add helpers for /sys/fs/$FSTYP/features/ common/rc: use common helper in _require_fanotify_ioerrors for f2fs
fstests: replace btrfs specific helpers with common sysfs helpers
common/btrfs | 41 ++---------------- common/rc | 103 ++++++++++++++++++++++++++++++++-------------- common/sysfs | 72 ++++++++++++++++---------------- common/xfs | 22 +++++----- tests/btrfs/010 | 3 +- tests/btrfs/055 | 2 +- tests/btrfs/056 | 2 +- tests/btrfs/112 | 2 +- tests/btrfs/131 | 2 +- tests/btrfs/165 | 2 +- tests/btrfs/188 | 2 +- tests/btrfs/192 | 2 +- tests/btrfs/201 | 2 +- tests/btrfs/205 | 2 +- tests/btrfs/209 | 2 +- tests/btrfs/211 | 2 +- tests/btrfs/219 | 3 +- tests/btrfs/231 | 2 +- tests/btrfs/253 | 28 ++++++------- tests/btrfs/285 | 3 +- tests/btrfs/296 | 8 +--- tests/btrfs/304 | 4 +- tests/btrfs/305 | 4 +- tests/btrfs/306 | 4 +- tests/btrfs/307 | 4 +- tests/btrfs/308 | 4 +- tests/btrfs/311 | 2 +- tests/btrfs/313 | 2 +- tests/btrfs/314 | 2 +- tests/btrfs/315 | 2 +- tests/btrfs/329 | 4 +- tests/btrfs/334 | 4 +- tests/btrfs/342 | 2 +- tests/btrfs/352 | 2 +- tests/f2fs/025 | 2 +- tests/generic/098 | 2 +- tests/generic/101 | 2 +- tests/xfs/006 | 4 +- tests/xfs/177 | 4 +- tests/xfs/264 | 14 +++---- tests/xfs/668 | 6 +-- tests/xfs/669 | 6 +-- tests/xfs/670 | 2 +- 43 files changed, 194 insertions(+), 195 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/5 fstests: consolidate _require_fs_sysfs and _require_fs_sysfs_attr
There is heavy overlap between _require_fs_sysfs and _require_fs_sysfs_attr, and their ambiguous names make it difficult to tell them apart.
So merge them into a single function with "_dev_" included in the name to distinguish per-device entries from other paths like /sys/fs/$FSTYP/features/.
--- common/btrfs | 4 +-- common/rc | 70 ++++++++++++++++++++----------------------------- common/sysfs | 6 ++--- common/xfs | 22 ++++++++-------- tests/btrfs/253 | 26 +++++++++--------- tests/btrfs/285 | 2 +- tests/btrfs/334 | 2 +- tests/f2fs/025 | 2 +- tests/xfs/006 | 4 +-- tests/xfs/177 | 4 +-- tests/xfs/264 | 14 +++++----- tests/xfs/668 | 6 ++--- tests/xfs/669 | 6 ++--- tests/xfs/670 | 2 +- 14 files changed, 78 insertions(+), 92 deletions(-)
common/btrfs +2 -2
@@ -903,8 +903,8 @@ _qgroup_mode() _fail "Usage: _qgroup_mode <mounted_device>" fi - if _has_fs_sysfs_attr $dev /qgroups/mode; then - _get_fs_sysfs_attr $dev qgroups/mode + if _has_fs_sysfs_dev_attr $dev /qgroups/mode; then + _get_fs_sysfs_dev_attr $dev qgroups/mode else echo "qgroup" fi
common/rc +28 -42
128 lines not on this page · raw message
common/sysfs +3 -3
@@ -61,11 +61,11 @@ _set_sysfs_policy() shift local policy=$@ - _set_fs_sysfs_attr $dev $attr ${policy} + _set_fs_sysfs_dev_attr $dev $attr ${policy} case "$FSTYP" in btrfs) - _get_fs_sysfs_attr $dev $attr | grep -q "[${policy}]" + _get_fs_sysfs_dev_attr $dev $attr | grep -q "[${policy}]" if [[ $? != 0 ]]; then echo "Setting sysfs $attr $policy failed" fi
@@ -85,7 +85,7 @@ _set_sysfs_policy_must_fail() shift local policy=$@ - _set_fs_sysfs_attr $dev $attr ${policy} | _filter_sysfs_error \ + _set_fs_sysfs_dev_attr $dev $attr ${policy} | _filter_sysfs_error \ | tee -a $seqres.full }
common/xfs +11 -11
@@ -1167,23 +1167,23 @@ _reset_xfs_sysfs_error_handling() _fail "Usage: reset_xfs_sysfs_error_handling <device>" fi - _set_fs_sysfs_attr $dev error/fail_at_unmount 1 + _set_fs_sysfs_dev_attr $dev error/fail_at_unmount 1 echo -n "error/fail_at_unmount=" - _get_fs_sysfs_attr $dev error/fail_at_unmount + _get_fs_sysfs_dev_attr $dev error/fail_at_unmount # Make sure all will be configured to retry forever by default, except # for ENODEV, which is an unrecoverable error, so it will be configured # to not retry on error by default. for e in default EIO ENOSPC; do - _set_fs_sysfs_attr $dev \ + _set_fs_sysfs_dev_attr $dev \ error/metadata/${e}/max_retries -1 echo -n "error/metadata/${e}/max_retries=" - _get_fs_sysfs_attr $dev error/metadata/${e}/max_retries + _get_fs_sysfs_dev_attr $dev error/metadata/${e}/max_retries - _set_fs_sysfs_attr $dev \ + _set_fs_sysfs_dev_attr $dev \ error/metadata/${e}/retry_timeout_seconds -1 echo -n "error/metadata/${e}/retry_timeout_seconds=" - _get_fs_sysfs_attr $dev \ + _get_fs_sysfs_dev_attr $dev \ error/metadata/${e}/retry_timeout_seconds done }
@@ -1226,13 +1226,13 @@ _xfs_prepare_for_eio_shutdown() _add_dmesg_filter "Internal error" # Don't retry any writes during the (presumably) post-shutdown unmount - _has_fs_sysfs "$ctlfile" && _set_fs_sysfs_attr $dev "$ctlfile" 1 + _has_fs_sysfs_dev_attr $dev "$ctlfile" && _set_fs_sysfs_dev_attr $dev "$ctlfile" 1 # Disable retry of metadata writes that fail with EIO for ctl in max_retries retry_timeout_seconds; do ctlfile="error/metadata/EIO/$ctl" - _has_fs_sysfs "$ctlfile" && _set_fs_sysfs_attr $dev "$ctlfile" 0 + _has_fs_sysfs_dev_attr $dev "$ctlfile" && _set_fs_sysfs_dev_attr $dev "$ctlfile" 0 done }
@@ -2146,7 +2146,7 @@ _scratch_xfs_force_no_metadir() # do not run on zoned file systems _require_xfs_scratch_non_zoned() { - if _has_fs_sysfs_attr $SCRATCH_DEV "zoned/max_open_zones"; then + if _has_fs_sysfs_dev_attr $SCRATCH_DEV "zoned/max_open_zones"; then _notrun "Not supported on zoned file systems" fi }
@@ -2157,12 +2157,12 @@ _require_xfs_scratch_zoned() local attr="zoned/max_open_zones" local min_open_zones=$1 - if ! _has_fs_sysfs_attr $SCRATCH_DEV $attr; then + if ! _has_fs_sysfs_dev_attr $SCRATCH_DEV $attr; then _notrun "Requires zoned file system" fi if [ -n "${min_open_zones}" ]; then - local has_open_zones=`_get_fs_sysfs_attr $SCRATCH_DEV $attr` + local has_open_zones=`_get_fs_sysfs_dev_attr $SCRATCH_DEV $attr` if [ "${min_open_zones}" -gt "${has_open_zones}" ]; then _notrun "Requires at least ${min_open_zones} open zones"
tests/btrfs/253 +13 -13
@@ -90,8 +90,8 @@ _scratch_mkfs_sized $((10 * 1024 * 1024 * 1024)) >> $seqres.full 2>&1 _scratch_mount >> $seqres.full 2>&1 # Check if there is sufficient sysfs support. -_require_fs_sysfs allocation/metadata/chunk_size -_require_fs_sysfs allocation/metadata/force_chunk_alloc +_require_fs_sysfs_dev_attr allocation/metadata/chunk_size +_require_fs_sysfs_dev_attr allocation/metadata/force_chunk_alloc # Get free space. free_space FREE_SPACE_MB
@@ -119,7 +119,7 @@ FIRST_DATA_CHUNK_SIZE_B=$((1024 * 1024 * 1024)) # For metadata, we are safe to use the exported value, as the default # metadata chunk size limit is already smaller than its stripe size. -FIRST_METADATA_CHUNK_SIZE_B=$(_get_fs_sysfs_attr ${SCRATCH_BDEV} allocation/metadata/chunk_size) +FIRST_METADATA_CHUNK_SIZE_B=$(_get_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/metadata/chunk_size) echo "Orig Data chunk size = ${FIRST_DATA_CHUNK_SIZE_B}" >> ${seqres}.full echo "Orig Metaata chunk size = ${FIRST_METADATA_CHUNK_SIZE_B}" >> ${seqres}.full
@@ -138,8 +138,8 @@ alloc_size "Metadata" METADATA_SIZE_START_MB echo "Block group Data alloc size = ${DATA_SIZE_START_MB}MB" >> $seqres.full echo "Block group Metadata alloc size = ${METADATA_SIZE_START_MB}MB" >> $seqres.full -_set_fs_sysfs_attr ${SCRATCH_BDEV} allocation/data/force_chunk_alloc 1 -_set_fs_sysfs_attr ${SCRATCH_BDEV} allocation/metadata/force_chunk_alloc 1 +_set_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/data/force_chunk_alloc 1 +_set_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/metadata/force_chunk_alloc 1 alloc_size "Data" FIRST_DATA_SIZE_MB alloc_size "Metadata" FIRST_METADATA_SIZE_MB
@@ -171,15 +171,15 @@ fi echo "Second block group Data alloc size = ${SECOND_DATA_CHUNK_SIZE_B}" >> $seqres.full echo "Second block group Metadata alloc size = ${SECOND_METADATA_CHUNK_SIZE_B}" >> $seqres.full -_set_fs_sysfs_attr ${SCRATCH_BDEV} allocation/data/chunk_size ${SECOND_DATA_CHUNK_SIZE_B} -_set_fs_sysfs_attr ${SCRATCH_BDEV} allocation/metadata/chunk_size ${SECOND_METADATA_CHUNK_SIZE_B} +_set_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/data/chunk_size ${SECOND_DATA_CHUNK_SIZE_B} +_set_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/metadata/chunk_size ${SECOND_METADATA_CHUNK_SIZE_B} -SECOND_DATA_CHUNK_SIZE_READ_B=$(_get_fs_sysfs_attr ${SCRATCH_BDEV} allocation/data/chunk_size) -SECOND_METADATA_CHUNK_SIZE_READ_B=$(_get_fs_sysfs_attr ${SCRATCH_BDEV} allocation/metadata/chunk_size) +SECOND_DATA_CHUNK_SIZE_READ_B=$(_get_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/data/chunk_size) +SECOND_METADATA_CHUNK_SIZE_READ_B=$(_get_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/metadata/chunk_size) -_set_fs_sysfs_attr ${SCRATCH_BDEV} allocation/data/force_chunk_alloc 1 +_set_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/data/force_chunk_alloc 1 echo "Allocated data chunk" >> $seqres.full -_set_fs_sysfs_attr ${SCRATCH_BDEV} allocation/metadata/force_chunk_alloc 1 +_set_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/metadata/force_chunk_alloc 1 echo "Allocated metadata chunk" >> $seqres.full alloc_size "Data" SECOND_DATA_SIZE_MB
@@ -210,12 +210,12 @@ echo "Allocation size in bytes = ${THIRD_DATA_CHUNK_SIZE_B}" >> ${seqres}.full # Do allocation until free space is exhausted. # echo "Third allocation." -_set_fs_sysfs_attr ${SCRATCH_BDEV} allocation/data/chunk_size ${THIRD_DATA_CHUNK_SIZE_B} +_set_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/data/chunk_size ${THIRD_DATA_CHUNK_SIZE_B} free_space FREE_SPACE_MB while [ $FREE_SPACE_MB -gt $THIRD_DATA_CHUNK_SIZE_MB ]; do alloc_size "Data" THIRD_DATA_SIZE_MB - _set_fs_sysfs_attr ${SCRATCH_BDEV} allocation/data/force_chunk_alloc 1 + _set_fs_sysfs_dev_attr ${SCRATCH_BDEV} allocation/data/force_chunk_alloc 1 free_space FREE_SPACE_MB done
tests/btrfs/285 +1 -1
@@ -16,7 +16,7 @@ sysfs_size_classes() { _require_scratch _require_btrfs_fs_sysfs -_require_fs_sysfs allocation/data/size_classes +_require_fs_sysfs_dev_attr allocation/data/size_classes f="$SCRATCH_MNT/f" small=$((16 * 1024))
tests/btrfs/334 +1 -1
@@ -13,7 +13,7 @@ _begin_fstest auto quick . ./common/filter _require_test -_require_fs_sysfs_attr $TEST_DEV allocation/data/chunk_size +_require_fs_sysfs_dev_attr $TEST_DEV allocation/data/chunk_size _verify_sysfs_syntax $TEST_DEV allocation/data/chunk_size 256m
tests/f2fs/025 +1 -1
@@ -21,7 +21,7 @@ _require_scratch_shutdown _require_xfs_io_command "pwrite" _require_xfs_io_command "truncate" _require_f2fs_io_command gc_urgent -_require_fs_sysfs_attr $TEST_DEV gc_urgent +_require_fs_sysfs_dev_attr $TEST_DEV gc_urgent _require_check_dmesg # Clear options to avoid interference from external configurations
tests/xfs/006 +2 -2
@@ -25,7 +25,7 @@ _cleanup() _require_scratch _require_dm_target error -_require_fs_sysfs error/fail_at_unmount +_require_fs_sysfs_dev_attr error/fail_at_unmount _scratch_mkfs > $seqres.full 2>&1 _dmerror_init
@@ -38,7 +38,7 @@ _reset_xfs_sysfs_error_handling $DMERROR_DEV # errors at unmount time. _fail the test if we fail to set it to 1, # because the test probably will hang in such case and block # subsequent tests. -attr=`_get_fs_sysfs_attr $DMERROR_DEV error/fail_at_unmount` +attr=`_get_fs_sysfs_dev_attr $DMERROR_DEV error/fail_at_unmount` if [ "$attr" != "1" ]; then _fail "Failed to set error/fail_at_unmount: $attr" fi
tests/xfs/177 +2 -2
@@ -48,10 +48,10 @@ _require_scratch # We require /sys/fs/xfs/$device/stats/stats to monitor per-filesystem inode # cache usage. -_require_fs_sysfs stats/stats +_require_fs_sysfs_dev_attr stats/stats count_xfs_inode_objs() { - _get_fs_sysfs_attr $SCRATCH_DEV stats/stats | awk '/vnodes/ {print $2}' + _get_fs_sysfs_dev_attr $SCRATCH_DEV stats/stats | awk '/vnodes/ {print $2}' } dump_debug_info() {
tests/xfs/264 +7 -7
@@ -24,9 +24,9 @@ _cleanup() _require_scratch _require_dm_target error -_require_fs_sysfs error/fail_at_unmount -_require_fs_sysfs error/metadata/EIO/max_retries -_require_fs_sysfs error/metadata/EIO/retry_timeout_seconds +_require_fs_sysfs_dev_attr error/fail_at_unmount +_require_fs_sysfs_dev_attr error/metadata/EIO/max_retries +_require_fs_sysfs_dev_attr error/metadata/EIO/retry_timeout_seconds _scratch_mkfs >> $seqres.full 2>&1 _dmerror_init
@@ -39,12 +39,12 @@ do_test() _dmerror_mount _reset_xfs_sysfs_error_handling $DMERROR_DEV # Disable fail_at_unmount before test EIO error handling - _set_fs_sysfs_attr $DMERROR_DEV error/fail_at_unmount 0 + _set_fs_sysfs_dev_attr $DMERROR_DEV error/fail_at_unmount 0 echo -n "error/fail_at_unmount=" - _get_fs_sysfs_attr $DMERROR_DEV error/fail_at_unmount + _get_fs_sysfs_dev_attr $DMERROR_DEV error/fail_at_unmount - _set_fs_sysfs_attr $DMERROR_DEV $attr 1 - num=`_get_fs_sysfs_attr $DMERROR_DEV $attr` + _set_fs_sysfs_dev_attr $DMERROR_DEV $attr 1 + num=`_get_fs_sysfs_dev_attr $DMERROR_DEV $attr` echo "$attr=$num" # _fail the test if we fail to set $attr to 1, because the test # probably will hang in such case and block subsequent tests.
tests/xfs/668 +3 -3
@@ -36,7 +36,7 @@ done # remount read-only and set the gc limit to free up unused space _scratch_remount ro rt_available_pre="$(_xfs_get_user_available_rt_blocks "$SCRATCH_MNT")" -_set_fs_sysfs_attr $SCRATCH_DEV "zoned/zonegc_low_space" 100 +_set_fs_sysfs_dev_attr $SCRATCH_DEV "zoned/zonegc_low_space" 100 # reclaiming a zone with 5% used blocks should take way less than 1 second sleep 1
@@ -46,14 +46,14 @@ rt_available_post="$(_xfs_get_user_available_rt_blocks "$SCRATCH_MNT")" [ "$rt_available_post" -gt "$rt_available_pre" ] && \ _fail "gc should not run while read only" -_set_fs_sysfs_attr $SCRATCH_DEV "zoned/zonegc_low_space" 0 +_set_fs_sysfs_dev_attr $SCRATCH_DEV "zoned/zonegc_low_space" 0 # remount rw and check that gc starts, frees up blocks and stops after # the threshold is set to reclaim the unused blocks _scratch_remount rw rt_available_pre="$(_xfs_get_user_available_rt_blocks "$SCRATCH_MNT")" -_set_fs_sysfs_attr $SCRATCH_DEV "zoned/zonegc_low_space" 100 +_set_fs_sysfs_dev_attr $SCRATCH_DEV "zoned/zonegc_low_space" 100 i=0 while [ $(_xfs_get_rt_gc_required "$SCRATCH_MNT") -eq "1" ]; do
tests/xfs/669 +3 -3
@@ -35,7 +35,7 @@ $MKFS_XFS_PROG -b size=${bsize} -r zoned=1,rgsize=${blocks}b \ _mount $SCRATCH_DEV $SCRATCH_MNT -o max_open_zones=${open_zones} || \ _notrun "Zoned allocator not supported" -_has_fs_sysfs_attr $SCRATCH_DEV zoned/nr_open_zones || \ +_has_fs_sysfs_dev_attr $SCRATCH_DEV zoned/nr_open_zones || \ _notrun "This test requires /sys/fs/${FSTYP}/$SCRATCH_DEV/zoned/nr_open_zones" for i in $(seq 1 $nr_files); do
@@ -51,8 +51,8 @@ done _scratch_unmount _mount $SCRATCH_DEV $SCRATCH_MNT -o max_open_zones=${open_zones} -max_open=$(_get_fs_sysfs_attr $SCRATCH_DEV zoned/max_open_zones) -nr_open=$(_get_fs_sysfs_attr $SCRATCH_DEV zoned/nr_open_zones) +max_open=$(_get_fs_sysfs_dev_attr $SCRATCH_DEV zoned/max_open_zones) +nr_open=$(_get_fs_sysfs_dev_attr $SCRATCH_DEV zoned/nr_open_zones) if [ ${max_open} -ne $((open_zones - 1)) ]; then _fail "Test needs adjustments for multiple open GC zones"
tests/xfs/670 +1 -1
@@ -36,7 +36,7 @@ $XFS_GROWFS_PROG $SCRATCH_MNT -R $((2 * rblocks)) >> $seqres.full 2>&1 || \ # For zoned file systems, check that the growfs did increase the available free # zones. This avoids a hang on unfixed kernels when filling later. free_zones_post=$(_xfs_get_mountstat $SCRATCH_MNT "free zones:") -if _has_fs_sysfs_attr $SCRATCH_DEV "zoned/max_open_zones"; then +if _has_fs_sysfs_dev_attr $SCRATCH_DEV "zoned/max_open_zones"; then if [ "$free_zones_pre" == "$free_zones_post" ]; then _fail "growfs did not increase free zones" fi
Signature · 1 line
2.55.0
PATCH 2/5 common/sysfs: adjust function naming
In reply to Zorro LangAdd the _dev_ infix to helper functions associated with /sys/fs/$FSTYP/<devices> to distinguish them from upcoming /sys/fs/$FSTYP/features/ related helpers.
--- common/sysfs | 66 ++++++++++++++++++++++++------------------------- tests/btrfs/253 | 2 +- tests/btrfs/329 | 4 +-- tests/btrfs/334 | 2 +- 4 files changed, 37 insertions(+), 37 deletions(-)
common/sysfs +33 -33
@@ -12,8 +12,8 @@ # - policy: policy within /sys/fs/$FSTYP/$dev # # Usage example: -# _has_fs_sysfs_attr_policy /dev/mapper/scratch-dev read_policy round-robin -_has_fs_sysfs_attr_policy() +# _has_fs_sysfs_dev_policy /dev/mapper/scratch-dev read_policy round-robin +_has_fs_sysfs_dev_policy() { local dev=$1 local attr=$2
@@ -21,7 +21,7 @@ _has_fs_sysfs_attr_policy() if [ ! -b "$dev" -o -z "$attr" -o -z "$policy" ]; then _fail \ - "Usage: _has_fs_sysfs_attr_policy <mounted_device> <attr> <policy>" + "Usage: _has_fs_sysfs_dev_policy <mounted_device> <attr> <policy>" fi local dname=$(_fs_sysfs_dname $dev)
@@ -40,10 +40,10 @@ _has_fs_sysfs_attr_policy() # - policy: mentioned in /sys/fs/$FSTYP/$dev/$attr # # Usage example: -# _require_fs_sysfs_attr_policy /dev/mapper/scratch-dev read_policy round-robin -_require_fs_sysfs_attr_policy() +# _require_fs_sysfs_dev_policy /dev/mapper/scratch-dev read_policy round-robin +_require_fs_sysfs_dev_policy() { - _has_fs_sysfs_attr_policy "$@" && return + _has_fs_sysfs_dev_policy "$@" && return local dev=$1 local attr=$2
@@ -53,7 +53,7 @@ _require_fs_sysfs_attr_policy() _notrun "This test requires /sys/fs/${FSTYP}/${dname}/${attr} ${policy}" } -_set_sysfs_policy() +_set_sysfs_dev_policy() { local dev=$1 local attr=$2
@@ -77,7 +77,7 @@ _set_sysfs_policy() esac } -_set_sysfs_policy_must_fail() +_set_sysfs_dev_policy_must_fail() { local dev=$1 local attr=$2
@@ -91,18 +91,18 @@ _set_sysfs_policy_must_fail() # Verify sysfs attribute rejects invalid input. # Usage syntax: -# _verify_sysfs_syntax <$dev> <$attr> <$policy> [$value] +# _verify_sysfs_dev_syntax <$dev> <$attr> <$policy> [$value] # Examples: -# _verify_sysfs_syntax $TEST_DEV read_policy pid -# _verify_sysfs_syntax $TEST_DEV read_policy round-robin 4k +# _verify_sysfs_dev_syntax $TEST_DEV read_policy pid +# _verify_sysfs_dev_syntax $TEST_DEV read_policy round-robin 4k # Note: # Testcase must include # . ./common/filter # Prerequisite checks are kept outside this function # to make them clear to the test case, rather than hiding # them deep inside another function. -# _require_fs_sysfs_attr_policy $TEST_DEV $attr $policy -_verify_sysfs_syntax() +# _require_fs_sysfs_dev_policy $TEST_DEV $attr $policy +_verify_sysfs_dev_syntax() { local dev=$1 local attr=$2
@@ -110,23 +110,23 @@ _verify_sysfs_syntax() local value=$4 # Test policy specified wrongly. Must fail. - _set_sysfs_policy_must_fail $dev $attr "'$policy $policy'" - _set_sysfs_policy_must_fail $dev $attr "'$policy t'" - _set_sysfs_policy_must_fail $dev $attr "' '" - _set_sysfs_policy_must_fail $dev $attr "'${policy} n'" - _set_sysfs_policy_must_fail $dev $attr "'n ${policy}'" - _set_sysfs_policy_must_fail $dev $attr "' ${policy}'" - _set_sysfs_policy_must_fail $dev $attr "' ${policy} '" - _set_sysfs_policy_must_fail $dev $attr "'${policy} '" - _set_sysfs_policy_must_fail $dev $attr _${policy} - _set_sysfs_policy_must_fail $dev $attr ${policy}_ - _set_sysfs_policy_must_fail $dev $attr _${policy}_ - _set_sysfs_policy_must_fail $dev $attr ${policy}: + _set_sysfs_dev_policy_must_fail $dev $attr "'$policy $policy'" + _set_sysfs_dev_policy_must_fail $dev $attr "'$policy t'" + _set_sysfs_dev_policy_must_fail $dev $attr "' '" + _set_sysfs_dev_policy_must_fail $dev $attr "'${policy} n'" + _set_sysfs_dev_policy_must_fail $dev $attr "'n ${policy}'" + _set_sysfs_dev_policy_must_fail $dev $attr "' ${policy}'" + _set_sysfs_dev_policy_must_fail $dev $attr "' ${policy} '" + _set_sysfs_dev_policy_must_fail $dev $attr "'${policy} '" + _set_sysfs_dev_policy_must_fail $dev $attr _${policy} + _set_sysfs_dev_policy_must_fail $dev $attr ${policy}_ + _set_sysfs_dev_policy_must_fail $dev $attr _${policy}_ + _set_sysfs_dev_policy_must_fail $dev $attr ${policy}: # Test policy longer than 32 chars fails stable. - _set_sysfs_policy_must_fail $dev $attr 'jfdkkkkjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjffjfjfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' + _set_sysfs_dev_policy_must_fail $dev $attr 'jfdkkkkjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjffjfjfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' # Test policy specified correctly. Must pass. - _set_sysfs_policy $dev $attr $policy + _set_sysfs_dev_policy $dev $attr $policy # If the policy has no value return if [[ -z $value ]]; then
@@ -134,12 +134,12 @@ _verify_sysfs_syntax() fi # Test value specified wrongly. Must fail. - _set_sysfs_policy_must_fail $dev $attr "'$policy: $value'" - _set_sysfs_policy_must_fail $dev $attr "'$policy:$value '" - _set_sysfs_policy_must_fail $dev $attr "'$policy:$value typo'" - _set_sysfs_policy_must_fail $dev $attr "'$policy:${value}typo'" - _set_sysfs_policy_must_fail $dev $attr "'$policy :$value'" + _set_sysfs_dev_policy_must_fail $dev $attr "'$policy: $value'" + _set_sysfs_dev_policy_must_fail $dev $attr "'$policy:$value '" + _set_sysfs_dev_policy_must_fail $dev $attr "'$policy:$value typo'" + _set_sysfs_dev_policy_must_fail $dev $attr "'$policy:${value}typo'" + _set_sysfs_dev_policy_must_fail $dev $attr "'$policy :$value'" # Test policy and value all specified correctly. Must pass. - _set_sysfs_policy $dev $attr $policy:$value + _set_sysfs_dev_policy $dev $attr $policy:$value }
tests/btrfs/253 +1 -1
@@ -226,7 +226,7 @@ alloc_size "Data" FOURTH_DATA_SIZE_MB # Force chunk allocation of system block type must fail. # echo "Force allocation of system block type must fail." -_set_sysfs_policy_must_fail ${SCRATCH_BDEV} allocation/system/force_chunk_alloc 1 +_set_sysfs_dev_policy_must_fail ${SCRATCH_BDEV} allocation/system/force_chunk_alloc 1 # # Verification of initial allocation.
tests/btrfs/329 +2 -2
@@ -13,9 +13,9 @@ _begin_fstest auto quick . ./common/filter _require_test -_require_fs_sysfs_attr_policy $TEST_DEV read_policy round-robin +_require_fs_sysfs_dev_policy $TEST_DEV read_policy round-robin -_verify_sysfs_syntax $TEST_DEV read_policy round-robin 4096 +_verify_sysfs_dev_syntax $TEST_DEV read_policy round-robin 4096 status=0 exit
tests/btrfs/334 +1 -1
@@ -15,7 +15,7 @@ _begin_fstest auto quick _require_test _require_fs_sysfs_dev_attr $TEST_DEV allocation/data/chunk_size -_verify_sysfs_syntax $TEST_DEV allocation/data/chunk_size 256m +_verify_sysfs_dev_syntax $TEST_DEV allocation/data/chunk_size 256m status=0 exit
Signature · 1 line
2.55.0
PATCH 3/5 common/rc: add helpers for /sys/fs/$FSTYP/features/
In reply to Zorro LangMore and more test cases depend on /sys/fs/$FSTYP/features/ entries. To improve code structure and maintainability, introduce the
- _has_fs_sysfs_feature_attr
- _get_fs_sysfs_feature_attr
- _require_fs_sysfs_feature_attr
helpers.
--- common/rc | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
common/rc +52 -0
@@ -5535,6 +5535,58 @@ _require_fs_sysfs_dev_attr() _notrun "This test requires /sys/fs/${FSTYP}/${dname}/${attr}" } +# Print the content of /sys/fs/$FSTYP/features/$ATTR +# +# Only one argument is needed: +# - attr: path name under /sys/fs/$FSTYP/features +# +# Usage example: +# _get_fs_sysfs_feature_attr send_stream_version +_get_fs_sysfs_feature_attr() +{ + local attr=$1 + + if [ -z "$attr" ];then + _fail "Usage: _get_fs_sysfs_feature_attr <attr>" + fi + + cat /sys/fs/${FSTYP}/features/${attr} +} + +# Test for the existence of a sysfs entry at /sys/fs/$FSTYP/features/$ATTR +# +# Only one argument is needed: +# - attr: path name under /sys/fs/$FSTYP/features +# +# Usage example: +# _has_fs_sysfs_feature_attr raid56 +_has_fs_sysfs_feature_attr() +{ + local attr=$1 + + if [ -z "$attr" ];then + _fail "Usage: _has_fs_sysfs_feature_attr <attr>" + fi + + test -e /sys/fs/${FSTYP}/features/${attr} +} + +# Require the existence of a sysfs entry at /sys/fs/$FSTYP/features/$ATTR +# +# Only one argument is needed: +# - attr: path name under /sys/fs/$FSTYP/features +# +# Usage example: +# _require_fs_sysfs_feature_attr raid56 +_require_fs_sysfs_feature_attr() +{ + local attr=$1 + + _has_fs_sysfs_feature_attr "$attr" && return + + _notrun "This test requires /sys/fs/${FSTYP}/features/${attr}" +} + # Generic test for specific filesystem feature. # Currently only implemented to test overlayfs features. _require_scratch_feature()
Signature · 1 line
2.55.0
PATCH 4/5 common/rc: use common helper in _require_fanotify_ioerrors for f2fs
In reply to Zorro LangThe f2fs branch of _require_fanotify_ioerrors() reads the raw /sys/fs/f2fs/features/fserror path. Use the new _get_fs_sysfs_feature_attr helper instead.
--- common/rc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
common/rc +2 -2
@@ -6308,8 +6308,8 @@ _require_fanotify_ioerrors() test -n "$x" && return 0 ;; f2fs) - local feat_file="/sys/fs/f2fs/features/fserror" - if [ -f "$feat_file" ] && [ "$(cat "$feat_file")" = "supported" ]; then + x="$(_get_fs_sysfs_feature_attr fserror 2>/dev/null)" + if [ "$x" = "supported" ];then return 0 fi ;;
Signature · 1 line
2.55.0
PATCH 5/5 fstests: replace btrfs specific helpers with common sysfs helpers
In reply to Zorro LangSwitch from btrfs specific helpers to the generic sysfs helpers across btrfs test cases, reduce code duplication.
--- common/btrfs | 37 ++----------------------------------- common/rc | 3 ++- tests/btrfs/010 | 3 ++- tests/btrfs/055 | 2 +- tests/btrfs/056 | 2 +- tests/btrfs/112 | 2 +- tests/btrfs/131 | 2 +- tests/btrfs/165 | 2 +- tests/btrfs/188 | 2 +- tests/btrfs/192 | 2 +- tests/btrfs/201 | 2 +- tests/btrfs/205 | 2 +- tests/btrfs/209 | 2 +- tests/btrfs/211 | 2 +- tests/btrfs/219 | 3 +-- tests/btrfs/231 | 2 +- tests/btrfs/285 | 1 - tests/btrfs/296 | 8 +------- tests/btrfs/304 | 4 ++-- tests/btrfs/305 | 4 ++-- tests/btrfs/306 | 4 ++-- tests/btrfs/307 | 4 ++-- tests/btrfs/308 | 4 ++-- tests/btrfs/311 | 2 +- tests/btrfs/313 | 2 +- tests/btrfs/314 | 2 +- tests/btrfs/315 | 2 +- tests/btrfs/342 | 2 +- tests/btrfs/352 | 2 +- tests/generic/098 | 2 +- tests/generic/101 | 2 +- 31 files changed, 38 insertions(+), 77 deletions(-)
common/btrfs +2 -35
@@ -100,26 +100,6 @@ _require_btrfs_mkfs_uuid_option() fi } -_require_btrfs_fs_feature() -{ - if [ -z $1 ]; then - echo "Missing feature name argument for _require_btrfs_fs_feature" - _exit 1 - fi - feat=$1 - modprobe btrfs > /dev/null 2>&1 - [ -e /sys/fs/btrfs/features/$feat ] || \ - _notrun "Feature $feat not supported by the available btrfs version" -} - -_require_btrfs_fs_sysfs() -{ - modprobe btrfs > /dev/null 2>&1 - [ -e /sys/fs/btrfs/features ] || \ - _notrun "Sysfs not supported by the available btrfs version" - -} - _require_btrfs_no_compress() { if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "compress"; then
@@ -959,18 +939,6 @@ _require_scratch_enable_simple_quota() _scratch_unmount } -_has_btrfs_sysfs_feature_attr() -{ - local feature_attr=$1 - - [ -z $feature_attr ] && \ - _fail "Missing feature name argument for _has_btrfs_sysfs_attr" - - modprobe btrfs &> /dev/null - - test -e /sys/fs/btrfs/features/$feature_attr -} - # Print the fsid and metadata uuid replaced with constant strings FSID and # METADATA_UUID. Compare temp_fsid with fsid and metadata_uuid, then echo what # it matches to or TEMP_FSID. This helps in comparing with the golden output.
@@ -980,9 +948,8 @@ _check_temp_fsid() local fsid local metadata_uuid - _require_btrfs_fs_sysfs - _require_btrfs_fs_feature temp_fsid - _require_btrfs_fs_feature metadata_uuid + _require_fs_sysfs_feature_attr temp_fsid + _require_fs_sysfs_feature_attr metadata_uuid _require_btrfs_command inspect-internal dump-super # on disk fsid
common/rc +2 -1
@@ -5582,6 +5582,7 @@ _require_fs_sysfs_feature_attr() { local attr=$1 + modprobe $FSTYP > /dev/null 2>&1 _has_fs_sysfs_feature_attr "$attr" && return _notrun "This test requires /sys/fs/${FSTYP}/features/${attr}"
@@ -6084,7 +6085,7 @@ _require_duplicate_fsid() { case "$FSTYP" in "btrfs") - _require_btrfs_fs_feature temp_fsid + _require_fs_sysfs_feature_attr temp_fsid ;; "ext4") ;;
tests/btrfs/010 +2 -1
@@ -23,7 +23,8 @@ _cleanup() . ./common/filter _require_test -_require_btrfs_fs_sysfs +_require_fs_sysfs_dev_attr $TEST_DEV allocation/metadata/bytes_may_use +_require_fs_sysfs_dev_attr $TEST_DEV allocation/global_rsv_reserved # Create 32k extents. All of these extents will be accounted as outstanding and # reserved.
tests/btrfs/055 +1 -1
@@ -25,7 +25,7 @@ _cleanup() _require_scratch _require_cloner -_require_btrfs_fs_feature "no_holes" +_require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" test_btrfs_clone_with_holes()
tests/btrfs/056 +1 -1
@@ -29,7 +29,7 @@ _cleanup() _require_scratch _require_cloner -_require_btrfs_fs_feature "no_holes" +_require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" _require_dm_target flakey
tests/btrfs/112 +1 -1
@@ -15,7 +15,7 @@ _begin_fstest auto quick clone prealloc compress _require_scratch _require_cloner -_require_btrfs_fs_feature "no_holes" +_require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" _require_xfs_io_command "falloc"
tests/btrfs/131 +1 -1
@@ -16,7 +16,7 @@ _begin_fstest auto quick _require_scratch _require_btrfs_command inspect-internal dump-super -_require_btrfs_fs_feature free_space_tree +_require_fs_sysfs_feature_attr free_space_tree _require_btrfs_v1_cache _scratch_mkfs >/dev/null 2>&1
tests/btrfs/165 +1 -1
@@ -34,7 +34,7 @@ rm_r_subvol() { . ./common/filter _require_scratch -_require_btrfs_fs_feature "rmdir_subvol" +_require_fs_sysfs_feature_attr "rmdir_subvol" _scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed" _scratch_mount
tests/btrfs/188 +1 -1
@@ -24,7 +24,7 @@ _cleanup() _require_test _require_scratch -_require_btrfs_fs_feature "no_holes" +_require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" _require_xfs_io_command "fpunch" _require_xfs_io_command "falloc" "-k"
tests/btrfs/192 +1 -1
@@ -28,7 +28,7 @@ _cleanup() _require_command "$BLKDISCARD_PROG" blkdiscard -_require_btrfs_fs_feature "no_holes" +_require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" _require_log_writes _require_scratch
tests/btrfs/201 +1 -1
@@ -27,7 +27,7 @@ _require_scratch _require_dm_target flakey _require_attrs _require_xfs_io_command "fpunch" -_require_btrfs_fs_feature "no_holes" +_require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" _require_odirect
tests/btrfs/205 +1 -1
@@ -22,7 +22,7 @@ _begin_fstest auto quick clone compress prealloc _require_scratch_reflink _require_xfs_io_command "falloc" "-k" _require_command "$CHATTR_PROG" chattr -_require_btrfs_fs_feature "no_holes" +_require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" # We want to create a compressed inline extent representing 4K of data for file # foo1 and then clone it into a file without compression, and since compression
tests/btrfs/209 +1 -1
@@ -26,7 +26,7 @@ _cleanup() _require_scratch _require_dm_target flakey -_require_btrfs_fs_feature "no_holes" +_require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" _require_xfs_io_command "sync_range"
tests/btrfs/211 +1 -1
@@ -27,7 +27,7 @@ _require_scratch _require_xfs_io_command "falloc" "-k" # fiemap needed by _count_extents() _require_xfs_io_command "fiemap" -_require_btrfs_fs_feature "no_holes" +_require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" _require_dm_target flakey
tests/btrfs/219 +1 -2
@@ -47,7 +47,6 @@ loop_dev2="" _require_test _require_loop -_require_btrfs_fs_sysfs _require_btrfs_forget_or_module_loadable _fixed_by_kernel_commit 5f58d783fd78 \ "btrfs: free device in btrfs_close_devices for a single device filesystem"
@@ -91,7 +90,7 @@ _btrfs_forget_or_module_reload _mount $loop_dev1 $loop_mnt1 > /dev/null 2>&1 || \ _fail "Failed to mount the third time" -if ! _has_btrfs_sysfs_feature_attr temp_fsid; then +if ! _has_fs_sysfs_feature_attr temp_fsid; then _mount $loop_dev2 $loop_mnt2 > /dev/null 2>&1 && \ _fail "We were allowed to mount when we should have failed" fi
tests/btrfs/231 +1 -1
@@ -25,7 +25,7 @@ _cleanup() . ./common/dmflakey _require_scratch -_require_btrfs_fs_feature "no_holes" +_require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" _require_dm_target flakey
tests/btrfs/285 +0 -1
@@ -15,7 +15,6 @@ sysfs_size_classes() { } _require_scratch -_require_btrfs_fs_sysfs _require_fs_sysfs_dev_attr allocation/data/size_classes f="$SCRATCH_MNT/f"
tests/btrfs/296 +1 -7
@@ -14,14 +14,8 @@ _require_scratch_dev_pool 3 _fixed_by_kernel_commit b7625f461da6 \ "btrfs: sysfs: update fs features directory asynchronously" -# We need the global features support -_require_btrfs_fs_sysfs - -global_features="/sys/fs/btrfs/features" # Make sure we have support RAID1C34 first -if [ ! -f "${global_features}/raid1c34" ]; then - _notrun "no RAID1C34 support" -fi +_require_fs_sysfs_feature_attr raid1c34 _scratch_dev_pool_get 3
tests/btrfs/304 +2 -2
@@ -16,8 +16,8 @@ _begin_fstest auto quick raid remount volume raid-stripe-tree _require_btrfs_command inspect-internal dump-tree _require_btrfs_mkfs_feature "raid-stripe-tree" _require_scratch_dev_pool 4 -_require_btrfs_fs_feature "raid_stripe_tree" -_require_btrfs_fs_feature "free_space_tree" +_require_fs_sysfs_feature_attr "raid_stripe_tree" +_require_fs_sysfs_feature_attr "free_space_tree" _require_btrfs_free_space_tree _require_btrfs_no_compress _require_btrfs_support_sectorsize 4096
tests/btrfs/305 +2 -2
@@ -17,8 +17,8 @@ _begin_fstest auto quick raid remount volume raid-stripe-tree _require_btrfs_command inspect-internal dump-tree _require_btrfs_mkfs_feature "raid-stripe-tree" _require_scratch_dev_pool 4 -_require_btrfs_fs_feature "raid_stripe_tree" -_require_btrfs_fs_feature "free_space_tree" +_require_fs_sysfs_feature_attr "raid_stripe_tree" +_require_fs_sysfs_feature_attr "free_space_tree" _require_btrfs_free_space_tree _require_btrfs_no_compress _require_btrfs_support_sectorsize 4096
tests/btrfs/306 +2 -2
@@ -17,8 +17,8 @@ _begin_fstest auto quick raid remount volume raid-stripe-tree _require_btrfs_command inspect-internal dump-tree _require_btrfs_mkfs_feature "raid-stripe-tree" _require_scratch_dev_pool 4 -_require_btrfs_fs_feature "raid_stripe_tree" -_require_btrfs_fs_feature "free_space_tree" +_require_fs_sysfs_feature_attr "raid_stripe_tree" +_require_fs_sysfs_feature_attr "free_space_tree" _require_btrfs_free_space_tree _require_btrfs_no_compress _require_btrfs_support_sectorsize 4096
tests/btrfs/307 +2 -2
@@ -16,8 +16,8 @@ _begin_fstest auto quick raid remount volume raid-stripe-tree _require_btrfs_command inspect-internal dump-tree _require_btrfs_mkfs_feature "raid-stripe-tree" _require_scratch_dev_pool 4 -_require_btrfs_fs_feature "raid_stripe_tree" -_require_btrfs_fs_feature "free_space_tree" +_require_fs_sysfs_feature_attr "raid_stripe_tree" +_require_fs_sysfs_feature_attr "free_space_tree" _require_btrfs_free_space_tree _require_btrfs_no_compress
tests/btrfs/308 +2 -2
@@ -17,8 +17,8 @@ _begin_fstest auto quick raid remount volume raid-stripe-tree _require_btrfs_command inspect-internal dump-tree _require_btrfs_mkfs_feature "raid-stripe-tree" _require_scratch_dev_pool 4 -_require_btrfs_fs_feature "raid_stripe_tree" -_require_btrfs_fs_feature "free_space_tree" +_require_fs_sysfs_feature_attr "raid_stripe_tree" +_require_fs_sysfs_feature_attr "free_space_tree" _require_btrfs_free_space_tree _require_btrfs_no_compress _require_btrfs_no_nodatacow
tests/btrfs/311 +1 -1
@@ -24,7 +24,7 @@ _cleanup() _require_cp_reflink _require_scratch -_require_btrfs_fs_feature temp_fsid +_require_fs_sysfs_feature_attr temp_fsid mnt1=$TEST_DIR/$seq/mnt1 mkdir -p $mnt1
tests/btrfs/313 +1 -1
@@ -22,7 +22,7 @@ _cleanup() _require_cp_reflink _require_scratch_dev_pool 2 -_require_btrfs_fs_feature temp_fsid +_require_fs_sysfs_feature_attr temp_fsid _scratch_dev_pool_get 2
tests/btrfs/314 +1 -1
@@ -22,7 +22,7 @@ _cleanup() . ./common/filter.btrfs _require_scratch_dev_pool 2 -_require_btrfs_fs_feature temp_fsid +_require_fs_sysfs_feature_attr temp_fsid _scratch_dev_pool_get 2
tests/btrfs/315 +1 -1
@@ -21,7 +21,7 @@ _cleanup() . ./common/filter _require_scratch_dev_pool 3 -_require_btrfs_fs_feature temp_fsid +_require_fs_sysfs_feature_attr temp_fsid _scratch_dev_pool_get 3
tests/btrfs/342 +1 -1
@@ -13,7 +13,7 @@ _begin_fstest auto quick _require_scratch _require_btrfs_command inspect-internal dump-super -_require_btrfs_fs_feature free_space_tree +_require_fs_sysfs_feature_attr free_space_tree # The block-group-tree feature relies on v2 cache, thus it doesn't support # "nospace_cache" mount option.
tests/btrfs/352 +1 -1
@@ -14,7 +14,7 @@ _begin_fstest auto quick remount _fixed_by_kernel_commit XXXXXXXXXXXX \ "btrfs: fix leaking BTRFS_FS_STATE_REMOUNTING flag" -_require_btrfs_fs_feature supported_rescue_options +_require_fs_sysfs_feature_attr supported_rescue_options if ! grep -q "ignorebadroots" "/sys/fs/btrfs/features/supported_rescue_options"; then _notrun "\"rescue=ignorebadroots\" mount option not supported"
tests/generic/098 +1 -1
@@ -24,7 +24,7 @@ _require_scratch # feature is enabled (introduced in kernel 3.14). So enable the feature if the # fs being tested is btrfs. if [ $FSTYP == "btrfs" ]; then - _require_btrfs_fs_feature "no_holes" + _require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" MKFS_OPTIONS="$MKFS_OPTIONS -O no-holes" fi
tests/generic/101 +1 -1
@@ -32,7 +32,7 @@ _require_dm_target flakey # feature is enabled (introduced in kernel 3.14). So enable the feature if the # fs being tested is btrfs. if [ $FSTYP == "btrfs" ]; then - _require_btrfs_fs_feature "no_holes" + _require_fs_sysfs_feature_attr "no_holes" _require_btrfs_mkfs_feature "no-holes" MKFS_OPTIONS="$MKFS_OPTIONS -O no-holes" fi
Signature · 1 line
2.55.0
Re: [PATCH 1/5] fstests: consolidate _require_fs_sysfs and _require_fs_sysfs_attr
In reply to Zorro LangQuoted 7 lines · Zorro Lang
There is heavy overlap between
_require_fs_sysfsand_require_fs_sysfs_attr, and their ambiguous names make it difficult to tell them apart.So merge them into a single function with "_dev_" included in the name to distinguish per-device entries from other paths like
/sys/fs/$FSTYP/features/.
I have a bit of a hard time understanding this message. From looking at the diff this seems to:
- rename _has_fs_sysfs_attr to _has_fs_sysfs_dev_attr
- rename _get_fs_sysfs_attr to _get_fs_sysfs_dev_attr
- rename _set_fs_sysfs_attr to _set_fs_sysfs_dev_attr
- rename _require_fs_sysfs_attr to _require_fs_sysfs_dev_attr
- remove _require_fs_sysfs
right? Maybe spell that out and split the pure renames from code removal?
Re: [PATCH 2/5] common/sysfs: adjust function naming
In reply to Zorro LangQuoted 3 lines · Zorro Lang
Add the _dev_ infix to helper functions associated with /sys/fs/$FSTYP/<devices> to distinguish them from upcoming
/sys/fs/$FSTYP/features/related helpers.
Should these even exist as separate helper? And if so they probably should have btrfs in the names?
Re: [PATCH 1/5] fstests: consolidate _require_fs_sysfs and _require_fs_sysfs_attr
In reply to Christoph HellwigQuoted 9 lines · Christoph Hellwig
Quoted 7 lines · Zorro Lang
There is heavy overlap between
_require_fs_sysfsand_require_fs_sysfs_attr, and their ambiguous names make it difficult to tell them apart.So merge them into a single function with "_dev_" included in the name to distinguish per-device entries from other paths like
/sys/fs/$FSTYP/features/.
Quoted 8 lines
I have a bit of a hard time understanding this message. From looking at the diff this seems to:
- rename
_has_fs_sysfs_attrto_has_fs_sysfs_dev_attr
- rename_get_fs_sysfs_attrto_get_fs_sysfs_dev_attr
- rename_set_fs_sysfs_attrto_set_fs_sysfs_dev_attr
- rename_require_fs_sysfs_attrto_require_fs_sysfs_dev_attr
- remove_require_fs_sysfs
And remove _has_fs_sysfs.
Quoted 3 lines
right? Maybe spell that out and split the pure renames from code removal?
Sure, that makes sense. I will incorporate the rename into PATCH 2/5 in the next revision.
Thanks,
Zorro
Re: [PATCH 2/5] common/sysfs: adjust function naming
In reply to Christoph HellwigQuoted 7 lines · Christoph Hellwig
Quoted 3 lines · Zorro Lang
Add the _dev_ infix to helper functions associated with /sys/fs/$FSTYP/<devices> to distinguish them from upcoming
/sys/fs/$FSTYP/features/related helpers.Should these even exist as separate helper? And if so they probably should have btrfs in the names?
Hmm... as far as I know, btrfs is the only filesystem that exposes this "policy" concept under /sys/fs/$FSTYP/ (correct me if I'm wrong). I'm not sure if this was intended to be a generic design; if not, it makes sense to add the btrfs prefix and move it over to common/btrfs.
These helpers were originally introduced by Anand. *Anand*, what do you think? If you agree that too, I can help to do that in next version.
Thanks,
Zorro