xfs
[Top] [All Lists]

[PATCH 3/4] xfsprogs: Add qs_pquota to the fs_quota

To: xfs@xxxxxxxxxxx
Subject: [PATCH 3/4] xfsprogs: Add qs_pquota to the fs_quota
From: Chandra Seetharaman <sekharan@xxxxxxxxxx>
Date: Fri, 20 Jul 2012 18:04:18 -0500
Cc: Chandra Seetharaman <sekharan@xxxxxxxxxx>
In-reply-to: <20120720230350.20689.40213.sendpatchset@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
References: <20120720230350.20689.40213.sendpatchset@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Add a new field qs_pquota to the data structure fs_quota_stat and also
define a new version for the same.

Inform the kernel that the data structure is newer one and on return
from kernel check the version and act accordingly.

Signed-off-by: Chandra Seetharaman <sekharan@xxxxxxxxxx>
---
 include/xqm.h |    2 ++
 quota/state.c |    6 +++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/include/xqm.h b/include/xqm.h
index 47f58a0..24e1ea0 100644
--- a/include/xqm.h
+++ b/include/xqm.h
@@ -124,6 +124,7 @@ typedef struct fs_disk_quota {
  * incore.
  */
 #define FS_QSTAT_VERSION       1       /* fs_quota_stat.qs_version */
+#define FS_QSTAT_VERSION_2     2       /* new field qs_pquota */
 
 /*
  * Some basic information about 'quota files'.
@@ -146,6 +147,7 @@ typedef struct fs_quota_stat {
        __s32           qs_rtbtimelimit;/* limit for rt blks timer */
        __u16           qs_bwarnlimit;  /* limit for num warnings */
        __u16           qs_iwarnlimit;  /* limit for num warnings */
+       fs_qfilestat_t  qs_pquota;      /* project quota storage information */
 } fs_quota_stat_t;
 
 #endif /* __XQM_H__ */
diff --git a/quota/state.c b/quota/state.c
index 42bffc0..678699f 100644
--- a/quota/state.c
+++ b/quota/state.c
@@ -152,6 +152,8 @@ state_quotafile_mount(
        fs_quota_stat_t s;
        char            *dev = mount->fs_name;
 
+       bzero(&s, sizeof(struct fs_quota_stat));
+       s.qs_version = FS_QSTAT_VERSION_2;
        if (xfsquotactl(XFS_GETQSTAT, dev, type, 0, (void *)&s) < 0) {
                if (flags & VERBOSE_FLAG)
                        fprintf(fp, _("%s quota are not enabled on %s\n"),
@@ -168,7 +170,9 @@ state_quotafile_mount(
                                s.qs_flags & XFS_QUOTA_GDQ_ACCT,
                                s.qs_flags & XFS_QUOTA_GDQ_ENFD);
        if (type & XFS_PROJ_QUOTA)
-               state_qfilestat(fp, mount, XFS_PROJ_QUOTA, &s.qs_gquota,
+               state_qfilestat(fp, mount, XFS_PROJ_QUOTA, 
+                               (s.qs_version >= FS_QSTAT_VERSION_2) ?
+                               &s.qs_pquota : &s.qs_gquota,
                                s.qs_flags & XFS_QUOTA_PDQ_ACCT,
                                s.qs_flags & XFS_QUOTA_PDQ_ENFD);
 
-- 
1.7.1

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