diff mbox series

[14/24] lustre: llite: Unify range unlock

Message ID 1662429337-18737-15-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: update to OpenSFS tree Sept 5, 2022 | expand

Commit Message

James Simmons Sept. 6, 2022, 1:55 a.m. UTC
From: Patrick Farrell <pfarrell@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@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/48000
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/file.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
diff mbox series

Patch

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;
 	}
 
 	/*