linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Bob Liu <bob.liu@oracle.com>
Cc: linux-block@vger.kernel.org, axboe@kernel.dk,
	martin.petersen@oracle.com, linux-fsdevel@vger.kernel.org,
	io-uring@vger.kernel.org
Subject: Re: [PATCH 3/4] block_dev: support protect information passthrough
Date: Wed, 26 Feb 2020 08:04:56 -0800	[thread overview]
Message-ID: <20200226160456.GC8044@magnolia> (raw)
In-Reply-To: <20200226083719.4389-4-bob.liu@oracle.com>

On Wed, Feb 26, 2020 at 04:37:18PM +0800, Bob Liu wrote:
> 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);

If you're just going to mash all the error codes into IOERR, then this
could very well become bio_io_error() ?

--D

> +					break;
> +				}
> +			}
> +
>  			qc = submit_bio(bio);
>  
>  			if (polled)
> -- 
> 2.9.5
> 

  reply	other threads:[~2020-02-26 16:05 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 ` [PATCH 3/4] block_dev: support protect information passthrough Bob Liu
2020-02-26 16:04   ` Darrick J. Wong [this message]
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=20200226160456.GC8044@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=bob.liu@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).