Whamcloud - gitweb
Branch b1_8
authortianzy <tianzy>
Wed, 4 Jun 2008 04:18:26 +0000 (04:18 +0000)
committertianzy <tianzy>
Wed, 4 Jun 2008 04:18:26 +0000 (04:18 +0000)
delete compatibility for 32bit qdata
b=15933
i=zhenyu.xu
i=johann

lustre/ChangeLog
lustre/include/lustre/lustre_idl.h
lustre/include/obd_support.h
lustre/ptlrpc/pack_generic.c
lustre/ptlrpc/ptlrpc_module.c
lustre/ptlrpc/wiretest.c
lustre/quota/quota_context.c
lustre/tests/sanity-quota.sh
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index b03c827..c06b9cb 100644 (file)
@@ -119,6 +119,13 @@ Details    : skiplists are used to group compatible locks on granted list
              that was implemented as tracking first and last lock of each lock group
              the patch changes that to using doubly linked lists
 
+Severity   : normal
+Bugzilla   : 15933
+Description: delete compatibility for 32bit qdata
+Details    : as planned, when lustre is beyond b1_8, lquota won't support for 32bit
+            qunit. That means servers of b1_4 and servers of b1_8 can't be used
+            together if users want to use quota.
+
 -------------------------------------------------------------------------------
 
 
index 255aa43..a0e1a6b 100644 (file)
@@ -324,8 +324,6 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);
 #define ECHO_CONNECT_SUPPORTED (0)
 #define MGS_CONNECT_SUPPORTED  (OBD_CONNECT_VERSION | OBD_CONNECT_AT)
 
-#define MAX_QUOTA_COUNT32 (0xffffffffULL)
-
 #define OBD_OCD_VERSION(major,minor,patch,fix) (((major)<<24) + ((minor)<<16) +\
                                                 ((patch)<<8) + (fix))
 #define OBD_OCD_VERSION_MAJOR(version) ((int)((version)>>24)&255)
@@ -1555,23 +1553,7 @@ struct qunit_data_old2 {
 #warning "remove quota code above for format absolete in new release"
 #endif
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-struct qunit_data_old {
-        __u32 qd_id;    /* ID appiles to (uid, gid) */
-        __u32 qd_type;  /* Quota type (USRQUOTA, GRPQUOTA) */
-        __u32 qd_count; /* acquire/release count (bytes for block quota) */
-        __u32 qd_isblk; /* Block quota or file quota */
-};
-#else
-#warning "remove quota code above for format absolete in new release"
-#endif
-
 extern void lustre_swab_qdata(struct qunit_data *d);
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-extern void lustre_swab_qdata_old(struct qunit_data_old *d);
-#else
-#warning "remove quota code above for format absolete in new release"
-#endif
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 9, 0, 0)
 extern void lustre_swab_qdata_old2(struct qunit_data_old2 *d);
 #else
index 2ee8438..e7f1e0a 100644 (file)
@@ -268,11 +268,6 @@ extern unsigned int obd_alloc_fail_rate;
 #define OBD_FAIL_MGS_PAUSE_REQ           0x904
 #define OBD_FAIL_MGS_PAUSE_TARGET_REG    0x905
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-#define OBD_FAIL_QUOTA_QD_COUNT_32BIT    0xA00
-#else
-#warning "remove quota code above for format obsolete in new release"
-#endif
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 9, 0, 0)
 #define OBD_FAIL_QUOTA_WITHOUT_CHANGE_QS    0xA01
 #else
