cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 10/10] GFS2: Add get_xquota support
Date: Wed, 16 Sep 2009 16:03:42 +0100	[thread overview]
Message-ID: <1253113422-3429-11-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1253113422-3429-10-git-send-email-swhiteho@redhat.com>

This adds support for viewing the current GFS2 quota settings
via the XFS quota API. The setting of quotas will be addressed
in a later patch. Fields which are not supported here are left
set to zero.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
---
 fs/gfs2/quota.c |   43 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 33e369f..d451480 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1367,8 +1367,51 @@ static int gfs2_quota_get_xstate(struct super_block *sb,
 	return 0;
 }
 
+static int gfs2_xquota_get(struct super_block *sb, int type, qid_t id,
+			   struct fs_disk_quota *fdq)
+{
+	struct gfs2_sbd *sdp = sb->s_fs_info;
+	struct gfs2_quota_lvb *qlvb;
+	struct gfs2_quota_data *qd;
+	struct gfs2_holder q_gh;
+	int error;
+
+	memset(fdq, 0, sizeof(struct fs_disk_quota));
+
+	if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF)
+		return -ESRCH; /* Crazy XFS error code */
+
+	if (type == USRQUOTA)
+		type = QUOTA_USER;
+	else if (type == GRPQUOTA)
+		type = QUOTA_GROUP;
+	else
+		return -EINVAL;
+
+	error = qd_get(sdp, type, id, &qd);
+	if (error)
+		return error;
+	error = do_glock(qd, FORCE, &q_gh);
+	if (error)
+		goto out;
+
+	qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lvb;
+	fdq->d_version = FS_DQUOT_VERSION;
+	fdq->d_flags = (type == QUOTA_USER) ? XFS_USER_QUOTA : XFS_GROUP_QUOTA;
+	fdq->d_id = id;
+	fdq->d_blk_hardlimit = be64_to_cpu(qlvb->qb_limit);
+	fdq->d_blk_softlimit = be64_to_cpu(qlvb->qb_warn);
+	fdq->d_bcount = be64_to_cpu(qlvb->qb_value);
+
+	gfs2_glock_dq_uninit(&q_gh);
+out:
+	qd_put(qd);
+	return 0;
+}
+
 const struct quotactl_ops gfs2_quotactl_ops = {
 	.quota_sync     = gfs2_quota_sync,
 	.get_xstate     = gfs2_quota_get_xstate,
+	.get_xquota	= gfs2_xquota_get,
 };
 
-- 
1.6.2.5



      reply	other threads:[~2009-09-16 15:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-16 15:03 [Cluster-devel] Mostly quotas Steven Whitehouse
2009-09-16 15:03 ` [Cluster-devel] [PATCH 01/10] GFS2: Alter arguments of gfs2_quota/statfs_sync Steven Whitehouse
2009-09-16 15:03   ` [Cluster-devel] [PATCH 02/10] GFS2: Hook gfs2_quota_sync into VFS via gfs2_quotactl_ops Steven Whitehouse
2009-09-16 15:03     ` [Cluster-devel] [PATCH 03/10] GFS2: Remove obsolete code in quota.c Steven Whitehouse
2009-09-16 15:03       ` [Cluster-devel] [PATCH 04/10] GFS2: Add get_xstate quota function Steven Whitehouse
2009-09-16 15:03         ` [Cluster-devel] [PATCH 05/10] GFS2: Remove sysfs "done" files Steven Whitehouse
2009-09-16 15:03           ` [Cluster-devel] [PATCH 06/10] GFS2: Add proper error reporting to quota sync via sysfs Steven Whitehouse
2009-09-16 15:03             ` [Cluster-devel] [PATCH 07/10] GFS2: Remove constant argument from qdsb_get() Steven Whitehouse
2009-09-16 15:03               ` [Cluster-devel] [PATCH 08/10] GFS2: Remove constant argument from qd_get() Steven Whitehouse
2009-09-16 15:03                 ` [Cluster-devel] [PATCH 09/10] GFS2: Clean up gfs2_adjust_quota() and do_glock() Steven Whitehouse
2009-09-16 15:03                   ` Steven Whitehouse [this message]

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=1253113422-3429-11-git-send-email-swhiteho@redhat.com \
    --to=swhiteho@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).