From: Bob Liu <[email protected]>
To: [email protected]
Cc: [email protected], [email protected],
[email protected], [email protected],
[email protected], Bob Liu <[email protected]>
Subject: [PATCH 1/4] io_uring: add IORING_OP_READ{WRITE}V_PI cmd
Date: Wed, 26 Feb 2020 16:37:16 +0800 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
Add read and write with protect information command.
Signed-off-by: Bob Liu <[email protected]>
---
fs/io_uring.c | 12 ++++++++++++
include/linux/fs.h | 1 +
include/uapi/linux/io_uring.h | 2 ++
3 files changed, 15 insertions(+)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 562e3a1..c43d96a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -630,12 +630,14 @@ static inline bool io_prep_async_work(struct io_kiocb *req,
switch (req->opcode) {
case IORING_OP_WRITEV:
+ case IORING_OP_WRITEV_PI:
case IORING_OP_WRITE_FIXED:
/* only regular files should be hashed for writes */
if (req->flags & REQ_F_ISREG)
do_hashed = true;
/* fall-through */
case IORING_OP_READV:
+ case IORING_OP_READV_PI:
case IORING_OP_READ_FIXED:
case IORING_OP_SENDMSG:
case IORING_OP_RECVMSG:
@@ -1505,6 +1507,12 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe,
kiocb->ki_pos = READ_ONCE(sqe->off);
kiocb->ki_flags = iocb_flags(kiocb->ki_filp);
kiocb->ki_hint = ki_hint_validate(file_write_hint(kiocb->ki_filp));
+ if (req->opcode == IORING_OP_READV_PI ||
+ req->opcode == IORING_OP_WRITEV_PI) {
+ if (!(req->file->f_flags & O_DIRECT))
+ return -EINVAL;
+ kiocb->ki_flags |= IOCB_USE_PI;
+ }
ioprio = READ_ONCE(sqe->ioprio);
if (ioprio) {
@@ -3065,10 +3073,12 @@ static int io_req_defer_prep(struct io_kiocb *req,
case IORING_OP_NOP:
break;
case IORING_OP_READV:
+ case IORING_OP_READV_PI:
case IORING_OP_READ_FIXED:
ret = io_read_prep(req, sqe, true);
break;
case IORING_OP_WRITEV:
+ case IORING_OP_WRITEV_PI:
case IORING_OP_WRITE_FIXED:
ret = io_write_prep(req, sqe, true);
break;
@@ -3156,6 +3166,7 @@ static int io_issue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
case IORING_OP_NOP:
ret = io_nop(req);
break;
+ case IORING_OP_READV_PI:
case IORING_OP_READV:
case IORING_OP_READ_FIXED:
if (sqe) {
@@ -3166,6 +3177,7 @@ static int io_issue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
ret = io_read(req, nxt, force_nonblock);
break;
case IORING_OP_WRITEV:
+ case IORING_OP_WRITEV_PI:
case IORING_OP_WRITE_FIXED:
if (sqe) {
ret = io_write_prep(req, sqe, force_nonblock);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 98e0349..65fda07 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -314,6 +314,7 @@ enum rw_hint {
#define IOCB_SYNC (1 << 5)
#define IOCB_WRITE (1 << 6)
#define IOCB_NOWAIT (1 << 7)
+#define IOCB_USE_PI (1 << 8)
struct kiocb {
struct file *ki_filp;
diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index a3300e1..98fa3f1 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -62,6 +62,8 @@ enum {
IORING_OP_NOP,
IORING_OP_READV,
IORING_OP_WRITEV,
+ IORING_OP_READV_PI,
+ IORING_OP_WRITEV_PI,
IORING_OP_FSYNC,
IORING_OP_READ_FIXED,
IORING_OP_WRITE_FIXED,
--
2.9.5
next prev parent reply other threads:[~2020-02-26 8:40 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-26 8:37 [RFC PATCH 0/4] userspace PI passthrough via io_uring Bob Liu
2020-02-26 8:37 ` Bob Liu [this message]
2020-02-26 14:24 ` [PATCH 1/4] io_uring: add IORING_OP_READ{WRITE}V_PI cmd Jens Axboe
2020-02-26 15:57 ` Christoph Hellwig
2020-02-26 15:58 ` Jens Axboe
2020-02-26 16:03 ` Darrick J. Wong
2020-02-26 16:53 ` Christoph Hellwig
2020-02-27 9:19 ` Bob Liu
2020-02-27 9:05 ` Bob Liu
2020-02-26 8:37 ` [PATCH 2/4] bio-integrity: introduce two funcs handle protect information Bob Liu
2020-02-26 16:03 ` Darrick J. Wong
2020-02-27 9:23 ` Bob Liu
2020-02-26 8:37 ` [PATCH 3/4] block_dev: support protect information passthrough Bob Liu
2020-02-26 16:04 ` Darrick J. Wong
2020-02-26 8:37 ` [PATCH 4/4] liburing/test: add testcase for " Bob Liu
2020-02-26 14:25 ` [RFC PATCH 0/4] userspace PI passthrough via io_uring Jens Axboe
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] \
/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