Whamcloud - gitweb
LU-13799 llite: Simplify cda_no_aio_complete use 54/44154/8
authorPatrick Farrell <pfarrell@whamcloud.com>
Fri, 30 Jul 2021 16:11:03 +0000 (12:11 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 11 Jan 2022 06:34:28 +0000 (06:34 +0000)
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.

Signed-off-by: Patrick Farrell <pfarrell@whamcloud.com>
Change-Id: I1b91e5b8f42971cb37780597402c4ee94f82a963
Reviewed-on: https://review.whamcloud.com/44154
Reviewed-by: Wang Shilong <wangshilong1991@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/cl_io.c

index dc2be4a..504bc8c 100644 (file)
@@ -1231,7 +1231,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)
+       if (!aio->cda_no_aio_complete)
                aio_complete(aio->cda_iocb, ret ?: aio->cda_bytes, 0);
 
        EXIT;
@@ -1251,7 +1251,10 @@ struct cl_dio_aio *cl_aio_alloc(struct kiocb *iocb, struct cl_object *obj)
                                       NULL : aio, 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;
        }