index 32c40c1..0ab8100 100644 (file)
@@ -2314,18 +2314,6 @@ void lustre_swab_qdata(struct qunit_data *d)
         __swab64s (&d->qd_qunit);
 }
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-void lustre_swab_qdata_old(struct qunit_data_old *d)
-{
-        __swab32s (&d->qd_id);
-        __swab32s (&d->qd_type);
-        __swab32s (&d->qd_count);
-        __swab32s (&d->qd_isblk);
-}
-#else
-#warning "remove quota code above for format absolete in new release"
-#endif
-
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 9, 0, 0)
 void lustre_swab_qdata_old2(struct qunit_data_old2 *d)
 {
@@ -2339,42 +2327,6 @@ void lustre_swab_qdata_old2(struct qunit_data_old2 *d)
 
 #ifdef __KERNEL__
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-void qdata_v1_v3(struct qunit_data_old *d,
-                             struct qunit_data *qdata)
-{
-        LASSERT(d);
-        LASSERT(qdata);
-
-        qdata->qd_id = d->qd_id;
-        if (d->qd_type)
-                QDATA_SET_GRP(qdata);
-        if (d->qd_isblk)
-                QDATA_SET_BLK(qdata);
-        qdata->qd_count = d->qd_count;
-}
-
-struct qunit_data_old *qdata_v3_to_v1(struct qunit_data *d)
-{
-        struct qunit_data tmp;
-        struct qunit_data_old *ret;
-        ENTRY;
-
-        if (!d)
-                return NULL;
-
-        tmp = *d;
-        ret = (struct qunit_data_old *)d;
-        ret->qd_id = tmp.qd_id;
-        ret->qd_type = (QDATA_IS_GRP(&tmp) ? GRPQUOTA : USRQUOTA);
-        ret->qd_count = (__u32)tmp.qd_count;
-        ret->qd_isblk = (QDATA_IS_BLK(&tmp) ? 1 : 0);
-        RETURN(ret);
-}
-#else
-#warning "remove quota code above for format absolete in new release"
-#endif
-
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 9, 0, 0)
 void qdata_v2_to_v3(struct qunit_data_old2 *d,
                               struct qunit_data *qdata)
@@ -2413,9 +2365,7 @@ int quota_get_qdata(void *request, struct qunit_data *qdata,
 {
         struct ptlrpc_request *req = (struct ptlrpc_request *)request;
         struct qunit_data *new;
-        struct qunit_data_old *old;
         struct qunit_data_old2 *old2;
-        int size  = sizeof(struct qunit_data_old);
         int size2 = sizeof(struct qunit_data_old2);
         __u64  flags = is_exp ? req->rq_export->exp_connect_flags :
                        req->rq_import->imp_connect_data.ocd_connect_flags;
@@ -2423,13 +2373,6 @@ int quota_get_qdata(void *request, struct qunit_data *qdata,
         LASSERT(req);
         LASSERT(qdata);
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-        if (OBD_FAIL_CHECK(OBD_FAIL_QUOTA_QD_COUNT_32BIT))
-                goto quota32;
-#else
-#warning "remove quota code above for format absolete in new release"
-#endif
-
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 9, 0, 0)
         if (OBD_FAIL_CHECK(OBD_FAIL_QUOTA_WITHOUT_CHANGE_QS))
                 goto without_change_qs;
@@ -2477,20 +2420,6 @@ without_change_qs:
 #warning "remove quota code above for format absolete in new release"
 #endif
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-quota32:
-        /* not support for quota64 and change_qs */
-        if (is_req == QUOTA_REQUEST)
-                old = lustre_swab_reqbuf(req, REQ_REC_OFF, size,
-                                         lustre_swab_qdata_old);
-        else
-                old = lustre_swab_repbuf(req, REPLY_REC_OFF, size,
-                                         lustre_swab_qdata_old);
-        qdata_v1_v3(old, qdata);
-#else
-#warning "remove quota code above for format absolete in new release"
-#endif
-
         return 0;
 }
 EXPORT_SYMBOL(quota_get_qdata);
@@ -2501,7 +2430,6 @@ int quota_copy_qdata(void *request, struct qunit_data *qdata,
 {
         struct ptlrpc_request *req = (struct ptlrpc_request *)request;
         void *target;
-        struct qunit_data_old *old;
         struct qunit_data_old2 *old2;
         __u64  flags = is_exp ? req->rq_export->exp_connect_flags :
                 req->rq_import->imp_connect_data.ocd_connect_flags;
@@ -2509,13 +2437,6 @@ int quota_copy_qdata(void *request, struct qunit_data *qdata,
         LASSERT(req);
         LASSERT(qdata);
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-        if (OBD_FAIL_CHECK(OBD_FAIL_QUOTA_QD_COUNT_32BIT))
-                goto quota32;
-#else
-#warning "remove quota code above for format absolete in new release"
-#endif
-
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 9, 0, 0)
         if (OBD_FAIL_CHECK(OBD_FAIL_QUOTA_WITHOUT_CHANGE_QS))
                 goto without_change_qs;
@@ -2561,23 +2482,6 @@ without_change_qs:
 #warning "remove quota code above for format absolete in new release"
 #endif
 
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-quota32:
-        /* not support for quota64 and change_qs */
-        if (is_req == QUOTA_REQUEST)
-                target = lustre_msg_buf(req->rq_reqmsg, REQ_REC_OFF,
-                                        sizeof(struct qunit_data_old));
-        else
-                target = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF,
-                                        sizeof(struct qunit_data_old));
-        if (!target)
-                return -EINVAL;
-        old = qdata_v3_to_v1(qdata);
-        memcpy(target, old, sizeof(*old));
-#else
-#warning "remove quota code above for format absolete in new release"
-#endif
-
         return 0;
 }
 EXPORT_SYMBOL(quota_copy_qdata);
@@ -2586,15 +2490,10 @@ int quota_get_qunit_data_size(__u64 flag)
 {
         int size;
 
-        if (flag & OBD_CONNECT_CHANGE_QS) {
+        if (flag & OBD_CONNECT_CHANGE_QS)
                 size = sizeof(struct qunit_data);
-        } else {
-                /* write in this way because sizes of qunit_data_old and
-                 * qunit_data_old2 are same */
-                LASSERT(sizeof(struct qunit_data_old) ==
-                        sizeof(struct qunit_data_old2));
-                size = sizeof(struct qunit_data_old);
-        }
+        else
+                size = sizeof(struct qunit_data_old2);
 
         return(size);
 }
index 3bcf3d2..f74eef1 100644 (file)
@@ -227,11 +227,6 @@ EXPORT_SYMBOL(lustre_swab_ldlm_lock_desc);
 EXPORT_SYMBOL(lustre_swab_ldlm_request);
 EXPORT_SYMBOL(lustre_swab_ldlm_reply);
 EXPORT_SYMBOL(lustre_swab_qdata);
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-EXPORT_SYMBOL(lustre_swab_qdata_old);
-#else
-#warning "remove quota code above for format absolete in new release"
-#endif
 #if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 9, 0, 0)
 EXPORT_SYMBOL(lustre_swab_qdata_old2);
 #else
index 6db7a10..a70858b 100644 (file)
@@ -2078,26 +2078,6 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct qunit_data_old2 *)0)->qd_count) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct qunit_data_old2 *)0)->qd_count));
 
