Whamcloud - gitweb
LU-1842 quota: quota identifier unification
authorJohann Lombardi <johann@whamcloud.com>
Thu, 6 Sep 2012 12:50:25 +0000 (14:50 +0200)
committerAndreas Dilger <adilger@whamcloud.com>
Sat, 8 Sep 2012 07:25:05 +0000 (03:25 -0400)
This patch defines a generic lquota_id structure which is an union
of all the possible identifier types that can be used with quota,
this includes:
- 64-bit user ID
- 64-bit group ID
- a FID which can be used for per-directory quota in the future

Signed-off-by: Johann Lombardi <johann@whamcloud.com>
Change-Id: Idead35f27ee9d07b9b25f39b791a1ad8778e0f2d
Reviewed-on: http://review.whamcloud.com/3888
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/include/lustre/lustre_idl.h
lustre/ptlrpc/wiretest.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index 05a01f2..41b1af1 100644 (file)
@@ -1765,6 +1765,17 @@ struct mdt_ioepoch {
 
 extern void lustre_swab_mdt_ioepoch (struct mdt_ioepoch *b);
 
 
 extern void lustre_swab_mdt_ioepoch (struct mdt_ioepoch *b);
 
+/* The lquota_id structure is an union of all the possible identifier types that
+ * can be used with quota, this includes:
+ * - 64-bit user ID
+ * - 64-bit group ID
+ * - a FID which can be used for per-directory quota in the future */
+union lquota_id {
+       struct lu_fid   qid_fid; /* FID for per-directory quota */
+       __u64           qid_uid; /* user identifier */
+       __u64           qid_gid; /* group identifier */
+};
+
 #define Q_QUOTACHECK    0x800100
 #define Q_INITQUOTA     0x800101        /* init slave limits */
 #define Q_GETOINFO      0x800102        /* get obd quota info */
 #define Q_QUOTACHECK    0x800100
 #define Q_INITQUOTA     0x800101        /* init slave limits */
 #define Q_GETOINFO      0x800102        /* get obd quota info */
index 50d18be..443c518 100644 (file)
@@ -1524,6 +1524,10 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt));
 
         LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt));
 
+       /* Checks for union lquota_id */
+       LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n",
+                (long long)(int)sizeof(union lquota_id));
+
         /* Checks for struct obd_quotactl */
         LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
                  (long long)(int)sizeof(struct obd_quotactl));
         /* Checks for struct obd_quotactl */
         LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
                  (long long)(int)sizeof(struct obd_quotactl));
index 2366f54..95216bf 100644 (file)
@@ -163,6 +163,12 @@ do {                                                            \
                 CHECK_VALUE((int)sizeof(s));                    \
 } while(0)
 
                 CHECK_VALUE((int)sizeof(s));                    \
 } while(0)
 
+#define CHECK_UNION(s)                                         \
+do {                                                           \
+       COMMENT("Checks for union "#s);                         \
+       CHECK_VALUE((int)sizeof(union s));                      \
+} while(0)
+
 #define CHECK_VALUE_SAME(v1, v2)                                \
 do {                                                            \
        printf("\tLASSERTF("#v1" == "#v2", "                    \
 #define CHECK_VALUE_SAME(v1, v2)                                \
 do {                                                            \
        printf("\tLASSERTF("#v1" == "#v2", "                    \
@@ -694,6 +700,9 @@ check_obd_ioobj(void)
 static void
 check_obd_quotactl(void)
 {
 static void
 check_obd_quotactl(void)
 {
+       BLANK_LINE();
+       CHECK_UNION(lquota_id);
+
         BLANK_LINE();
         CHECK_STRUCT(obd_quotactl);
         CHECK_MEMBER(obd_quotactl, qc_cmd);
         BLANK_LINE();
         CHECK_STRUCT(obd_quotactl);
         CHECK_MEMBER(obd_quotactl, qc_cmd);
index a80e0b6..9e67f2c 100644 (file)
@@ -1532,6 +1532,10 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt));
 
         LASSERTF((int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt) == 4, "found %lld\n",
                  (long long)(int)sizeof(((struct obd_ioobj *)0)->ioo_bufcnt));
 
+       /* Checks for union lquota_id */
+       LASSERTF((int)sizeof(union lquota_id) == 16, "found %lld\n",
+                (long long)(int)sizeof(union lquota_id));
+
         /* Checks for struct obd_quotactl */
         LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
                  (long long)(int)sizeof(struct obd_quotactl));
         /* Checks for struct obd_quotactl */
         LASSERTF((int)sizeof(struct obd_quotactl) == 112, "found %lld\n",
                  (long long)(int)sizeof(struct obd_quotactl));