[PATCH-RESEND 07/23] staging/lustre/ldlm: suppress useless lock RPC for layout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: jcl <jacques-charles.lafoucriere@xxxxxx>

In ldlm_lock_decref_internal() when l_lvb_data is freed to
reduce memory consumption, LDLM_FL_LVB_READY is not
cleared, so later when the lock is reused lvb is not
updated. But clearing LDLM_FL_LVB_READY forces layout refetch
at each file access, so the better is to remove the optimization.
The use case is after a restore in HSM.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3280
Lustre-change: http://review.whamcloud.com/6268
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@xxxxxx>
Reviewed-by: Fan Yong <fan.yong@xxxxxxxxx>
Reviewed-by: Andreas Dilger <andreas.dilger@xxxxxxxxx>
Reviewed-by: Oleg Drokin <oleg.drokin@xxxxxxxxx>
Signed-off-by: Peng Tao <tao.peng@xxxxxxx>
Signed-off-by: Andreas Dilger <andreas.dilger@xxxxxxxxx>
---
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c |   14 --------------
 drivers/staging/lustre/lustre/llite/file.c     |    5 +++--
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index bd39e1c..33b76a1 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -861,20 +861,6 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, __u32 mode)
 
 	ldlm_lock_decref_internal_nolock(lock, mode);
 
-	/* release lvb data for layout lock */
-	if (ns_is_client(ns) && !lock->l_readers && !lock->l_writers &&
-	    ldlm_has_layout(lock) && lock->l_flags & LDLM_FL_LVB_READY) {
-		/* this is the last user of a layout lock and stripe has
-		 * been set up, lvb is no longer used.
-		 * This may be a large amount of memory, so we should free it
-		 * when possible. */
-		if (lock->l_lvb_data != NULL) {
-			OBD_FREE_LARGE(lock->l_lvb_data, lock->l_lvb_len);
-			lock->l_lvb_data = NULL;
-			lock->l_lvb_len = 0;
-		}
-	}
-
 	if (lock->l_flags & LDLM_FL_LOCAL &&
 	    !lock->l_readers && !lock->l_writers) {
 		/* If this is a local lock on a server namespace and this was
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 8c2cf23..5bb2367 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3009,6 +3009,9 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, ldlm_mode_t mode,
 	LDLM_DEBUG(lock, "File %p/"DFID" being reconfigured: %d.\n",
 		inode, PFID(&lli->lli_fid), reconf);
 
+	/* in case this is a caching lock and reinstate with new inode */
+	md_set_lock_data(sbi->ll_md_exp, &lockh->cookie, inode, NULL);
+
 	lock_res_and_lock(lock);
 	lvb_ready = !!(lock->l_flags & LDLM_FL_LVB_READY);
 	unlock_res_and_lock(lock);
@@ -3177,8 +3180,6 @@ again:
 
 	ll_finish_md_op_data(op_data);
 
-	md_set_lock_data(sbi->ll_md_exp, &it.d.lustre.it_lock_handle, inode, NULL);
-
 	mode = it.d.lustre.it_lock_mode;
 	it.d.lustre.it_lock_mode = 0;
 	ll_intent_drop_lock(&it);
-- 
1.7.9.5

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux