From: Kanchan Joshi <[email protected]>
To: [email protected], [email protected], [email protected],
[email protected]
Cc: [email protected], [email protected],
[email protected], Anuj Gupta <[email protected]>
Subject: [RFC PATCH 1/4] io_uring/rw: Get rid of flags field in struct io_rw
Date: Sat, 23 Mar 2024 00:20:20 +0530 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
From: Anuj Gupta <[email protected]>
Get rid of the flags field in io_rw. Flags can be set in kiocb->flags
during prep rather than doing it while issuing the I/O in io_read/io_write.
Signed-off-by: Anuj Gupta <[email protected]>
---
io_uring/rw.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/io_uring/rw.c b/io_uring/rw.c
index 47e097ab5d7e..40f6c2a59928 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -27,7 +27,6 @@ struct io_rw {
struct kiocb kiocb;
u64 addr;
u32 len;
- rwf_t flags;
};
static inline bool io_file_supports_nowait(struct io_kiocb *req)
@@ -78,10 +77,16 @@ static int io_iov_buffer_select_prep(struct io_kiocb *req)
int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe)
{
struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
+ struct kiocb *kiocb = &rw->kiocb;
unsigned ioprio;
int ret;
- rw->kiocb.ki_pos = READ_ONCE(sqe->off);
+ kiocb->ki_flags = 0;
+ ret = kiocb_set_rw_flags(kiocb, READ_ONCE(sqe->rw_flags));
+ if (unlikely(ret))
+ return ret;
+
+ kiocb->ki_pos = READ_ONCE(sqe->off);
/* used for fixed read/write too - just read unconditionally */
req->buf_index = READ_ONCE(sqe->buf_index);
@@ -91,15 +96,14 @@ int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe)
if (ret)
return ret;
- rw->kiocb.ki_ioprio = ioprio;
+ kiocb->ki_ioprio = ioprio;
} else {
- rw->kiocb.ki_ioprio = get_current_ioprio();
+ kiocb->ki_ioprio = get_current_ioprio();
}
- rw->kiocb.dio_complete = NULL;
+ kiocb->dio_complete = NULL;
rw->addr = READ_ONCE(sqe->addr);
rw->len = READ_ONCE(sqe->len);
- rw->flags = READ_ONCE(sqe->rw_flags);
return 0;
}
@@ -720,7 +724,6 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode)
struct kiocb *kiocb = &rw->kiocb;
struct io_ring_ctx *ctx = req->ctx;
struct file *file = req->file;
- int ret;
if (unlikely(!(file->f_mode & mode)))
return -EBADF;
@@ -728,10 +731,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode)
if (!(req->flags & REQ_F_FIXED_FILE))
req->flags |= io_file_get_flags(file);
- kiocb->ki_flags = file->f_iocb_flags;
- ret = kiocb_set_rw_flags(kiocb, rw->flags);
- if (unlikely(ret))
- return ret;
+ kiocb->ki_flags |= file->f_iocb_flags;
kiocb->ki_flags |= IOCB_ALLOC_CACHE;
/*
--
2.25.1
next prev parent reply other threads:[~2024-03-22 18:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240322185729epcas5p350c5054b5b519a6aa9d1b35ba3709563@epcas5p3.samsung.com>
2024-03-22 18:50 ` [RFC PATCH 0/4] Read/Write with meta buffer Kanchan Joshi
[not found] ` <CGME20240322185731epcas5p20fc525f793a537310f7b3ae5ba5bc75b@epcas5p2.samsung.com>
2024-03-22 18:50 ` Kanchan Joshi [this message]
2024-03-27 23:30 ` [RFC PATCH 1/4] io_uring/rw: Get rid of flags field in struct io_rw David Wei
2024-03-27 23:32 ` David Wei
[not found] ` <CGME20240322185734epcas5p2cd407dac97cd157c1833c4022ea84805@epcas5p2.samsung.com>
2024-03-22 18:50 ` [RFC PATCH 2/4] io_uring/rw: support read/write with metadata Kanchan Joshi
[not found] ` <CGME20240322185736epcas5p3d0093948e9904e775994bcbe735ea0c5@epcas5p3.samsung.com>
2024-03-22 18:50 ` [RFC PATCH 3/4] block: modify bio_integrity_map_user to accept iov_iter as argument Kanchan Joshi
[not found] ` <CGME20240322185738epcas5p20e5bd448ce83350eb9e79c929c4a9b2b@epcas5p2.samsung.com>
2024-03-22 18:50 ` [RFC PATCH 4/4] block: add support to pass the meta buffer Kanchan Joshi
2024-03-27 23:38 ` [RFC PATCH 0/4] Read/Write with " Jens Axboe
2024-03-28 12:03 ` Kanchan Joshi
2024-04-06 21:30 ` Pavel Begunkov
2024-04-25 19:05 ` Kanchan Joshi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox