Skip to content

Commit 31ade7d

Browse files
Christoph Hellwigaxboe
authored andcommitted
ubd: untagle discard vs write zeroes not support handling
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: 50109b5 ("um: Add support for DISCARD in the UBD Driver") Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Martin K. Petersen <[email protected]> Acked-By: Anton Ivanov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 5db755f commit 31ade7d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

arch/um/drivers/ubd_kern.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,10 +449,11 @@ static int bulk_req_safe_read(
449449

450450
static void ubd_end_request(struct io_thread_req *io_req)
451451
{
452-
if (io_req->error == BLK_STS_NOTSUPP &&
453-
req_op(io_req->req) == REQ_OP_DISCARD) {
454-
blk_queue_max_discard_sectors(io_req->req->q, 0);
455-
blk_queue_max_write_zeroes_sectors(io_req->req->q, 0);
452+
if (io_req->error == BLK_STS_NOTSUPP) {
453+
if (req_op(io_req->req) == REQ_OP_DISCARD)
454+
blk_queue_max_discard_sectors(io_req->req->q, 0);
455+
else if (req_op(io_req->req) == REQ_OP_WRITE_ZEROES)
456+
blk_queue_max_write_zeroes_sectors(io_req->req->q, 0);
456457
}
457458
blk_mq_end_request(io_req->req, io_req->error);
458459
kfree(io_req);

0 commit comments

Comments
 (0)