summaryrefslogtreecommitdiff
path: root/quotasys.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2024-08-06 12:16:29 +0200
committerJan Kara <jack@suse.cz>2024-08-06 12:16:29 +0200
commitb7c7b3268e55eb8572c520aa797d956a60871e9e (patch)
treef3d8ced03ab02c31a013cbd9f681f5d8cb753286 /quotasys.c
parentc59b85805ee64c7ee2937b91533eb96f56d87738 (diff)
quotasys: Make detection of QF_META format work for bcachefsnew-bcachefs
Make hasvfsmetaquota() work for bcachefs which does not set any quota format or enable VFS quota tracking. Using Q_GETINFO works for it because bcachefs does properly report enabled quotas through ->get_state hook. It also works for all other filesystems using QF_META format. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'quotasys.c')
-rw-r--r--quotasys.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/quotasys.c b/quotasys.c
index b912467..0663f5c 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -504,9 +504,16 @@ static int hasxfsquota(const char *dev, struct mntent *mnt, int type, int flags)
static int hasvfsmetaquota(const char *dev, struct mntent *mnt, int type, int flags)
{
- uint32_t fmt;
+ struct if_dqinfo info;
- if (!do_quotactl(QCMD(Q_GETFMT, type), dev, mnt->mnt_dir, 0, (void *)&fmt))
+ /*
+ * Some filesystems such as bcachefs do support QF_META format but
+ * they don't use generic infrastructure for tracking quotas and
+ * hence they don't set quota format. Q_GETINFO is a reliable way to
+ * detect both such filesystems and all other filesystems using QF_META
+ * format.
+ */
+ if (!do_quotactl(QCMD(Q_GETINFO, type), dev, mnt->mnt_dir, 0, (void *)&info))
return QF_META;
return QF_ERROR;