Whamcloud - gitweb
LU-3280 ldlm: suppress useless lock RPC for layout
[fs/lustre-release.git] / lustre / ldlm / ldlm_lock.c
index 921e201..97a8c14 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2010, 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -112,20 +112,20 @@ void ldlm_convert_policy_to_wire(ldlm_type_t type,
  * Converts lock policy from on the wire lock_desc format to local format
  */
 void ldlm_convert_policy_to_local(struct obd_export *exp, ldlm_type_t type,
-                                  const ldlm_wire_policy_data_t *wpolicy,
-                                  ldlm_policy_data_t *lpolicy)
+                                 const ldlm_wire_policy_data_t *wpolicy,
+                                 ldlm_policy_data_t *lpolicy)
 {
-        ldlm_policy_wire_to_local_t convert;
-        int new_client;
+       ldlm_policy_wire_to_local_t convert;
+       int new_client;
 
-        /** some badnes for 2.0.0 clients, but 2.0.0 isn't supported */
-        new_client = (exp->exp_connect_flags & OBD_CONNECT_FULL20) != 0;
-        if (new_client)
-               convert = ldlm_policy_wire21_to_local[type - LDLM_MIN_TYPE];
-        else
-               convert = ldlm_policy_wire18_to_local[type - LDLM_MIN_TYPE];
+       /** some badness for 2.0.0 clients, but 2.0.0 isn't supported */
+       new_client = (exp_connect_flags(exp) & OBD_CONNECT_FULL20) != 0;
+       if (new_client)
+               convert = ldlm_policy_wire21_to_local[type - LDLM_MIN_TYPE];
+       else
+               convert = ldlm_policy_wire18_to_local[type - LDLM_MIN_TYPE];
 
-        convert(wpolicy, lpolicy);
+       convert(wpolicy, lpolicy);
 }
 
 char *ldlm_it2str(int it)
@@ -654,12 +654,12 @@ EXPORT_SYMBOL(__ldlm_handle2lock);
  */
 void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc)
 {
-        struct obd_export *exp = lock->l_export?:lock->l_conn_export;
-        /* INODEBITS_INTEROP: If the other side does not support
-         * inodebits, reply with a plain lock descriptor.
-         */
-        if ((lock->l_resource->lr_type == LDLM_IBITS) &&
-            (exp && !(exp->exp_connect_flags & OBD_CONNECT_IBITS))) {
+       struct obd_export *exp = lock->l_export ?: lock->l_conn_export;
+
+       /* INODEBITS_INTEROP: If the other side does not support
+        * inodebits, reply with a plain lock descriptor. */
+       if ((lock->l_resource->lr_type == LDLM_IBITS) &&
+           (exp && !(exp_connect_flags(exp) & OBD_CONNECT_IBITS))) {
                 /* Make sure all the right bits are set in this lock we
                    are going to pass to client */
                 LASSERTF(lock->l_policy_data.l_inodebits.bits ==
@@ -929,7 +929,7 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode)
                  * enqueue. */
                 if (!exp_connect_cancelset(lock->l_conn_export) &&
                     !ns_connect_lru_resize(ns))
-                        ldlm_cancel_lru(ns, 0, LDLM_ASYNC, 0);
+                       ldlm_cancel_lru(ns, 0, LCF_ASYNC, 0);
         } else {
                 LDLM_DEBUG(lock, "do not add lock into lru list");
                 unlock_res_and_lock(lock);
@@ -1567,7 +1567,8 @@ int ldlm_fill_lvb(struct ldlm_lock *lock, struct req_capsule *pill,
                memcpy(data, lvb, size);
                break;
        default:
-               LDLM_ERROR(lock, "Unexpected LVB type");
+               LDLM_ERROR(lock, "Unknown LVB type: %d\n", lock->l_lvb_type);
+               libcfs_debug_dumpstack(NULL);
                RETURN(-EINVAL);
        }