-        /* Checks for struct qunit_data_old */
-        LASSERTF((int)sizeof(struct qunit_data_old) == 16, " found %lld\n",
-                 (long long)(int)sizeof(struct qunit_data_old));
-        LASSERTF((int)offsetof(struct qunit_data_old, qd_id) == 0, " found %lld\n",
-                 (long long)(int)offsetof(struct qunit_data_old, qd_id));
-        LASSERTF((int)sizeof(((struct qunit_data_old *)0)->qd_id) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct qunit_data_old *)0)->qd_id));
-        LASSERTF((int)offsetof(struct qunit_data_old, qd_type) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct qunit_data_old, qd_type));
-        LASSERTF((int)sizeof(((struct qunit_data_old *)0)->qd_type) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct qunit_data_old *)0)->qd_type));
-        LASSERTF((int)offsetof(struct qunit_data_old, qd_count) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct qunit_data_old, qd_count));
-        LASSERTF((int)sizeof(((struct qunit_data_old *)0)->qd_count) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct qunit_data_old *)0)->qd_count));
-        LASSERTF((int)offsetof(struct qunit_data_old, qd_isblk) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct qunit_data_old, qd_isblk));
-        LASSERTF((int)sizeof(((struct qunit_data_old *)0)->qd_isblk) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct qunit_data_old *)0)->qd_isblk));
-
         /* Checks for struct quota_adjust_qunit */
         LASSERTF((int)sizeof(struct quota_adjust_qunit) == 32, " found %lld\n",
                  (long long)(int)sizeof(struct quota_adjust_qunit));
index a0b6bf1..e213b21 100644 (file)
@@ -103,12 +103,7 @@ int should_translate_quota (struct obd_import *imp)
         ENTRY;
 
         LASSERT(imp);
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(1, 7, 0, 0)
-        if (imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_QUOTA64 &&
-            !OBD_FAIL_CHECK(OBD_FAIL_QUOTA_QD_COUNT_32BIT))
-#else
         if (imp->imp_connect_data.ocd_connect_flags & OBD_CONNECT_QUOTA64)
