* 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/
* 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)
*/
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 ==
* 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);
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);
}