From 89f489ef9a18b5fea0571e2606dfdf064777626b Mon Sep 17 00:00:00 2001 From: Patrick Farrell Date: Tue, 14 Feb 2023 13:33:35 -0500 Subject: [PATCH] LU-13805 clio: Add write to sdio Unaligned DIO will need to know if an sdio is a write or a read, so we add this info to the sub-dio. Test-parameters: trivial Signed-off-by: Patrick Farrell Change-Id: I8ee042ca5a0461db672ba98b7fa6c64b01a8bba2 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49991 Reviewed-by: Zhenyu Xu Reviewed-by: Oleg Drokin Reviewed-by: Qian Yingjin Tested-by: jenkins Tested-by: Maloo --- lustre/include/cl_object.h | 6 ++++-- lustre/llite/rw26.c | 2 +- lustre/obdclass/cl_io.c | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index bdad8d8..da23150 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -2513,7 +2513,8 @@ int cl_sync_io_wait_recycle(const struct lu_env *env, struct cl_sync_io *anchor, long timeout, int ioret); struct cl_dio_aio *cl_dio_aio_alloc(struct kiocb *iocb, struct cl_object *obj, bool is_aio); -struct cl_sub_dio *cl_sub_dio_alloc(struct cl_dio_aio *ll_aio, bool sync); +struct cl_sub_dio *cl_sub_dio_alloc(struct cl_dio_aio *ll_aio, bool write, + bool sync); void cl_dio_aio_free(const struct lu_env *env, struct cl_dio_aio *aio); void cl_sub_dio_free(struct cl_sub_dio *sdio); static inline void cl_sync_io_init(struct cl_sync_io *anchor, int nr) @@ -2572,7 +2573,8 @@ struct cl_sub_dio { ssize_t csd_bytes; struct cl_dio_aio *csd_ll_aio; struct ll_dio_pages csd_dio_pages; - unsigned csd_creator_free:1; + unsigned csd_creator_free:1, + csd_write:1; }; #if defined(HAVE_DIRECTIO_ITER) || defined(HAVE_IOV_ITER_RW) || \ defined(HAVE_DIRECTIO_2ARGS) diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index f5f85ad8..aad6b20 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -545,7 +545,7 @@ ll_direct_IO_impl(struct kiocb *iocb, struct iov_iter *iter, int rw) * otherwise it is freed on the final call to cl_sync_io_note * (either in this function or from a ptlrpcd daemon) */ - sdio = cl_sub_dio_alloc(ll_dio_aio, sync_submit); + sdio = cl_sub_dio_alloc(ll_dio_aio, rw == WRITE, sync_submit); if (!sdio) GOTO(out, result = -ENOMEM); diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index e288e42..d4d85fa 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -1241,7 +1241,8 @@ struct cl_dio_aio *cl_dio_aio_alloc(struct kiocb *iocb, struct cl_object *obj, } EXPORT_SYMBOL(cl_dio_aio_alloc); -struct cl_sub_dio *cl_sub_dio_alloc(struct cl_dio_aio *ll_aio, bool sync) +struct cl_sub_dio *cl_sub_dio_alloc(struct cl_dio_aio *ll_aio, bool write, + bool sync) { struct cl_sub_dio *sdio; @@ -1258,6 +1259,7 @@ struct cl_sub_dio *cl_sub_dio_alloc(struct cl_dio_aio *ll_aio, bool sync) sdio->csd_ll_aio = ll_aio; atomic_add(1, &ll_aio->cda_sync.csi_sync_nr); sdio->csd_creator_free = sync; + sdio->csd_write = write; } return sdio; } -- 1.8.3.1