1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (c) 2002 Cluster File Systems, Inc.
5 * Author: Peter Braam <braam@clusterfs.com>
6 * Author: Phil Schwan <phil@clusterfs.com>
8 * This file is part of Lustre, http://www.lustre.org.
10 * Lustre is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
14 * Lustre is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with Lustre; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #define DEBUG_SUBSYSTEM S_LDLM
26 #include <linux/slab.h>
27 #include <linux/module.h>
28 #include <linux/random.h>
29 #include <linux/lustre_dlm.h>
30 #include <linux/lustre_mds.h>
31 #include <linux/obd_class.h>
34 char *ldlm_lockname[] = {
43 char *ldlm_typename[] = {
46 [LDLM_MDSINTENT] "INT"
49 char *ldlm_it2str(int it)
56 case (IT_OPEN | IT_CREAT):
85 CERROR("Unknown intent %d\n", it);
90 extern kmem_cache_t *ldlm_lock_slab;
92 static int ldlm_plain_compat(struct ldlm_lock *a, struct ldlm_lock *b);
94 ldlm_res_compat ldlm_res_compat_table[] = {
95 [LDLM_PLAIN] ldlm_plain_compat,
96 [LDLM_EXTENT] ldlm_extent_compat,
97 [LDLM_MDSINTENT] ldlm_plain_compat
100 ldlm_res_policy ldlm_res_policy_table[] = {
102 [LDLM_EXTENT] ldlm_extent_policy,
103 [LDLM_MDSINTENT] NULL
106 void ldlm_register_intent(int (*arg) (struct ldlm_lock * lock, void *req_cookie,
107 ldlm_mode_t mode, void *data))
109 ldlm_res_policy_table[LDLM_MDSINTENT] = arg;
112 void ldlm_unregister_intent(void)
114 ldlm_res_policy_table[LDLM_MDSINTENT] = NULL;
118 * REFCOUNTED LOCK OBJECTS
123 * Lock refcounts, during creation:
124 * - one special one for allocation, dec'd only once in destroy
125 * - one for being a lock that's in-use
126 * - one for the addref associated with a new lock
128 struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock)
130 l_lock(&lock->l_resource->lr_namespace->ns_lock);
132 ldlm_resource_getref(lock->l_resource);
133 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
137 void ldlm_lock_put(struct ldlm_lock *lock)
139 struct ldlm_namespace *ns = lock->l_resource->lr_namespace;
142 l_lock(&ns->ns_lock);
144 //LDLM_DEBUG(lock, "after refc--");
145 if (lock->l_refc < 0)
148 ldlm_resource_put(lock->l_resource);
150 LDLM_LOCK_PUT(lock->l_parent);
152 if (lock->l_refc == 0 && (lock->l_flags & LDLM_FL_DESTROYED)) {
153 spin_lock(&ns->ns_counter_lock);
155 spin_unlock(&ns->ns_counter_lock);
157 lock->l_resource = NULL;
158 LDLM_DEBUG(lock, "final lock_put on destroyed lock, freeing");
159 if (lock->l_export && lock->l_export->exp_connection)
160 ptlrpc_put_connection(lock->l_export->exp_connection);
161 kmem_cache_free(ldlm_lock_slab, lock);
162 CDEBUG(D_MALLOC, "kfreed 'lock': %d at %p (tot 0).\n",
163 sizeof(*lock), lock);
165 l_unlock(&ns->ns_lock);
169 void ldlm_lock_destroy(struct ldlm_lock *lock)
172 l_lock(&lock->l_resource->lr_namespace->ns_lock);
174 if (!list_empty(&lock->l_children)) {
175 LDLM_DEBUG(lock, "still has children (%p)!",
176 lock->l_children.next);
177 ldlm_lock_dump(lock);
180 if (lock->l_readers || lock->l_writers) {
181 LDLM_DEBUG(lock, "lock still has references");
182 ldlm_lock_dump(lock);
186 if (!list_empty(&lock->l_res_link)) {
187 ldlm_lock_dump(lock);
191 if (lock->l_flags & LDLM_FL_DESTROYED) {
192 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
197 list_del(&lock->l_export_chain);
198 lock->l_export = NULL;
199 lock->l_flags |= LDLM_FL_DESTROYED;
201 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
207 usage: pass in a resource on which you have done get
208 pass in a parent lock on which you have done a get
209 do not put the resource or the parent
210 returns: lock with refcount 1
212 static struct ldlm_lock *ldlm_lock_new(struct ldlm_lock *parent,
213 struct ldlm_resource *resource)
215 struct ldlm_lock *lock;
218 if (resource == NULL)
221 lock = kmem_cache_alloc(ldlm_lock_slab, SLAB_KERNEL);
224 CDEBUG(D_MALLOC, "kmalloced 'lock': %d at "
225 "%p (tot %d).\n", sizeof(*lock), lock, 1);
227 memset(lock, 0, sizeof(*lock));
228 get_random_bytes(&lock->l_random, sizeof(__u64));
230 lock->l_resource = resource;
231 /* this refcount matches the one of the resource passed
232 in which is not being put away */
234 INIT_LIST_HEAD(&lock->l_children);
235 INIT_LIST_HEAD(&lock->l_res_link);
236 INIT_LIST_HEAD(&lock->l_export_chain);
237 INIT_LIST_HEAD(&lock->l_pending_chain);
238 init_waitqueue_head(&lock->l_waitq);
240 spin_lock(&resource->lr_namespace->ns_counter_lock);
241 resource->lr_namespace->ns_locks++;
242 spin_unlock(&resource->lr_namespace->ns_counter_lock);
244 if (parent != NULL) {
245 l_lock(&parent->l_resource->lr_namespace->ns_lock);
246 lock->l_parent = parent;
247 list_add(&lock->l_childof, &parent->l_children);
248 l_unlock(&parent->l_resource->lr_namespace->ns_lock);
250 /* this is the extra refcount, to prevent the lock
256 int ldlm_lock_change_resource(struct ldlm_lock *lock, __u64 new_resid[3])
258 struct ldlm_namespace *ns = lock->l_resource->lr_namespace;
259 struct ldlm_resource *oldres = lock->l_resource;
263 l_lock(&ns->ns_lock);
264 if (memcmp(new_resid, lock->l_resource->lr_name,
265 sizeof(lock->l_resource->lr_name)) == 0) {
267 l_unlock(&ns->ns_lock);
271 type = lock->l_resource->lr_type;
272 if (new_resid[0] == 0)
274 lock->l_resource = ldlm_resource_get(ns, NULL, new_resid, type, 1);
275 if (lock->l_resource == NULL) {
280 /* move references over */
281 for (i = 0; i < lock->l_refc; i++) {
283 ldlm_resource_getref(lock->l_resource);
284 rc = ldlm_resource_put(oldres);
285 if (rc == 1 && i != lock->l_refc - 1)
288 /* compensate for the initial get above.. */
289 ldlm_resource_put(lock->l_resource);
291 l_unlock(&ns->ns_lock);
299 void ldlm_lock2handle(struct ldlm_lock *lock, struct lustre_handle *lockh)
301 lockh->addr = (__u64) (unsigned long)lock;
302 lockh->cookie = lock->l_random;
305 struct ldlm_lock *ldlm_handle2lock(struct lustre_handle *handle)
307 struct ldlm_lock *lock = NULL, *retval = NULL;
310 if (!handle || !handle->addr)
313 lock = (struct ldlm_lock *)(unsigned long)(handle->addr);
314 if (!kmem_cache_validate(ldlm_lock_slab, (void *)lock))
317 l_lock(&lock->l_resource->lr_namespace->ns_lock);
318 if (lock->l_random != handle->cookie)
321 if (lock->l_flags & LDLM_FL_DESTROYED)
324 retval = LDLM_LOCK_GET(lock);
327 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
331 static int ldlm_plain_compat(struct ldlm_lock *a, struct ldlm_lock *b)
333 return lockmode_compat(a->l_req_mode, b->l_req_mode);
336 void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc)
338 ldlm_res2desc(lock->l_resource, &desc->l_resource);
339 desc->l_req_mode = lock->l_req_mode;
340 desc->l_granted_mode = lock->l_granted_mode;
341 memcpy(&desc->l_extent, &lock->l_extent, sizeof(desc->l_extent));
342 memcpy(desc->l_version, lock->l_version, sizeof(desc->l_version));
345 static void ldlm_add_ast_work_item(struct ldlm_lock *lock,
346 struct ldlm_lock *new)
348 struct ldlm_ast_work *w;
351 l_lock(&lock->l_resource->lr_namespace->ns_lock);
352 if (new && (lock->l_flags & LDLM_FL_AST_SENT))
355 OBD_ALLOC(w, sizeof(*w));
362 lock->l_flags |= LDLM_FL_AST_SENT;
364 ldlm_lock2desc(new, &w->w_desc);
367 w->w_lock = LDLM_LOCK_GET(lock);
368 list_add(&w->w_list, lock->l_resource->lr_tmp);
370 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
374 void ldlm_lock_addref(struct lustre_handle *lockh, __u32 mode)
376 struct ldlm_lock *lock;
378 lock = ldlm_handle2lock(lockh);
379 ldlm_lock_addref_internal(lock, mode);
383 /* only called for local locks */
384 void ldlm_lock_addref_internal(struct ldlm_lock *lock, __u32 mode)
386 l_lock(&lock->l_resource->lr_namespace->ns_lock);
387 if (mode == LCK_NL || mode == LCK_CR || mode == LCK_PR)
391 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
393 LDLM_DEBUG(lock, "ldlm_lock_addref(%s)", ldlm_lockname[mode]);
396 /* Args: unlocked lock */
397 void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode)
399 struct ldlm_lock *lock = ldlm_handle2lock(lockh);
405 LDLM_DEBUG(lock, "ldlm_lock_decref(%s)", ldlm_lockname[mode]);
406 l_lock(&lock->l_resource->lr_namespace->ns_lock);
407 if (mode == LCK_NL || mode == LCK_CR || mode == LCK_PR)
412 /* If we received a blocked AST and this was the last reference,
413 * run the callback. */
414 if (!lock->l_readers && !lock->l_writers &&
415 (lock->l_flags & LDLM_FL_CBPENDING)) {
416 if (!lock->l_resource->lr_namespace->ns_client) {
417 CERROR("LDLM_FL_CBPENDING set on non-local lock!\n");
421 LDLM_DEBUG(lock, "final decref done on cbpending lock");
422 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
424 /* FIXME: need a real 'desc' here */
425 lock->l_blocking_ast(lock, NULL, lock->l_data,
428 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
430 LDLM_LOCK_PUT(lock); /* matches the ldlm_lock_get in addref */
431 LDLM_LOCK_PUT(lock); /* matches the handle2lock above */
436 static int ldlm_lock_compat_list(struct ldlm_lock *lock, int send_cbs,
437 struct list_head *queue)
439 struct list_head *tmp, *pos;
442 list_for_each_safe(tmp, pos, queue) {
443 struct ldlm_lock *child;
444 ldlm_res_compat compat;
446 child = list_entry(tmp, struct ldlm_lock, l_res_link);
450 compat = ldlm_res_compat_table[child->l_resource->lr_type];
451 if (compat && compat(child, lock)) {
452 CDEBUG(D_OTHER, "compat function succeded, next.\n");
455 if (lockmode_compat(child->l_granted_mode, lock->l_req_mode)) {
456 CDEBUG(D_OTHER, "lock modes are compatible, next.\n");
462 if (send_cbs && child->l_blocking_ast != NULL) {
463 CDEBUG(D_OTHER, "lock %p incompatible; sending "
464 "blocking AST.\n", child);
465 ldlm_add_ast_work_item(child, lock);
472 static int ldlm_lock_compat(struct ldlm_lock *lock, int send_cbs)
477 l_lock(&lock->l_resource->lr_namespace->ns_lock);
478 rc = ldlm_lock_compat_list(lock, send_cbs,
479 &lock->l_resource->lr_granted);
480 /* FIXME: should we be sending ASTs to converting? */
482 rc = ldlm_lock_compat_list
483 (lock, send_cbs, &lock->l_resource->lr_converting);
485 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
490 - ldlm_handle_enqueuque - resource
492 void ldlm_grant_lock(struct ldlm_lock *lock)
494 struct ldlm_resource *res = lock->l_resource;
497 l_lock(&lock->l_resource->lr_namespace->ns_lock);
498 ldlm_resource_add_lock(res, &res->lr_granted, lock);
499 lock->l_granted_mode = lock->l_req_mode;
501 if (lock->l_granted_mode < res->lr_most_restr)
502 res->lr_most_restr = lock->l_granted_mode;
504 if (lock->l_completion_ast) {
505 ldlm_add_ast_work_item(lock, NULL);
507 l_unlock(&lock->l_resource->lr_namespace->ns_lock);
511 /* returns a referenced lock or NULL */
512 static struct ldlm_lock *search_queue(struct list_head *queue, ldlm_mode_t mode,
513 struct ldlm_extent *extent)
515 struct ldlm_lock *lock;
516 struct list_head *tmp;
518 list_for_each(tmp, queue) {
519 lock = list_entry(tmp, struct ldlm_lock, l_res_link);
521 if (lock->l_flags & (LDLM_FL_CBPENDING | LDLM_FL_DESTROYED))
524 /* lock_convert() takes the resource lock, so we're sure that
525 * req_mode, lr_type, and l_cookie won't change beneath us */
526 if (lock->l_req_mode != mode)
529 if (lock->l_resource->lr_type == LDLM_EXTENT &&
530 (lock->l_extent.start > extent->start ||
531 lock->l_extent.end < extent->end))
534 ldlm_lock_addref_internal(lock, mode);
541 /* Must be called with no resource or lock locks held.
543 * Returns 1 if it finds an already-existing lock that is compatible; in this
544 * case, lockh is filled in with a addref()ed lock
546 int ldlm_lock_match(struct ldlm_namespace *ns, __u64 * res_id, __u32 type,
547 void *cookie, int cookielen, ldlm_mode_t mode,
548 struct lustre_handle *lockh)
550 struct ldlm_resource *res;
551 struct ldlm_lock *lock;
555 res = ldlm_resource_get(ns, NULL, res_id, type, 0);
559 ns = res->lr_namespace;
560 l_lock(&ns->ns_lock);
562 if ((lock = search_queue(&res->lr_granted, mode, cookie)))
564 if ((lock = search_queue(&res->lr_converting, mode, cookie)))
566 if ((lock = search_queue(&res->lr_waiting, mode, cookie)))
571 ldlm_resource_put(res);
572 l_unlock(&ns->ns_lock);
575 ldlm_lock2handle(lock, lockh);
576 if (lock->l_completion_ast)
577 lock->l_completion_ast(lock, LDLM_FL_WAIT_NOREPROC);
580 LDLM_DEBUG(lock, "matched");
582 LDLM_DEBUG_NOLOCK("not matched");
586 /* Returns a referenced lock */
587 struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
588 struct lustre_handle *parent_lock_handle,
589 __u64 * res_id, __u32 type,
590 ldlm_mode_t mode, void *data, __u32 data_len)
592 struct ldlm_resource *res, *parent_res = NULL;
593 struct ldlm_lock *lock, *parent_lock;
595 parent_lock = ldlm_handle2lock(parent_lock_handle);
597 parent_res = parent_lock->l_resource;
599 res = ldlm_resource_get(ns, parent_res, res_id, type, 1);
603 lock = ldlm_lock_new(parent_lock, res);
605 ldlm_resource_put(res);
609 lock->l_req_mode = mode;
611 lock->l_data_len = data_len;
616 /* Must be called with lock->l_lock and lock->l_resource->lr_lock not held */
617 ldlm_error_t ldlm_lock_enqueue(struct ldlm_lock * lock,
618 void *cookie, int cookie_len,
620 ldlm_completion_callback completion,
621 ldlm_blocking_callback blocking)
623 struct ldlm_resource *res;
625 ldlm_res_policy policy;
628 res = lock->l_resource;
629 lock->l_blocking_ast = blocking;
631 if (res->lr_type == LDLM_EXTENT)
632 memcpy(&lock->l_extent, cookie, sizeof(lock->l_extent));
634 /* policies are not executed on the client */
635 local = res->lr_namespace->ns_client;
636 if (!local && (policy = ldlm_res_policy_table[res->lr_type])) {
638 rc = policy(lock, cookie, lock->l_req_mode, NULL);
640 if (rc == ELDLM_LOCK_CHANGED) {
641 res = lock->l_resource;
642 *flags |= LDLM_FL_LOCK_CHANGED;
643 } else if (rc == ELDLM_LOCK_ABORTED) {
644 ldlm_lock_destroy(lock);
649 lock->l_cookie = cookie;
650 lock->l_cookie_len = cookie_len;
652 l_lock(&res->lr_namespace->ns_lock);
653 if (local && lock->l_req_mode == lock->l_granted_mode) {
654 /* The server returned a blocked lock, but it was granted before
655 * we got a chance to actually enqueue it. We don't need to do
657 *flags &= ~(LDLM_FL_BLOCK_GRANTED |
658 LDLM_FL_BLOCK_CONV | LDLM_FL_BLOCK_WAIT);
662 /* This distinction between local lock trees is very important; a client
663 * namespace only has information about locks taken by that client, and
664 * thus doesn't have enough information to decide for itself if it can
665 * be granted (below). In this case, we do exactly what the server
666 * tells us to do, as dictated by the 'flags' */
667 ldlm_resource_unlink_lock(lock);
669 if (*flags & LDLM_FL_BLOCK_CONV)
670 ldlm_resource_add_lock(res, res->lr_converting.prev,
672 else if (*flags & (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED))
673 ldlm_resource_add_lock(res, res->lr_waiting.prev, lock);
675 ldlm_grant_lock(lock);
679 /* FIXME: We may want to optimize by checking lr_most_restr */
680 if (!list_empty(&res->lr_converting)) {
681 ldlm_resource_add_lock(res, res->lr_waiting.prev, lock);
682 *flags |= LDLM_FL_BLOCK_CONV;
685 if (!list_empty(&res->lr_waiting)) {
686 ldlm_resource_add_lock(res, res->lr_waiting.prev, lock);
687 *flags |= LDLM_FL_BLOCK_WAIT;
690 if (!ldlm_lock_compat(lock, 0)) {
691 ldlm_resource_add_lock(res, res->lr_waiting.prev, lock);
692 *flags |= LDLM_FL_BLOCK_GRANTED;
696 ldlm_grant_lock(lock);
699 l_unlock(&res->lr_namespace->ns_lock);
700 /* Don't set 'completion_ast' until here so that if the lock is granted
701 * immediately we don't do an unnecessary completion call. */
702 lock->l_completion_ast = completion;
706 /* Must be called with namespace taken: queue is waiting or converting. */
707 static int ldlm_reprocess_queue(struct ldlm_resource *res,
708 struct list_head *queue)
710 struct list_head *tmp, *pos;
713 list_for_each_safe(tmp, pos, queue) {
714 struct ldlm_lock *pending;
715 pending = list_entry(tmp, struct ldlm_lock, l_res_link);
717 CDEBUG(D_INFO, "Reprocessing lock %p\n", pending);
719 if (!ldlm_lock_compat(pending, 1))
722 list_del_init(&pending->l_res_link);
723 ldlm_grant_lock(pending);
729 void ldlm_run_ast_work(struct list_head *rpc_list)
731 struct list_head *tmp, *pos;
735 list_for_each_safe(tmp, pos, rpc_list) {
736 struct ldlm_ast_work *w =
737 list_entry(tmp, struct ldlm_ast_work, w_list);
740 rc = w->w_lock->l_blocking_ast
741 (w->w_lock, &w->w_desc, w->w_data,
744 rc = w->w_lock->l_completion_ast(w->w_lock, w->w_flags);
746 CERROR("Failed AST - should clean & disconnect "
748 LDLM_LOCK_PUT(w->w_lock);
749 list_del(&w->w_list);
750 OBD_FREE(w, sizeof(*w));
755 /* Must be called with resource->lr_lock not taken. */
756 void ldlm_reprocess_all(struct ldlm_resource *res)
758 struct list_head rpc_list = LIST_HEAD_INIT(rpc_list);
761 /* Local lock trees don't get reprocessed. */
762 if (res->lr_namespace->ns_client) {
767 l_lock(&res->lr_namespace->ns_lock);
768 res->lr_tmp = &rpc_list;
770 ldlm_reprocess_queue(res, &res->lr_converting);
771 if (list_empty(&res->lr_converting))
772 ldlm_reprocess_queue(res, &res->lr_waiting);
775 l_unlock(&res->lr_namespace->ns_lock);
777 ldlm_run_ast_work(&rpc_list);
781 void ldlm_lock_cancel(struct ldlm_lock *lock)
783 struct ldlm_resource *res;
784 struct ldlm_namespace *ns;
787 res = lock->l_resource;
788 ns = res->lr_namespace;
790 l_lock(&ns->ns_lock);
791 if (lock->l_readers || lock->l_writers)
792 CDEBUG(D_INFO, "lock still has references (%d readers, %d "
793 "writers)\n", lock->l_readers, lock->l_writers);
795 ldlm_resource_unlink_lock(lock);
796 ldlm_lock_destroy(lock);
797 l_unlock(&ns->ns_lock);
801 struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode,
804 struct list_head rpc_list = LIST_HEAD_INIT(rpc_list);
805 struct ldlm_resource *res;
806 struct ldlm_namespace *ns;
810 res = lock->l_resource;
811 ns = res->lr_namespace;
813 l_lock(&ns->ns_lock);
815 lock->l_req_mode = new_mode;
816 ldlm_resource_unlink_lock(lock);
818 /* If this is a local resource, put it on the appropriate list. */
819 if (res->lr_namespace->ns_client) {
820 if (*flags & (LDLM_FL_BLOCK_CONV | LDLM_FL_BLOCK_GRANTED))
821 ldlm_resource_add_lock(res, res->lr_converting.prev,
824 res->lr_tmp = &rpc_list;
825 ldlm_grant_lock(lock);
828 /* FIXME: completion handling not with ns_lock held ! */
829 if (lock->l_completion_ast)
830 lock->l_completion_ast(lock, 0);
833 /* FIXME: We should try the conversion right away and possibly
834 * return success without the need for an extra AST */
835 ldlm_resource_add_lock(res, res->lr_converting.prev, lock);
836 *flags |= LDLM_FL_BLOCK_CONV;
839 l_unlock(&ns->ns_lock);
842 ldlm_run_ast_work(&rpc_list);
846 void ldlm_lock_dump(struct ldlm_lock *lock)
850 if (!(portal_debug & D_OTHER))
853 if (RES_VERSION_SIZE != 4)
857 CDEBUG(D_OTHER, " NULL LDLM lock\n");
861 snprintf(ver, sizeof(ver), "%x %x %x %x",
862 lock->l_version[0], lock->l_version[1],
863 lock->l_version[2], lock->l_version[3]);
865 CDEBUG(D_OTHER, " -- Lock dump: %p (%s)\n", lock, ver);
866 if (lock->l_export && lock->l_export->exp_connection)
867 CDEBUG(D_OTHER, " Node: NID %x (rhandle: "LPX64")\n",
868 lock->l_export->exp_connection->c_peer.peer_nid,
869 lock->l_remote_handle.addr);
871 CDEBUG(D_OTHER, " Node: local\n");
872 CDEBUG(D_OTHER, " Parent: %p\n", lock->l_parent);
873 CDEBUG(D_OTHER, " Resource: %p ("LPD64")\n", lock->l_resource,
874 lock->l_resource->lr_name[0]);
875 CDEBUG(D_OTHER, " Requested mode: %d, granted mode: %d\n",
876 (int)lock->l_req_mode, (int)lock->l_granted_mode);
877 CDEBUG(D_OTHER, " Readers: %u ; Writers; %u\n",
878 lock->l_readers, lock->l_writers);
879 if (lock->l_resource->lr_type == LDLM_EXTENT)
880 CDEBUG(D_OTHER, " Extent: %Lu -> %Lu\n",
881 (unsigned long long)lock->l_extent.start,
882 (unsigned long long)lock->l_extent.end);