* [PATCH for-next] io_uring: clean up io_prep_rw_setup()
@ 2024-12-07 0:41 David Wei
2024-12-07 4:32 ` Anuj gupta
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: David Wei @ 2024-12-07 0:41 UTC (permalink / raw)
To: io-uring; +Cc: David Wei, Jens Axboe, Pavel Begunkov
Remove unnecessary call to iov_iter_save_state() in io_prep_rw_setup()
as io_import_iovec() already does this. Then the result from
io_import_iovec() can be returned directly.
Signed-off-by: David Wei <dw@davidwei.uk>
---
io_uring/rw.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 04e4467ab0ee..5b24fd8b69f6 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -240,7 +240,6 @@ static int io_rw_alloc_async(struct io_kiocb *req)
static int io_prep_rw_setup(struct io_kiocb *req, int ddir, bool do_import)
{
struct io_async_rw *rw;
- int ret;
if (io_rw_alloc_async(req))
return -ENOMEM;
@@ -249,12 +248,7 @@ static int io_prep_rw_setup(struct io_kiocb *req, int ddir, bool do_import)
return 0;
rw = req->async_data;
- ret = io_import_iovec(ddir, req, rw, 0);
- if (unlikely(ret < 0))
- return ret;
-
- iov_iter_save_state(&rw->iter, &rw->iter_state);
- return 0;
+ return io_import_iovec(ddir, req, rw, 0);
}
static inline void io_meta_save_state(struct io_async_rw *io)
--
2.43.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH for-next] io_uring: clean up io_prep_rw_setup()
2024-12-07 0:41 [PATCH for-next] io_uring: clean up io_prep_rw_setup() David Wei
@ 2024-12-07 4:32 ` Anuj gupta
2024-12-07 5:19 ` lizetao
2024-12-07 15:16 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Anuj gupta @ 2024-12-07 4:32 UTC (permalink / raw)
To: David Wei; +Cc: io-uring, Jens Axboe, Pavel Begunkov
Looks good.
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH for-next] io_uring: clean up io_prep_rw_setup()
2024-12-07 0:41 [PATCH for-next] io_uring: clean up io_prep_rw_setup() David Wei
2024-12-07 4:32 ` Anuj gupta
@ 2024-12-07 5:19 ` lizetao
2024-12-07 15:16 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: lizetao @ 2024-12-07 5:19 UTC (permalink / raw)
To: David Wei, io-uring@vger.kernel.org; +Cc: Jens Axboe, Pavel Begunkov
> -----Original Message-----
> From: David Wei <dw@davidwei.uk>
> Sent: Saturday, December 7, 2024 8:42 AM
> To: io-uring@vger.kernel.org
> Cc: David Wei <dw@davidwei.uk>; Jens Axboe <axboe@kernel.dk>; Pavel
> Begunkov <asml.silence@gmail.com>
> Subject: [PATCH for-next] io_uring: clean up io_prep_rw_setup()
>
> Remove unnecessary call to iov_iter_save_state() in io_prep_rw_setup() as
> io_import_iovec() already does this. Then the result from
> io_import_iovec() can be returned directly.
>
> Signed-off-by: David Wei <dw@davidwei.uk>
> ---
> io_uring/rw.c | 8 +-------
> 1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/io_uring/rw.c b/io_uring/rw.c index 04e4467ab0ee..5b24fd8b69f6
> 100644
> --- a/io_uring/rw.c
> +++ b/io_uring/rw.c
> @@ -240,7 +240,6 @@ static int io_rw_alloc_async(struct io_kiocb *req)
> static int io_prep_rw_setup(struct io_kiocb *req, int ddir, bool do_import) {
> struct io_async_rw *rw;
> - int ret;
>
> if (io_rw_alloc_async(req))
> return -ENOMEM;
> @@ -249,12 +248,7 @@ static int io_prep_rw_setup(struct io_kiocb *req, int
> ddir, bool do_import)
> return 0;
>
> rw = req->async_data;
> - ret = io_import_iovec(ddir, req, rw, 0);
> - if (unlikely(ret < 0))
> - return ret;
> -
> - iov_iter_save_state(&rw->iter, &rw->iter_state);
> - return 0;
> + return io_import_iovec(ddir, req, rw, 0);
> }
>
> static inline void io_meta_save_state(struct io_async_rw *io)
> --
> 2.43.5
>
Look good to me. No logic changes, only compilation and testing.
Tested-by: Li Zetao <lizetao1@huawei.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH for-next] io_uring: clean up io_prep_rw_setup()
2024-12-07 0:41 [PATCH for-next] io_uring: clean up io_prep_rw_setup() David Wei
2024-12-07 4:32 ` Anuj gupta
2024-12-07 5:19 ` lizetao
@ 2024-12-07 15:16 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2024-12-07 15:16 UTC (permalink / raw)
To: io-uring, David Wei; +Cc: Pavel Begunkov
On Fri, 06 Dec 2024 16:41:44 -0800, David Wei wrote:
> Remove unnecessary call to iov_iter_save_state() in io_prep_rw_setup()
> as io_import_iovec() already does this. Then the result from
> io_import_iovec() can be returned directly.
>
>
Applied, thanks!
[1/1] io_uring: clean up io_prep_rw_setup()
commit: 179e7e105a780f582f73dd7dc4ece3b65c84eece
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-07 15:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-07 0:41 [PATCH for-next] io_uring: clean up io_prep_rw_setup() David Wei
2024-12-07 4:32 ` Anuj gupta
2024-12-07 5:19 ` lizetao
2024-12-07 15:16 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox