btrfs-progs: Check for metadata uuid feature in misc-tests/034-metadata-uuid
PATCH 1/1 btrfs-progs: Check for metadata uuid feature in misc-tests/034-metadata-uuid
Instead of checking the kernel version, explicitly check for the presence of metadata_uuid file in sysfs. This allows the test to be run on older kernels that might have this feature backported.
--- tests/misc-tests/034-metadata-uuid/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/misc-tests/034-metadata-uuid/test.sh +2 -2
@@ -10,8 +10,8 @@ check_prereq btrfs-image setup_root_helper prepare_test_dev -if ! check_min_kernel_version 5.0; then - _not_run "kernel too old, METADATA_UUID support needed" +if [ ! -f /sys/fs/btrfs/features/metadata_uuid ] ; then + _not_run "METADATA_UUID feature not supported" fi read_fsid() {
Signature · 1 line
2.17.1
Quoted 5 lines · Nikolay Borisov
Instead of checking the kernel version, explicitly check for the presence of
metadata_uuidfile in sysfs. This allows the test to be run on older kernels that might have this feature backported.Signed-off-by Nikolay Borisov <[email protected]>
The idea is pretty good, as sysfs is way more accurate.
But /sys/fs/btrfs/features is not ensured to exist, e.g btrfs module not loaded yet.
Can we fallback to regular kernel version check if /sys/fs/btrfs/features not exist?
Thanks,
Qu
Quoted 20 lines
--- tests/misc-tests/034-metadata-uuid/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/misc-tests/034-metadata-uuid/test.sh +2
-2@@ -10,8 +10,8 @@ check_prereq btrfs-image setup_root_helper prepare_test_dev -if ! check_min_kernel_version 5.0; then - _not_run "kernel too old, METADATA_UUID support needed" +if [ ! -f /sys/fs/btrfs/features/metadata_uuid ] ; then + _not_run "METADATA_UUID feature not supported" fi read_fsid() {
Quoted 9 lines · Qu Wenruo
Quoted 5 lines · Nikolay Borisov
Instead of checking the kernel version, explicitly check for the presence of
metadata_uuidfile in sysfs. This allows the test to be run on older kernels that might have this feature backported.Signed-off-by Nikolay Borisov <[email protected]>
Quoted 7 lines
The idea is pretty good, as sysfs is way more accurate.
But
/sys/fs/btrfs/featuresis not ensured to exist, e.g btrfs module not loaded yet.Can we fallback to regular kernel version check if
/sys/fs/btrfs/featuresnot exist?
The top-level test runned (misc-tests.sh in this case) already calls check_kernel_support which ensures the module is loaded. So such fallback is unnecessary.
Quoted 25 lines
Thanks,
QuQuoted 20 lines
--- tests/misc-tests/034-metadata-uuid/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/misc-tests/034-metadata-uuid/test.sh +2
-2@@ -10,8 +10,8 @@ check_prereq btrfs-image setup_root_helper prepare_test_dev -if ! check_min_kernel_version 5.0; then - _not_run "kernel too old, METADATA_UUID support needed" +if [ ! -f /sys/fs/btrfs/features/metadata_uuid ] ; then + _not_run "METADATA_UUID feature not supported" fi read_fsid() {
Qu Wenruo
Reviewed-byQuoted 17 lines · Nikolay Borisov
Quoted 14 lines · Qu Wenruo
Quoted 5 lines · Nikolay Borisov
Instead of checking the kernel version, explicitly check for the presence of
metadata_uuidfile in sysfs. This allows the test to be run on older kernels that might have this feature backported.Signed-off-by Nikolay Borisov <[email protected]>The idea is pretty good, as sysfs is way more accurate.
But
/sys/fs/btrfs/featuresis not ensured to exist, e.g btrfs module not loaded yet.
Quoted 6 lines
Quoted 2 lines
Can we fallback to regular kernel version check if
/sys/fs/btrfs/featuresnot exist?The top-level test runned (
misc-tests.shin this case) already callscheck_kernel_supportwhich ensures the module is loaded. So such fallback is unnecessary.
Oh, forgot that.
Thanks,
Qu
Quoted 26 lines
Quoted 26 lines
Thanks,
QuQuoted 20 lines
--- tests/misc-tests/034-metadata-uuid/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tests/misc-tests/034-metadata-uuid/test.sh +2
-2@@ -10,8 +10,8 @@ check_prereq btrfs-image setup_root_helper prepare_test_dev -if ! check_min_kernel_version 5.0; then - _not_run "kernel too old, METADATA_UUID support needed" +if [ ! -f /sys/fs/btrfs/features/metadata_uuid ] ; then + _not_run "METADATA_UUID feature not supported" fi read_fsid() {
David Sterba
AppliedQuoted 5 lines · Nikolay Borisov
Instead of checking the kernel version, explicitly check for the presence of
metadata_uuidfile in sysfs. This allows the test to be run on older kernels that might have this feature backported.Signed-off-by Nikolay Borisov <[email protected]>
Applied, thanks.