Re: [PATCH 01/12] ubd: untagle discard vs write zeroes not support handling
- 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
- From: Damien Le Moal <dlemoal@kernel.org>
- Date: Wed, 29 May 2024 17:00:34 +0900
- Message-id: <[🔎] 8878dcb7-5f18-4e34-b917-ee5e1ee15cff@kernel.org>
- In-reply-to: <[🔎] 20240529050507.1392041-2-hch@lst.de>
- References: <[🔎] 20240529050507.1392041-1-hch@lst.de> <[🔎] 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 to: