]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
block: limit the Write Zeroes to manually writing zeroes fallback
authorChristoph Hellwig <hch@lst.de>
Mon, 1 Jul 2024 16:51:19 +0000 (18:51 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 5 Jul 2024 06:53:15 +0000 (00:53 -0600)
Only fall back from hardware Write Zeroes failures when
blkdev_issue_write_zeroes returns -EOPNOTSUPP;

Note that blkdev_issue_write_zeroes turns any failure into -EOPNOTSUPP
when the write zeroes queue limit has been cleared to 0, so this still
catches all I/O errors where the driver detected missing support
for the hardware acceleration.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20240701165219.1571322-10-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-lib.c

index 9dbab472c63f12d223fd5cb48c85335c697a2507..2384acd913d21f7b7bf6c1e887d1b0d116cfd4bf 100644 (file)
@@ -287,7 +287,7 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
        if (bdev_write_zeroes_sectors(bdev)) {
                ret = blkdev_issue_write_zeroes(bdev, sector, nr_sects,
                                gfp_mask, flags);
-               if (!ret)
+               if (ret != -EOPNOTSUPP)
                        return ret;
        }