Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1325602

Re: [dm-devel] [PATCH] block: do not return -EOPNOTSUPP only when issue a discard request

From Lukáš Czerner <lczerner@redhat.com>
Newsgroups linux.kernel
Subject Re: [dm-devel] [PATCH] block: do not return -EOPNOTSUPP only when issue a discard request
Date 2016-02-03 17:20 +0100
Message-ID <qY8jU-4ft-21@gated-at.bofh.it> (permalink)
References <qY2o9-hJ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, 3 Feb 2016, jiangyiwen wrote:

> Date: Wed, 3 Feb 2016 17:54:36 +0800
> From: jiangyiwen <jiangyiwen@huawei.com>
> To: axboe@kernel.dk, linux-kernel@vger.kernel.org
> Cc: dm-devel@redhat.com, martin.petersen@oracle.com,
>     Lukáš Czerner <lczerner@redhat.com>, xuejiufei@huawei.com,
>     "Qijiang (Joseph, Euler)" <joseph.qi@huawei.com>
> Subject: [dm-devel] [PATCH] block: do not return -EOPNOTSUPP only when issue a
>      discard request
> 
> commit 8af1954d172a("blkdev: Do not return -EOPNOTSUPP if discard
> is supported") only solve the situation of discard, because When
> applications issue a discard request to device, they can't expect
> deterministic behaviour. However, WRITE SAME should not ignore error
> with EOPNOTSUPP, because if applications issue WRITE SAME requests to
> device, it should return deterministic results to applications
> according to the T10 standard, or else it will cause an inconsistent
> state between upper layer and bottom layer.
> 
> So ignoring error with EOPNOTSUPP only in discard situation.
> 
> Signed-off-by: Yiwen Jiang <jiangyiwen@huawei.com>

Looks good.

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

Thanks!
-Lukas

> ---
>  block/blk-lib.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/block/blk-lib.c b/block/blk-lib.c
> index 9ebf653..e4f02f1 100644
> --- a/block/blk-lib.c
> +++ b/block/blk-lib.c
> @@ -19,7 +19,9 @@ static void bio_batch_end_io(struct bio *bio)
>  {
>  	struct bio_batch *bb = bio->bi_private;
> 
> -	if (bio->bi_error && bio->bi_error != -EOPNOTSUPP)
> +	/* ignore -EOPNOTSUPP only when issue a discard request */
> +	if (bio->bi_error && (!(bio->bi_rw & REQ_DISCARD) ||
> +			(bio->bi_error != -EOPNOTSUPP)))
>  		bb->error = bio->bi_error;
>  	if (atomic_dec_and_test(&bb->done))
>  		complete(bb->wait);
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[dm-devel] [PATCH] block: do not return -EOPNOTSUPP only when issue a  discard request jiangyiwen <jiangyiwen@huawei.com> - 2016-02-03 11:00 +0100
  Re: [dm-devel] [PATCH] block: do not return -EOPNOTSUPP only when  issue a discard request Lukáš Czerner <lczerner@redhat.com> - 2016-02-03 17:20 +0100
  Re: [dm-devel] [PATCH] block: do not return -EOPNOTSUPP only when issue a discard request "Martin K. Petersen" <martin.petersen@oracle.com> - 2016-02-03 23:10 +0100

csiph-web