public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: "Richard Weinberger" <richard@nod.at>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Josef Bacik" <josef@toxicpanda.com>,
	"Ilya Dryomov" <idryomov@gmail.com>,
	"Dongsheng Yang" <dongsheng.yang@easystack.cn>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	linux-um@lists.infradead.org, linux-block@vger.kernel.org,
	nbd@other.debian.org, ceph-devel@vger.kernel.org,
	xen-devel@lists.xenproject.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH 01/12] ubd: untagle discard vs write zeroes not support handling
Date: Wed, 29 May 2024 17:00:34 +0900	[thread overview]
Message-ID: <8878dcb7-5f18-4e34-b917-ee5e1ee15cff@kernel.org> (raw)
In-Reply-To: <20240529050507.1392041-2-hch@lst.de>

On 5/29/24 14:04, Christoph Hellwig wrote:
> Discard and Write Zeroes are different operation and implemented
> by different fallocate opcodes for ubd.  If one fails the other one
> can work and vice versa.
> 
> Split the code to disable the operations in ubd_handler to only
> disable the operation that actually failed.
> 
> Fixes: 50109b5a03b4 ("um: Add support for DISCARD in the UBD Driver")
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/um/drivers/ubd_kern.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
> index ef805eaa9e013d..a79a3b7c33a647 100644
> --- a/arch/um/drivers/ubd_kern.c
> +++ b/arch/um/drivers/ubd_kern.c
> @@ -471,9 +471,14 @@ static void ubd_handler(void)
>  		for (count = 0; count < n/sizeof(struct io_thread_req *); count++) {
>  			struct io_thread_req *io_req = (*irq_req_buffer)[count];
>  
> -			if ((io_req->error == BLK_STS_NOTSUPP) && (req_op(io_req->req) == REQ_OP_DISCARD)) {
> -				blk_queue_max_discard_sectors(io_req->req->q, 0);
> -				blk_queue_max_write_zeroes_sectors(io_req->req->q, 0);
> +			if (io_req->error == BLK_STS_NOTSUPP) {
> +				struct request_queue *q = io_req->req->q;
> +
> +				if (req_op(io_req->req) == REQ_OP_DISCARD)
> +					blk_queue_max_discard_sectors(q, 0);
> +				if (req_op(io_req->req) == REQ_OP_WRITE_ZEROES)

Nit: this can be an "else if".

Otherwise, looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

> +					blk_queue_max_write_zeroes_sectors(q,
> +							0);
>  			}
>  			blk_mq_end_request(io_req->req, io_req->error);
>  			kfree(io_req);

-- 
Damien Le Moal
Western Digital Research


  reply	other threads:[~2024-05-29  8:00 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29  5:04 convert the SCSI ULDs to the atomic queue limits API Christoph Hellwig
2024-05-29  5:04 ` [PATCH 01/12] ubd: untagle discard vs write zeroes not support handling Christoph Hellwig
2024-05-29  8:00   ` Damien Le Moal [this message]
2024-05-30 19:44   ` Bart Van Assche
2024-05-29  5:04 ` [PATCH 02/12] block: take io_opt and io_min into account for max_sectors Christoph Hellwig
2024-05-29  8:05   ` Damien Le Moal
2024-05-30 19:47   ` Bart Van Assche
2024-05-30 19:48   ` Ilya Dryomov
2024-05-31  5:54     ` Christoph Hellwig
2024-05-31  6:48       ` Ilya Dryomov
2024-05-31  6:56         ` Christoph Hellwig
2024-05-29  5:04 ` [PATCH 03/12] sd: simplify the ZBC case in provisioning_mode_store Christoph Hellwig
2024-05-29  8:07   ` Damien Le Moal
2024-05-30 19:48   ` Bart Van Assche
2024-05-29  5:04 ` [PATCH 04/12] sd: add a sd_disable_discard helper Christoph Hellwig
2024-05-29  8:10   ` Damien Le Moal
2024-05-30 19:50   ` Bart Van Assche
2024-05-29  5:04 ` [PATCH 05/12] sd: add a sd_disable_write_same helper Christoph Hellwig
2024-05-29  8:12   ` Damien Le Moal
2024-05-30 19:51   ` Bart Van Assche
2024-05-29  5:04 ` [PATCH 06/12] sd: simplify the disable case in sd_config_discard Christoph Hellwig
2024-05-29  8:13   ` Damien Le Moal
2024-05-30 20:02   ` Bart Van Assche
2024-05-29  5:04 ` [PATCH 07/12] sd: factor out a sd_discard_mode helper Christoph Hellwig
2024-05-29  8:14   ` Damien Le Moal
2024-05-29 21:11   ` Bart Van Assche
2024-05-29  5:04 ` [PATCH 08/12] sd: cleanup zoned queue limits initialization Christoph Hellwig
2024-05-29  8:18   ` Damien Le Moal
2024-05-30 20:07   ` Bart Van Assche
2024-05-29  5:04 ` [PATCH 09/12] sd: convert to the atomic queue limits API Christoph Hellwig
2024-05-29  8:23   ` Damien Le Moal
2024-05-30  9:16   ` John Garry
2024-05-31  5:48     ` Christoph Hellwig
2024-05-29  5:04 ` [PATCH 10/12] sr: " Christoph Hellwig
2024-05-29  8:25   ` Damien Le Moal
2024-05-29  5:04 ` [PATCH 11/12] block: remove unused " Christoph Hellwig
2024-05-29  8:28   ` Damien Le Moal
2024-05-30 20:08   ` Bart Van Assche
2024-05-31  9:14   ` John Garry
2024-05-29  5:04 ` [PATCH 12/12] block: add special APIs for run-time disabling of discard and friends Christoph Hellwig
2024-05-29  8:30   ` Damien Le Moal
2024-05-30 20:09   ` Bart Van Assche
2024-05-31  9:13   ` John Garry

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=8878dcb7-5f18-4e34-b917-ee5e1ee15cff@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=axboe@kernel.dk \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dongsheng.yang@easystack.cn \
    --cc=hch@lst.de \
    --cc=idryomov@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=martin.petersen@oracle.com \
    --cc=nbd@other.debian.org \
    --cc=richard@nod.at \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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