From 85687833434d50e3f5fd4b849e543eb505bf5a20 Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 26 Jan 2016 13:10:59 +0100 Subject: Scan dquots using Q_GETNEXTQUOTA Check for new kernel quotactl Q_GETNEXTQUOTA and if available use it for scanning all dquot structures. Signed-off-by: Jan Kara --- quotaio_meta.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'quotaio_meta.c') diff --git a/quotaio_meta.c b/quotaio_meta.c index e52b4f4..ad6ff7a 100644 --- a/quotaio_meta.c +++ b/quotaio_meta.c @@ -8,6 +8,7 @@ #include #include +#include #include @@ -55,7 +56,18 @@ static int meta_commit_dquot(struct dquot *dquot, int flags) static int meta_scan_dquots(struct quota_handle *h, int (*process_dquot)(struct dquot *dquot, char *dqname)) { - return generic_scan_dquots(h, process_dquot, vfs_get_dquot); + struct if_nextdqblk kdqblk; + int ret; + + ret = quotactl(QCMD(Q_GETNEXTQUOTA, h->qh_type), h->qh_quotadev, 0, + (void *)&kdqblk); + /* + * Fall back to scanning using passwd if Q_GETNEXTQUOTA is not + * supported + */ + if (ret < 0 && (errno == ENOSYS || errno == EINVAL)) + return generic_scan_dquots(h, process_dquot, vfs_get_dquot); + return vfs_scan_dquots(h, process_dquot); } struct quotafile_ops quotafile_ops_meta = { -- cgit v1.2.3