diff mbox series

[22/24] lustre: llite: Simplify cda_no_aio_complete use

Message ID 1642124283-10148-23-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: update to OpenSFS Jan 13, 2022 | expand

Commit Message

James Simmons Jan. 14, 2022, 1:38 a.m. UTC
From: Patrick Farrell <pfarrell@whamcloud.com>

It is better to handle AIO and DIO the same as much as
possible, limiting the difference to setup if possible.

In this spirit, move the check for DIO (is_sync_kiocb()) to
the setup function rather than cleanup and just use
no_aio_complete.

WC-bug-id: https://jira.whamcloud.com/browse/LU-13799
Lustre-commit: b60bd21ec5d5f34ed ("LU-13799 llite: Simplify cda_no_aio_complete use")
Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/44154
Reviewed-by: Wang Shilong <wangshilong1991@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/obdclass/cl_io.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/fs/lustre/obdclass/cl_io.c b/fs/lustre/obdclass/cl_io.c
index f33a5f38..675116d 100644
--- a/fs/lustre/obdclass/cl_io.c
+++ b/fs/lustre/obdclass/cl_io.c
@@ -1135,8 +1135,7 @@  static void cl_aio_end(const struct lu_env *env, struct cl_sync_io *anchor)
 		cl_page_put(env, page);
 	}
 
-	if (!is_sync_kiocb(aio->cda_iocb) && !aio->cda_no_aio_complete &&
-	    aio->cda_iocb->ki_complete)
+	if (!aio->cda_no_aio_complete)
 		aio->cda_iocb->ki_complete(aio->cda_iocb,
 					   ret ?: aio->cda_bytes, 0);
 }
@@ -1156,7 +1155,10 @@  struct cl_dio_aio *cl_aio_alloc(struct kiocb *iocb, struct cl_object *obj)
 				       cl_aio_end);
 		cl_page_list_init(&aio->cda_pages);
 		aio->cda_iocb = iocb;
-		aio->cda_no_aio_complete = 0;
+		if (is_sync_kiocb(iocb))
+			aio->cda_no_aio_complete = 1;
+		else
+			aio->cda_no_aio_complete = 0;
 		cl_object_get(obj);
 		aio->cda_obj = obj;
 	}