diff mbox

[1/2] quota: Add support for ->get_nextdqblk() for VFS quota

Message ID 1453895195-18030-2-git-send-email-jack@suse.cz (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Kara Jan. 27, 2016, 11:46 a.m. UTC
Add infrastructure for supporting get_nextdqblk() callback for VFS
quotas.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/dquot.c         | 26 ++++++++++++++++++++++++++
 include/linux/quota.h    |  1 +
 include/linux/quotaops.h |  2 ++
 3 files changed, 29 insertions(+)

Comments

kernel test robot Jan. 27, 2016, 11:55 a.m. UTC | #1
Hi Jan,

[auto build test ERROR on v4.5-rc1]
[also build test ERROR on next-20160127]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Jan-Kara/quota-Implement-VFS-support-for-Q_-X-GETNEXTQUOTA/20160127-194845
config: x86_64-randconfig-x011-01270835 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

>> fs/quota/dquot.c:2792:2: error: unknown field 'get_nextdqblk' specified in initializer
     .get_nextdqblk = dquot_get_next_dqblk,
     ^
>> fs/quota/dquot.c:2792:19: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     .get_nextdqblk = dquot_get_next_dqblk,
                      ^
   fs/quota/dquot.c:2792:19: note: (near initialization for 'dquot_quotactl_ops.set_dqblk')
   fs/quota/dquot.c:2804:2: error: unknown field 'get_nextdqblk' specified in initializer
     .get_nextdqblk = dquot_get_next_dqblk,
     ^
   fs/quota/dquot.c:2804:19: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
     .get_nextdqblk = dquot_get_next_dqblk,
                      ^
   fs/quota/dquot.c:2804:19: note: (near initialization for 'dquot_quotactl_sysfile_ops.set_dqblk')

vim +/get_nextdqblk +2792 fs/quota/dquot.c

  2786		.quota_on	= dquot_quota_on,
  2787		.quota_off	= dquot_quota_off,
  2788		.quota_sync	= dquot_quota_sync,
  2789		.get_state	= dquot_get_state,
  2790		.set_info	= dquot_set_dqinfo,
  2791		.get_dqblk	= dquot_get_dqblk,
> 2792		.get_nextdqblk	= dquot_get_next_dqblk,
  2793		.set_dqblk	= dquot_set_dqblk
  2794	};
  2795	EXPORT_SYMBOL(dquot_quotactl_ops);

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index fbd70af98820..c3e15ca96c99 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2565,6 +2565,30 @@  int dquot_get_dqblk(struct super_block *sb, struct kqid qid,
 }
 EXPORT_SYMBOL(dquot_get_dqblk);
 
+int dquot_get_next_dqblk(struct super_block *sb, struct kqid *qid,
+			 struct qc_dqblk *di)
+{
+	struct dquot *dquot;
+	struct quota_info *dqopt = sb_dqopt(sb);
+	int err;
+
+	if (!dqopt->ops[qid->type]->get_next_id)
+		return -ENOSYS;
+	mutex_lock(&dqopt->dqio_mutex);
+	err = dqopt->ops[qid->type]->get_next_id(sb, qid);
+	mutex_unlock(&dqopt->dqio_mutex);
+	if (err < 0)
+		return err;
+	dquot = dqget(sb, *qid);
+	if (IS_ERR(dquot))
+		return PTR_ERR(dquot);
+	do_get_dqblk(dquot, di);
+	dqput(dquot);
+
+	return 0;
+}
+EXPORT_SYMBOL(dquot_get_next_dqblk);
+
 #define VFS_QC_MASK \
 	(QC_SPACE | QC_SPC_SOFT | QC_SPC_HARD | \
 	 QC_INO_COUNT | QC_INO_SOFT | QC_INO_HARD | \
@@ -2765,6 +2789,7 @@  const struct quotactl_ops dquot_quotactl_ops = {
 	.get_state	= dquot_get_state,
 	.set_info	= dquot_set_dqinfo,
 	.get_dqblk	= dquot_get_dqblk,
+	.get_nextdqblk	= dquot_get_next_dqblk,
 	.set_dqblk	= dquot_set_dqblk
 };
 EXPORT_SYMBOL(dquot_quotactl_ops);
@@ -2776,6 +2801,7 @@  const struct quotactl_ops dquot_quotactl_sysfile_ops = {
 	.get_state	= dquot_get_state,
 	.set_info	= dquot_set_dqinfo,
 	.get_dqblk	= dquot_get_dqblk,
+	.get_nextdqblk	= dquot_get_next_dqblk,
 	.set_dqblk	= dquot_set_dqblk
 };
 EXPORT_SYMBOL(dquot_quotactl_sysfile_ops);
diff --git a/include/linux/quota.h b/include/linux/quota.h
index fba92f5c1a63..9ba109410c90 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -306,6 +306,7 @@  struct quota_format_ops {
 	int (*read_dqblk)(struct dquot *dquot);		/* Read structure for one user */
 	int (*commit_dqblk)(struct dquot *dquot);	/* Write structure for one user */
 	int (*release_dqblk)(struct dquot *dquot);	/* Called when last reference to dquot is being dropped */
+	int (*get_next_id)(struct super_block *sb, struct kqid *qid);	/* Get next ID with existing structure in the quota file */
 };
 
 /* Operations working with dquots */
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 7a57c28eb5e7..24ed5909ef77 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -99,6 +99,8 @@  int dquot_get_state(struct super_block *sb, struct qc_state *state);
 int dquot_set_dqinfo(struct super_block *sb, int type, struct qc_info *ii);
 int dquot_get_dqblk(struct super_block *sb, struct kqid id,
 		struct qc_dqblk *di);
+int dquot_get_next_dqblk(struct super_block *sb, struct kqid *id,
+		struct qc_dqblk *di);
 int dquot_set_dqblk(struct super_block *sb, struct kqid id,
 		struct qc_dqblk *di);