[lustre-devel] [PATCH 14/24] lustre: llite: Unify range unlock

James Simmons jsimmons at infradead.org
Mon Sep 5 18:55:27 PDT 2022


From: Patrick Farrell <pfarrell at whamcloud.com>

Correct parallel_dio condition and unify range unlock code
block.

WC-bug-id: https://jira.whamcloud.com/browse/LU-15811
Lustre-commit: 36c34af60767bd5da ("LU-15811 llite: Unify range unlock")
Signed-off-by: Patrick Farrell <pfarrell at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/48000
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Yingjin Qian <qian at ddn.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/llite/file.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/fs/lustre/llite/file.c b/fs/lustre/llite/file.c
index 92e450f..8152821 100644
--- a/fs/lustre/llite/file.c
+++ b/fs/lustre/llite/file.c
@@ -1750,20 +1750,12 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot,
 		ll_cl_add(inode, env, io, LCC_RW);
 		rc = cl_io_loop(env, io);
 		ll_cl_remove(inode, env);
-
-		if (range_locked && !is_parallel_dio) {
-			CDEBUG(D_VFSTRACE, "Range unlock [%llu, %llu]\n",
-			       range.rl_start,
-			       range.rl_last);
-			range_unlock(&lli->lli_write_tree, &range);
-			range_locked = false;
-		}
 	} else {
 		/* cl_io_rw_init() handled IO */
 		rc = io->ci_result;
 	}
 
-	if (is_parallel_dio) {
+	if (io->ci_dio_aio && !is_aio) {
 		struct cl_sync_io *anchor = &io->ci_dio_aio->cda_sync;
 
 		/* for dio, EIOCBQUEUED is an implementation detail,
@@ -1780,11 +1772,14 @@ static void ll_heat_add(struct inode *inode, enum cl_io_type iot,
 		rc2 = cl_sync_io_wait_recycle(env, anchor, 0, 0);
 		if (rc2 < 0)
 			rc = rc2;
+	}
 
-		if (range_locked) {
-			range_unlock(&lli->lli_write_tree, &range);
-			range_locked = false;
-		}
+	if (range_locked) {
+		CDEBUG(D_VFSTRACE, "Range lock [%llu, %llu]\n",
+		       range.rl_start,
+		       range.rl_last);
+		range_unlock(&lli->lli_write_tree, &range);
+		range_locked = false;
 	}
 
 	/*
-- 
1.8.3.1



More information about the lustre-devel mailing list