-#endif
                 RETURN(0);
         else
                 RETURN(1);
@@ -473,40 +468,6 @@ static int
 schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
                struct qunit_data *qdata, int opc, int wait);
 
-static int split_before_schedule_dqacq(struct obd_device *obd,
-                                       struct lustre_quota_ctxt *qctxt,
-                                       struct qunit_data *qdata, int opc, int wait)
-{
-        int rc = 0;
-        unsigned long factor;
-        struct qunit_data tmp_qdata;
-        ENTRY;
-
-        LASSERT(qdata && qdata->qd_count);
-        QDATA_DEBUG(qdata, "%s quota split.\n",
-                    QDATA_IS_BLK(qdata) ? "block" : "inode");
-        if (QDATA_IS_BLK(qdata))
-                factor = MAX_QUOTA_COUNT32 / qctxt->lqc_bunit_sz *
-                        qctxt->lqc_bunit_sz;
-        else
-                factor = MAX_QUOTA_COUNT32 / qctxt->lqc_iunit_sz *
-                        qctxt->lqc_iunit_sz;
-
-        if (qctxt->lqc_import && should_translate_quota(qctxt->lqc_import) &&
-            qdata->qd_count > factor) {
-                tmp_qdata = *qdata;
-                tmp_qdata.qd_count = factor;
-                qdata->qd_count -= tmp_qdata.qd_count;
-                QDATA_DEBUG((&tmp_qdata), "be split.\n");
-                rc = schedule_dqacq(obd, qctxt, &tmp_qdata, opc, wait);
-        } else{
-                QDATA_DEBUG(qdata, "don't be split.\n");
-                rc = schedule_dqacq(obd, qctxt, qdata, opc, wait);
-        }
-
-        RETURN(rc);
-}
-
 static int
 dqacq_completion(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
                  struct qunit_data *qdata, int rc, int opc)
@@ -644,7 +605,7 @@ out:
         if (rc1 > 0) {
                 int opc;
                 opc = rc1 == 1 ? QUOTA_DQACQ : QUOTA_DQREL;
-                rc1 = split_before_schedule_dqacq(obd, qctxt, qdata, opc, 0);
+                rc1 = schedule_dqacq(obd, qctxt, qdata, opc, 0);
                 QDATA_DEBUG(qdata, "reschedudle opc(%d) rc(%d)\n", opc, rc1);
         }
         RETURN(err);
@@ -756,7 +717,6 @@ schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
         struct dqacq_async_args *aa;
         int size[2] = { sizeof(struct ptlrpc_body), 0 };
         struct obd_import *imp = NULL;
-        unsigned long factor;
         struct lustre_qunit_size *lqs = NULL;
         int rc = 0;
         ENTRY;
@@ -838,16 +798,6 @@ schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
                 RETURN(-ENOMEM);
         }
 
-        if (QDATA_IS_BLK(qdata))
-                factor = MAX_QUOTA_COUNT32 / qctxt->lqc_bunit_sz *
-                        qctxt->lqc_bunit_sz;
-        else
-                factor = MAX_QUOTA_COUNT32 / qctxt->lqc_iunit_sz *
-                        qctxt->lqc_iunit_sz;
-
-        LASSERTF(!should_translate_quota(imp) || qdata->qd_count <= factor,
-                 "qd_count: "LPU64"; should_translate_quota: %d.\n",
-                 qdata->qd_count, should_translate_quota(imp));
         rc = quota_copy_qdata(req, qdata, QUOTA_REQUEST, QUOTA_IMPORT);
         if (rc < 0) {
                 CDEBUG(D_ERROR, "Can't pack qunit_data\n");
@@ -856,7 +806,7 @@ schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
         ptlrpc_req_set_repsize(req, 2, size);
         class_import_put(imp);
 
-        if (wait && qunit) 
+        if (wait && qunit)
                 qunit_get(qunit);
 
         CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args));
