From 5621b9f70e62da7b98d556de8cae39acd07f9e97 Mon Sep 17 00:00:00 2001 From: green <green> Date: Mon, 3 Mar 2008 02:37:06 +0000 Subject: [PATCH] b=14748 r=adilger,jay When traversing extent wating list queue for PR lock and meeting same or wider lock without AST_SENT, we are guaranteed there is no other one like this down the line, so we can return immediatelly --- lustre/ChangeLog | 10 ++++++++++ lustre/ldlm/ldlm_extent.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index fcac9f6acb..e9a30134da 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -761,6 +761,16 @@ Description: SNMP support enhancement Details : Adding total number of sampled request for an MDS node in snmp support. +Severity : enhancement +Bugzilla : 14748 +Description: Optimize ldlm waiting list processing for PR extent locks +Details : When processing waiting list for read extent lock and meeting +read + lock that is same or wider to it that is not contended, skip + processing rest of the list and immediatelly return current + status of conflictness, since we are guaranteed there are no + conflicting locks in the rest of the list. + -------------------------------------------------------------------------------- 2007-08-10 Cluster File Systems, Inc. <info@clusterfs.com> diff --git a/lustre/ldlm/ldlm_extent.c b/lustre/ldlm/ldlm_extent.c index 3ff8e75f2a..1880c4352d 100644 --- a/lustre/ldlm/ldlm_extent.c +++ b/lustre/ldlm/ldlm_extent.c @@ -251,6 +251,34 @@ ldlm_extent_compat_queue(struct list_head *queue, struct ldlm_lock *req, /* locks are compatible, overlap doesn't matter */ if (lockmode_compat(lock->l_req_mode, req_mode)) { + if (req_mode == LCK_PR && + ((lock->l_policy_data.l_extent.start <= + req->l_policy_data.l_extent.start) && + (lock->l_policy_data.l_extent.end >= + req->l_policy_data.l_extent.end))) { + /* If we met a PR lock just like us or wider, + and nobody down the list conflicted with + it, that means we can skip processing of + the rest of the list and safely place + ourselves at the end of the list, or grant + (dependent if we met an conflicting locks + before in the list). + In case of 1st enqueue only we continue + traversing if there is something conflicting + down the list because we need to make sure + that something is marked as AST_SENT as well, + in cse of empy worklist we would exit on + first conflict met. */ + /* There IS a case where such flag is + not set for a lock, yet it blocks + something. Luckily for us this is + only during destroy, so lock is + exclusive. So here we are safe */ + if (!(lock->l_flags & LDLM_FL_AST_SENT)) { + RETURN(compat); + } + } + /* non-group locks are compatible, overlap doesn't matter */ if (likely(req_mode != LCK_GROUP)) -- GitLab