Whamcloud - gitweb
b=3267
authorzab <zab>
Sat, 7 Aug 2004 00:51:10 +0000 (00:51 +0000)
committerzab <zab>
Sat, 7 Aug 2004 00:51:10 +0000 (00:51 +0000)
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
lustre/llite/file.c

index 1b1fbde..c2c847c 100644 (file)
@@ -7,6 +7,7 @@ tbd         Cluster File Systems, Inc. <info@clusterfs.com>
        - 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. <info@clusterfs.com>
        * version 1.2.4
index fec8e34..e419317 100644 (file)
@@ -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);