@@ -918,8 +868,7 @@ qctxt_adjust_qunit(struct obd_device *obd, struct lustre_quota_ctxt *qctxt,
                         int opc;
                         /* need acquire or release */
                         opc = ret == 1 ? QUOTA_DQACQ : QUOTA_DQREL;
-                        ret = split_before_schedule_dqacq(obd, qctxt, &qdata[i], 
-                                                          opc, wait);
+                        ret = schedule_dqacq(obd, qctxt, &qdata[i], opc, wait);
                         if (!rc)
                                 rc = ret;
                 } else if (wait == 1) {
@@ -1112,9 +1061,7 @@ static int qslave_recovery_main(void *arg)
                         if (ret > 0) {
                                 int opc;
                                 opc = ret == 1 ? QUOTA_DQACQ : QUOTA_DQREL;
-                                rc = split_before_schedule_dqacq(obd, qctxt,
-                                                                 &qdata, opc,
-                                                                 0);
+                                rc = schedule_dqacq(obd, qctxt, &qdata, opc, 0);
                                 if (rc == -EDQUOT)
                                         rc = 0;
                         } else {
index 7e2a9a2..215e48f 100644 (file)
@@ -17,7 +17,7 @@ SRCDIR=`dirname $0`
 export PATH=$PWD/$SRCDIR:$SRCDIR:$PWD/$SRCDIR/../utils:$PATH:/sbin
 
 ONLY=${ONLY:-"$*"}
-ALWAYS_EXCEPT="$SANITY_QUOTA_EXCEPT"
+ALWAYS_EXCEPT="10 $SANITY_QUOTA_EXCEPT"
 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
 
 case `uname -r` in
index 9320c7c..c009fc5 100644 (file)
@@ -999,17 +999,6 @@ check_qunit_data_old2(void)
 }
 
 static void
-check_qunit_data_old(void)
-{
-        BLANK_LINE();
-        CHECK_STRUCT(qunit_data_old);
-        CHECK_MEMBER(qunit_data_old, qd_id);
-        CHECK_MEMBER(qunit_data_old, qd_type);
-        CHECK_MEMBER(qunit_data_old, qd_count);
-        CHECK_MEMBER(qunit_data_old, qd_isblk);
-}
-
-static void
 check_mgs_target_info(void)
 {
         BLANK_LINE();
index 82bf91d..f33017e 100644 (file)
@@ -2076,26 +2076,6 @@ void lustre_assert_wire_constants(void)
         LASSERTF((int)sizeof(((struct qunit_data_old2 *)0)->qd_count) == 8, " found %lld\n",
                  (long long)(int)sizeof(((struct qunit_data_old2 *)0)->qd_count));
 
-        /* Checks for struct qunit_data_old */
-        LASSERTF((int)sizeof(struct qunit_data_old) == 16, " found %lld\n",
-                 (long long)(int)sizeof(struct qunit_data_old));
-        LASSERTF((int)offsetof(struct qunit_data_old, qd_id) == 0, " found %lld\n",
-                 (long long)(int)offsetof(struct qunit_data_old, qd_id));
-        LASSERTF((int)sizeof(((struct qunit_data_old *)0)->qd_id) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct qunit_data_old *)0)->qd_id));
-        LASSERTF((int)offsetof(struct qunit_data_old, qd_type) == 4, " found %lld\n",
-                 (long long)(int)offsetof(struct qunit_data_old, qd_type));
-        LASSERTF((int)sizeof(((struct qunit_data_old *)0)->qd_type) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct qunit_data_old *)0)->qd_type));
-        LASSERTF((int)offsetof(struct qunit_data_old, qd_count) == 8, " found %lld\n",
-                 (long long)(int)offsetof(struct qunit_data_old, qd_count));
-        LASSERTF((int)sizeof(((struct qunit_data_old *)0)->qd_count) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct qunit_data_old *)0)->qd_count));
-        LASSERTF((int)offsetof(struct qunit_data_old, qd_isblk) == 12, " found %lld\n",
-                 (long long)(int)offsetof(struct qunit_data_old, qd_isblk));
-        LASSERTF((int)sizeof(((struct qunit_data_old *)0)->qd_isblk) == 4, " found %lld\n",
-                 (long long)(int)sizeof(((struct qunit_data_old *)0)->qd_isblk));
-
         /* Checks for struct quota_adjust_qunit */
         LASSERTF((int)sizeof(struct quota_adjust_qunit) == 32, " found %lld\n",
                  (long long)(int)sizeof(struct quota_adjust_qunit));