Whamcloud - gitweb
Revert "LU-9439 scripts: Change behavior of lustre_rmmod"
[fs/lustre-release.git] / lustre / quota / qsd_lock.c
index 8842eeb..c63a4e3 100644 (file)
@@ -21,7 +21,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2016, Intel Corporation.
  * Use is subject to license terms.
  *
  * Author: Johann Lombardi <johann.lombardi@intel.com>
@@ -32,6 +32,7 @@
 
 #include <lustre_dlm.h>
 #include <obd_class.h>
+#include <lustre_swab.h>
 
 #include "qsd_internal.h"
 
@@ -148,6 +149,9 @@ static int qsd_common_glimpse_ast(struct ptlrpc_request *req,
        if (*desc == NULL)
                RETURN(-EFAULT);
 
+       if (ptlrpc_req_need_swab(req))
+               lustre_swab_gl_lquota_desc(*desc);
+
        /* prepare reply */
        req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER,
                             sizeof(struct lquota_lvb));
@@ -208,7 +212,7 @@ static int qsd_glb_blocking_ast(struct ldlm_lock *lock,
                write_unlock(&qqi->qqi_qsd->qsd_lock);
 
                CDEBUG(D_QUOTA, "%s: losing global index lock for %s type\n",
-                      qqi->qqi_qsd->qsd_svname, QTYPE_NAME((qqi->qqi_qtype)));
+                      qqi->qqi_qsd->qsd_svname, qtype_name((qqi->qqi_qtype)));
 
                /* kick off reintegration thread if not running already, if
                 * it's just local cancel (for stack clean up or eviction),
@@ -252,13 +256,13 @@ static int qsd_glb_glimpse_ast(struct ldlm_lock *lock, void *data)
                /* valid race */
                GOTO(out, rc = -ELDLM_NO_LOCK_DATA);
 
-       CDEBUG(D_QUOTA, "%s: glimpse on glb quota locks, id:"LPU64" ver:"LPU64
-              " hard:" LPU64" soft:"LPU64"\n", qqi->qqi_qsd->qsd_svname,
+       CDEBUG(D_QUOTA, "%s: glimpse on glb quota locks, id:%llu ver:%llu"
+              " hard:" "%llu soft:%llu\n", qqi->qqi_qsd->qsd_svname,
               desc->gl_id.qid_uid, desc->gl_ver, desc->gl_hardlimit,
               desc->gl_softlimit);
 
        if (desc->gl_ver == 0) {
-               CERROR("%s: invalid global index version "LPU64"\n",
+               CERROR("%s: invalid global index version %llu\n",
                       qqi->qqi_qsd->qsd_svname, desc->gl_ver);
                GOTO(out_qqi, rc = -EINVAL);
        }
@@ -311,7 +315,7 @@ static int qsd_id_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *de
                struct lu_env           *env;
                struct lquota_entry     *lqe;
 
-               LDLM_DEBUG(lock, "canceling global quota lock");
+               LDLM_DEBUG(lock, "canceling ID quota lock");
                lqe = qsd_id_ast_data_get(lock, true);
                if (lqe == NULL)
                        break;
@@ -379,7 +383,6 @@ static int qsd_id_glimpse_ast(struct ldlm_lock *lock, void *data)
 {
        struct ptlrpc_request           *req = data;
        struct lquota_entry             *lqe;
-       struct qsd_instance             *qsd;
        struct ldlm_gl_lquota_desc      *desc;
        struct lquota_lvb               *lvb;
        int                              rc;
@@ -395,11 +398,9 @@ static int qsd_id_glimpse_ast(struct ldlm_lock *lock, void *data)
                /* valid race */
                GOTO(out, rc = -ELDLM_NO_LOCK_DATA);
 
-       LQUOTA_DEBUG(lqe, "glimpse on quota locks, new qunit:"LPU64,
+       LQUOTA_DEBUG(lqe, "glimpse on quota locks, new qunit:%llu",
                     desc->gl_qunit);
 
-       qsd = lqe2qqi(lqe)->qqi_qsd;
-
        lqe_write_lock(lqe);
        lvb->lvb_id_rel = 0;
        if (desc->gl_qunit != 0 && desc->gl_qunit != lqe->lqe_qunit) {
@@ -416,13 +417,13 @@ static int qsd_id_glimpse_ast(struct ldlm_lock *lock, void *data)
                if (space > 0) {
                        if (lqe->lqe_pending_req > 0) {
                                LQUOTA_DEBUG(lqe, "request in flight, postpone "
-                                            "release of "LPD64, space);
+                                            "release of %lld", space);
                                lvb->lvb_id_may_rel = space;
                        } else {
                                lqe->lqe_pending_req++;
 
                                /* release quota space in glimpse reply */
-                               LQUOTA_DEBUG(lqe, "releasing "LPD64, space);
+                               LQUOTA_DEBUG(lqe, "releasing %lld", space);
                                lqe->lqe_granted -= space;
                                lvb->lvb_id_rel   = space;