From ca09276f2cb850d4dbd599c74a3e61873ffbc991 Mon Sep 17 00:00:00 2001 From: Johann Lombardi Date: Thu, 6 Sep 2012 14:50:25 +0200 Subject: [PATCH] LU-1842 quota: quota identifier unification 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 Change-Id: Idead35f27ee9d07b9b25f39b791a1ad8778e0f2d Reviewed-on: http://review.whamcloud.com/3888 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger --- lustre/include/lustre/lustre_idl.h | 11 +++++++++++ lustre/ptlrpc/wiretest.c | 4 ++++ lustre/utils/wirecheck.c | 9 +++++++++ lustre/utils/wiretest.c | 4 ++++ 4 files changed, 28 insertions(+) diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 05a01f2..41b1af1 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1765,6 +1765,17 @@ struct mdt_ioepoch { 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 */ diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 50d18be..443c518 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -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)); + /* 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)); diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 2366f54..95216bf 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -163,6 +163,12 @@ do { \ 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", " \ @@ -694,6 +700,9 @@ check_obd_ioobj(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); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index a80e0b6..9e67f2c 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -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)); + /* 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)); -- 1.8.3.1