public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH] fstests: btrfs: detect regular qgroup for older kernels correctly
Date: Tue, 20 Feb 2024 14:31:34 +1030	[thread overview]
Message-ID: <20240220040134.81084-1-wqu@suse.com> (raw)

[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.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 common/btrfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/btrfs b/common/btrfs
index e1b29c61..0a3f0f0b 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -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


             reply	other threads:[~2024-02-20  4:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20  4:01 Qu Wenruo [this message]
2024-02-20 11:11 ` [PATCH] fstests: btrfs: detect regular qgroup for older kernels correctly Filipe Manana
2024-02-26  6:36 ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240220040134.81084-1-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox