Skip to contentSkip to conversation

fstests: btrfs: detect regular qgroup for older kernels correctly

PATCH In review Qu Wenruo 3 participants 3 messages Feb 20, 2024 – Feb 26, 2024 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 fstests: btrfs: detect regular qgroup for older kernels correctly

[BUG]
When running an older (vendoer v6.4) kernel, some qgroup test cases would be skipped:

btrfs/017 1s ... [not run] not running normal qgroups

[CAUSE]
With the introduce of simple quota mode, there is a new sysfs interface, /sys/fs/btrfs/<uuid>/qgroups/mode to indicate the currently running qgroup modes.

And _qgroup_mode() from common/btrfs is using that new interface to detect the mode.

Unfortuantely for older kernels without simple quota support, _qgroup_mode() would return "disabled" directly, causing those test case to be skipped.

[FIX]
Fallback to regular qgroup if that sysfs interface is not accessible, as qgroup is introduced from the very beginning of btrfs, thus the regular qgroup is always supported.

---
 common/btrfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/btrfs +1 -1
index e1b29c61..0a3f0f0b 100644
@@ -728,7 +728,7 @@ _qgroup_mode()
 	if _has_fs_sysfs_attr $dev /qgroups/mode; then
 		_get_fs_sysfs_attr $dev qgroups/mode
 	else
-		echo "disabled"
+		echo "qgroup"
 	fi
 }
 
Signature · 1 line
2.42.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · Qu Wenruo

[BUG]
When running an older (vendoer v6.4) kernel, some qgroup test cases would be skipped:

btrfs/017 1s ... [not run] not running normal qgroups

[CAUSE]
With the introduce of simple quota mode, there is a new sysfs interface, /sys/fs/btrfs/<uuid>/qgroups/mode to indicate the currently running qgroup modes.

And _qgroup_mode() from common/btrfs is using that new interface to detect the mode.

Unfortuantely for older kernels without simple quota support, _qgroup_mode() would return "disabled" directly, causing those test case to be skipped.

Quoted 6 lines

[FIX]
Fallback to regular qgroup if that sysfs interface is not accessible, as qgroup is introduced from the very beginning of btrfs, thus the regular qgroup is always supported.

Looks good, thanks.

Quoted 21 lines
---
 common/btrfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/btrfs +1 -2
index e1b29c61..0a3f0f0b 100644
@@ -728,7 +728,7 @@ _qgroup_mode()
        if _has_fs_sysfs_attr $dev /qgroups/mode; then
                _get_fs_sysfs_attr $dev qgroups/mode
        else
-               echo "disabled"
+               echo "qgroup"
        fi
 }
 
--

2.42.0

Reviewed-by on v1 1/1
#2 lore raw
In reply to Qu Wenruo
Quoted 18 lines · Qu Wenruo

[BUG]
When running an older (vendoer v6.4) kernel, some qgroup test cases would be skipped:

btrfs/017 1s ... [not run] not running normal qgroups

[CAUSE]
With the introduce of simple quota mode, there is a new sysfs interface, /sys/fs/btrfs/<uuid>/qgroups/mode to indicate the currently running qgroup modes.

And _qgroup_mode() from common/btrfs is using that new interface to detect the mode.

Unfortuantely for older kernels without simple quota support, _qgroup_mode() would return "disabled" directly, causing those test case to be skipped.

Quoted 6 lines

[FIX]
Fallback to regular qgroup if that sysfs interface is not accessible, as qgroup is introduced from the very beginning of btrfs, thus the regular qgroup is always supported.

Sorry for missing this patch. Now, applied and staged for the next PR.

Thanks.

Quoted 17 lines
---
  common/btrfs | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
common/btrfs +1 -1
index e1b29c61..0a3f0f0b 100644
@@ -728,7 +728,7 @@ _qgroup_mode()
  	if _has_fs_sysfs_attr $dev /qgroups/mode; then
  		_get_fs_sysfs_attr $dev qgroups/mode
  	else
-		echo "disabled"
+		echo "qgroup"
  	fi
  }