All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: Check for metadata uuid feature in misc-tests/034-metadata-uuid
@ 2019-08-05 11:45 Nikolay Borisov
  2019-08-05 12:16 ` Qu Wenruo
  2019-08-05 18:55 ` David Sterba
  0 siblings, 2 replies; 5+ messages in thread
From: Nikolay Borisov @ 2019-08-05 11:45 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

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.

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 tests/misc-tests/034-metadata-uuid/test.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/misc-tests/034-metadata-uuid/test.sh b/tests/misc-tests/034-metadata-uuid/test.sh
index 3ef110cda823..6ac55b1cacfa 100755
--- a/tests/misc-tests/034-metadata-uuid/test.sh
+++ b/tests/misc-tests/034-metadata-uuid/test.sh
@@ -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() {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs-progs: Check for metadata uuid feature in misc-tests/034-metadata-uuid
  2019-08-05 11:45 [PATCH] btrfs-progs: Check for metadata uuid feature in misc-tests/034-metadata-uuid Nikolay Borisov
@ 2019-08-05 12:16 ` Qu Wenruo
  2019-08-05 12:20   ` Nikolay Borisov
  2019-08-05 18:55 ` David Sterba
  1 sibling, 1 reply; 5+ messages in thread
From: Qu Wenruo @ 2019-08-05 12:16 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs



On 2019/8/5 下午7:45, Nikolay Borisov wrote:
> 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.
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

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

> ---
>  tests/misc-tests/034-metadata-uuid/test.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/misc-tests/034-metadata-uuid/test.sh b/tests/misc-tests/034-metadata-uuid/test.sh
> index 3ef110cda823..6ac55b1cacfa 100755
> --- a/tests/misc-tests/034-metadata-uuid/test.sh
> +++ b/tests/misc-tests/034-metadata-uuid/test.sh
> @@ -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() {
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs-progs: Check for metadata uuid feature in misc-tests/034-metadata-uuid
  2019-08-05 12:16 ` Qu Wenruo
@ 2019-08-05 12:20   ` Nikolay Borisov
  2019-08-05 12:26     ` Qu Wenruo
  0 siblings, 1 reply; 5+ messages in thread
From: Nikolay Borisov @ 2019-08-05 12:20 UTC (permalink / raw)
  To: Qu Wenruo, linux-btrfs



On 5.08.19 г. 15:16 ч., Qu Wenruo wrote:
> 
> 
> On 2019/8/5 下午7:45, Nikolay Borisov wrote:
>> 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.
>>
>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> 
> 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?

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.

> 
> Thanks,
> Qu
> 
>> ---
>>  tests/misc-tests/034-metadata-uuid/test.sh | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/misc-tests/034-metadata-uuid/test.sh b/tests/misc-tests/034-metadata-uuid/test.sh
>> index 3ef110cda823..6ac55b1cacfa 100755
>> --- a/tests/misc-tests/034-metadata-uuid/test.sh
>> +++ b/tests/misc-tests/034-metadata-uuid/test.sh
>> @@ -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() {
>>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs-progs: Check for metadata uuid feature in misc-tests/034-metadata-uuid
  2019-08-05 12:20   ` Nikolay Borisov
@ 2019-08-05 12:26     ` Qu Wenruo
  0 siblings, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2019-08-05 12:26 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs



On 2019/8/5 下午8:20, Nikolay Borisov wrote:
>
>
> On 5.08.19 г. 15:16 ч., Qu Wenruo wrote:
>>
>>
>> On 2019/8/5 下午7:45, Nikolay Borisov wrote:
>>> 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.
>>>
>>> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
>>
>> 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?
>
> 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.

Oh, forgot that.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

>
>>
>> Thanks,
>> Qu
>>
>>> ---
>>>  tests/misc-tests/034-metadata-uuid/test.sh | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tests/misc-tests/034-metadata-uuid/test.sh b/tests/misc-tests/034-metadata-uuid/test.sh
>>> index 3ef110cda823..6ac55b1cacfa 100755
>>> --- a/tests/misc-tests/034-metadata-uuid/test.sh
>>> +++ b/tests/misc-tests/034-metadata-uuid/test.sh
>>> @@ -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() {
>>>
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs-progs: Check for metadata uuid feature in misc-tests/034-metadata-uuid
  2019-08-05 11:45 [PATCH] btrfs-progs: Check for metadata uuid feature in misc-tests/034-metadata-uuid Nikolay Borisov
  2019-08-05 12:16 ` Qu Wenruo
@ 2019-08-05 18:55 ` David Sterba
  1 sibling, 0 replies; 5+ messages in thread
From: David Sterba @ 2019-08-05 18:55 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Mon, Aug 05, 2019 at 02:45:22PM +0300, Nikolay Borisov wrote:
> 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.
> 
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-08-05 18:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-05 11:45 [PATCH] btrfs-progs: Check for metadata uuid feature in misc-tests/034-metadata-uuid Nikolay Borisov
2019-08-05 12:16 ` Qu Wenruo
2019-08-05 12:20   ` Nikolay Borisov
2019-08-05 12:26     ` Qu Wenruo
2019-08-05 18:55 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.