diff options
author | Jan Kara <jack@suse.cz> | 2024-08-06 12:16:29 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2024-08-06 12:16:29 +0200 |
commit | b7c7b3268e55eb8572c520aa797d956a60871e9e (patch) | |
tree | f3d8ced03ab02c31a013cbd9f681f5d8cb753286 /quotasys.c | |
parent | c59b85805ee64c7ee2937b91533eb96f56d87738 (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.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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; |