From ff756cb54fc9a6a92a253ee24ae5dd995649f820 Mon Sep 17 00:00:00 2001 From: nikita Date: Sat, 15 Oct 2005 17:26:04 +0000 Subject: [PATCH] An optimization proposed by Andreas: do not grow (as part of ldlm lock policy) extent locks acquired on server (e.g., OST-side locks introduced by previous 7311 fixes): server-side locks are not cached and would only conflict with other threads. b=7311 r=adilger --- lustre/ChangeLog | 6 ++++++ lustre/ldlm/ldlm_extent.c | 17 ++++++++++++++++- lustre/ldlm/ldlm_flock.c | 3 ++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 7449b52..5253bd3 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -221,6 +221,12 @@ Details : When compiled with --enable-mindf configure option, statfs(2) all OSTs as amount of free space on FS, instead of summary of free spaces of all OSTs. +Severity : minor +Bugzilla : 7311 +Description: An optimization: do not expand extent locks acquired on OST-side +Details : Modify ldlm_extent_policy() to not expand local locks, acquired + by server: they are not cached anyway. + ------------------------------------------------------------------------------ 08-26-2005 Cluster File Systems, Inc. diff --git a/lustre/ldlm/ldlm_extent.c b/lustre/ldlm/ldlm_extent.c index db4c152..2ad27e9 100644 --- a/lustre/ldlm/ldlm_extent.c +++ b/lustre/ldlm/ldlm_extent.c @@ -135,7 +135,22 @@ ldlm_extent_internal_policy(struct list_head *queue, struct ldlm_lock *req, static void ldlm_extent_policy(struct ldlm_resource *res, struct ldlm_lock *lock, int *flags) { - struct ldlm_extent new_ex = { .start = 0, .end = ~0}; + struct ldlm_extent new_ex = { .start = 0, .end = OBD_OBJECT_EOF }; + + if (lock->l_export == NULL) + /* + * this is local lock taken by server (e.g., as a part of + * OST-side locking, or unlink handling). Expansion doesn't + * make a lot of sense for local locks, because they are + * dropped immediately on operation completion and would only + * conflict with other threads. + */ + return; + + if (lock->l_policy_data.l_extent.start == 0 && + lock->l_policy_data.l_extent.end == OBD_OBJECT_EOF) + /* fast-path whole file locks */ + return; ldlm_extent_internal_policy(&res->lr_granted, lock, &new_ex); ldlm_extent_internal_policy(&res->lr_waiting, lock, &new_ex); diff --git a/lustre/ldlm/ldlm_flock.c b/lustre/ldlm/ldlm_flock.c index a602e3b..6c7e259 100644 --- a/lustre/ldlm/ldlm_flock.c +++ b/lustre/ldlm/ldlm_flock.c @@ -258,7 +258,8 @@ ldlm_process_flock_lock(struct ldlm_lock *req, int *flags, int first_enq, * overflow and underflow. */ if ((new->l_policy_data.l_flock.start > (lock->l_policy_data.l_flock.end + 1)) - && (lock->l_policy_data.l_flock.end != ~0)) + && (lock->l_policy_data.l_flock.end != + OBD_OBJECT_EOF)) continue; if ((new->l_policy_data.l_flock.end < -- 1.8.3.1