From 08eef031a8ab89ffcca908340b302d854c0177e0 Mon Sep 17 00:00:00 2001 From: zab Date: Sat, 7 Aug 2004 00:51:10 +0000 Subject: [PATCH] b=3267 r=adilger Grab i_sem before the ns lock when setting the kms so the ns lock hold time doesn't include waiting for a write() to finish and release the i_sem. --- lustre/ChangeLog | 1 + lustre/llite/file.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 1b1fbde..c2c847c 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -7,6 +7,7 @@ tbd Cluster File Systems, Inc. - don't allow multiple threads in OSC recovery(3812) - fix debug_size parameters (3864) - fix mds_postrecov to initialize import for llog ctxt (3121) + - reduce ns lock hold times when setting kms (3267) 2004-07-14 Cluster File Systems, Inc. * version 1.2.4 diff --git a/lustre/llite/file.c b/lustre/llite/file.c index fec8e34..e419317 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -472,8 +472,12 @@ static int ll_extent_lock_callback(struct ldlm_lock *lock, stripe = ll_lock_to_stripe_offset(inode, lock); ll_pgcache_remove_extent(inode, lsm, lock, stripe); - l_lock(&lock->l_resource->lr_namespace->ns_lock); + /* grabbing the i_sem will wait for write() to complete. ns + * lock hold times should be very short as ast processing + * requires them and has a short timeout. so, i_sem before ns + * lock.*/ down(&inode->i_sem); + l_lock(&lock->l_resource->lr_namespace->ns_lock); kms = ldlm_extent_shift_kms(lock, lsm->lsm_oinfo[stripe].loi_kms); @@ -481,8 +485,8 @@ static int ll_extent_lock_callback(struct ldlm_lock *lock, LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64, lsm->lsm_oinfo[stripe].loi_kms, kms); lsm->lsm_oinfo[stripe].loi_kms = kms; - up(&inode->i_sem); l_unlock(&lock->l_resource->lr_namespace->ns_lock); + up(&inode->i_sem); //ll_try_done_writing(inode); iput: iput(inode); -- 1.8.3.1