All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bob Liu <bob.liu@oracle.com>
To: linux-block@vger.kernel.org
Cc: axboe@kernel.dk, martin.petersen@oracle.com,
	linux-fsdevel@vger.kernel.org, darrick.wong@oracle.com,
	io-uring@vger.kernel.org, Bob Liu <bob.liu@oracle.com>
Subject: [PATCH 3/4] block_dev: support protect information passthrough
Date: Wed, 26 Feb 2020 16:37:18 +0800	[thread overview]
Message-ID: <20200226083719.4389-4-bob.liu@oracle.com> (raw)
In-Reply-To: <20200226083719.4389-1-bob.liu@oracle.com>

Support protect information passed from use sapce, on direct io
is considered now.

Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
 fs/block_dev.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 69bf2fb..10e3299 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -348,6 +348,13 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
 	loff_t pos = iocb->ki_pos;
 	blk_qc_t qc = BLK_QC_T_NONE;
 	int ret = 0;
+	struct iovec *pi_iov;
+
+	if (iocb->ki_flags & IOCB_USE_PI) {
+		ret = iter_slice_protect_info(iter, nr_pages, &pi_iov);
+		if (ret)
+			return -EINVAL;
+	}
 
 	if ((pos | iov_iter_alignment(iter)) &
 	    (bdev_logical_block_size(bdev) - 1))
@@ -411,6 +418,16 @@ __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter, int nr_pages)
 				polled = true;
 			}
 
+			/* Add protection information to bio */
+			if (iocb->ki_flags & IOCB_USE_PI) {
+				ret = bio_integrity_prep_from_iovec(bio, pi_iov);
+				if (ret) {
+					bio->bi_status = BLK_STS_IOERR;
+					bio_endio(bio);
+					break;
+				}
+			}
+
 			qc = submit_bio(bio);
 
 			if (polled)
-- 
2.9.5


  parent reply	other threads:[~2020-02-26  8:39 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 ` [PATCH 1/4] io_uring: add IORING_OP_READ{WRITE}V_PI cmd Bob Liu
2020-02-26 14:24   ` 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 ` Bob Liu [this message]
2020-02-26 16:04   ` [PATCH 3/4] block_dev: support protect information passthrough 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 \
    --in-reply-to=20200226083719.4389-4-bob.liu@oracle.com \
    --to=bob.liu@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=darrick.wong@oracle.com \
    --cc=io-uring@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.