xfs
[Top] [All Lists]

[PATCH 3/3] gfs2: Add support for the Q_XGETQSTATV

To: xfs@xxxxxxxxxxx
Subject: [PATCH 3/3] gfs2: Add support for the Q_XGETQSTATV
From: Chandra Seetharaman <sekharan@xxxxxxxxxx>
Date: Tue, 6 Aug 2013 17:27:09 -0500
Cc: Chandra Seetharaman <sekharan@xxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: Abhijith Das <adas@xxxxxxxxxx>
Cc: Steven Whitehouse <swhiteho@xxxxxxxxxx>
Cc: linux-fsdevel <linux-fsdevel@xxxxxxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1375828029-26360-1-git-send-email-sekharan@xxxxxxxxxx>
References: <1375828029-26360-1-git-send-email-sekharan@xxxxxxxxxx>
For gfs2, add support for Q_XGETQSTATV quotactl command.

Signed-off-by: Chandra Seetharaman <sekharan@xxxxxxxxxx>

---
 fs/gfs2/quota.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 3768c2f..57f246d 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -1462,6 +1462,32 @@ static int gfs2_quota_get_xstate(struct super_block *sb,
        return 0;
 }
 
+static int gfs2_quota_get_xstatev(struct super_block *sb,
+                                struct fs_quota_statv *fqs)
+{
+       struct gfs2_sbd *sdp = sb->s_fs_info;
+
+       switch (sdp->sd_args.ar_quota) {
+       case GFS2_QUOTA_ON:
+               fqs->qs_flags |= (FS_QUOTA_UDQ_ENFD | FS_QUOTA_GDQ_ENFD);
+               /*FALLTHRU*/
+       case GFS2_QUOTA_ACCOUNT:
+               fqs->qs_flags |= (FS_QUOTA_UDQ_ACCT | FS_QUOTA_GDQ_ACCT);
+               break;
+       case GFS2_QUOTA_OFF:
+               break;
+       }
+
+       if (sdp->sd_quota_inode) {
+               fqs->qs_uquota.qfs_ino = GFS2_I(sdp->sd_quota_inode)->i_no_addr;
+               fqs->qs_uquota.qfs_nblks = sdp->sd_quota_inode->i_blocks;
+       }
+       fqs->qs_uquota.qfs_nextents = 1; /* unsupported */
+       fqs->qs_gquota = fqs->qs_uquota; /* its the same inode in both cases */
+       fqs->qs_incoredqs = atomic_read(&qd_lru_count);
+       return 0;
+}
+
 static int gfs2_get_dqblk(struct super_block *sb, struct kqid qid,
                          struct fs_disk_quota *fdq)
 {
@@ -1604,6 +1630,7 @@ out_put:
 
 const struct quotactl_ops gfs2_quotactl_ops = {
        .quota_sync     = gfs2_quota_sync,
+       .get_xstatev    = gfs2_quota_get_xstatev,
        .get_xstate     = gfs2_quota_get_xstate,
        .get_dqblk      = gfs2_get_dqblk,
        .set_dqblk      = gfs2_set_dqblk,
-- 
1.7.1

<Prev in Thread] Current Thread [Next in Thread>