* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2010, 2012, Intel Corporation.
+ * 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 ==
ldlm_lock_decref_internal_nolock(lock, mode);
- /* release lvb data for layout lock */
- if (ns_is_client(ns) && !lock->l_readers && !lock->l_writers &&
- ldlm_has_layout(lock) && lock->l_flags & LDLM_FL_LVB_READY) {
- /* this is the last user of a layout lock and stripe has
- * been set up, lvb is no longer used.
- * This may be a large amount of memory, so we should free it
- * when possible. */
- if (lock->l_lvb_data != NULL) {
- OBD_FREE_LARGE(lock->l_lvb_data, lock->l_lvb_len);
- lock->l_lvb_data = NULL;
- lock->l_lvb_len = 0;
- }
- }
-
if (lock->l_flags & LDLM_FL_LOCAL &&
!lock->l_readers && !lock->l_writers) {
/* If this is a local lock on a server namespace and this was
* 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);