Skip to contentSkip to conversation

io_uring: clean up io_prep_rw_setup()

PATCH Applied David Wei 4 participants 4 messages Dec 7, 2024 io_uring

lore
Share & tools
lore

David Wei

author
#0 lore raw

PATCH 1/1 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.

---
 io_uring/rw.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
io_uring/rw.c +1 -7
index 04e4467ab0ee..5b24fd8b69f6 100644
@@ -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)
Signature · 1 line
2.43.5
Tested-by on v1 1/1
#2 lore raw
In reply to David Wei
Quoted 44 lines

-----Original Message-----
From: David Wei <[email protected]>
Sent: Saturday, December 7, 2024 8:42 AM
To: [email protected]
Cc: David Wei <[email protected]>; Jens Axboe <[email protected]>; Pavel Begunkov <[email protected]>
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.

---
 io_uring/rw.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
io_uring/rw.c index 04e4467ab0ee..5b24fd8b69f6 renamed from io_uring/rw.c +0 -0

100644

io_uring/rw.c +1 -7
@@ -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);
 }
 
Quoted 4 lines

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.

maintainer Applied
#3 lore raw
In reply to David Wei
Quoted 5 lines · David Wei

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,

Signature · 1 line
Jens Axboe