[PATCH 3/4] Add a new field qs_pquota to the data structure fs_quota_stat and also define a new version for the same.
Chandra Seetharaman
sekharan at us.ibm.com
Tue Dec 13 16:08:19 CST 2011
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 at us.ibm.com>
---
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
More information about the xfs
mailing list