Whamcloud - gitweb
b=14748
authorgreen <green>
Mon, 3 Mar 2008 02:37:06 +0000 (02:37 +0000)
committergreen <green>
Mon, 3 Mar 2008 02:37:06 +0000 (02:37 +0000)
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
lustre/ldlm/ldlm_extent.c

index fcac9f6..e9a3013 100644 (file)
@@ -761,6 +761,16 @@ Description: SNMP support enhancement
 Details    : Adding total number of sampled request for an MDS node in snmp
              support.
 
 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>
 --------------------------------------------------------------------------------
 
 2007-08-10         Cluster File Systems, Inc. <info@clusterfs.com>
index 3ff8e75..1880c43 100644 (file)
@@ -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)) {
 
                 /* 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))
                         /* non-group locks are compatible, overlap doesn't
                            matter */
                         if (likely(req_mode != LCK_GROUP))