diff mbox series

[09/10] block: limit the Write Zeroes to manually writing zeroes fallback

Message ID 20240701165219.1571322-10-hch@lst.de (mailing list archive)
State New
Headers show
Series [01/10] block: move secure erase checks into the ioctl handler | expand

Commit Message

Christoph Hellwig July 1, 2024, 4:51 p.m. UTC
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>
---
 block/blk-lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/block/blk-lib.c b/block/blk-lib.c
index 9585178a51a60c..95a22e7b1d3b85 100644
--- a/block/blk-lib.c
+++ b/block/blk-lib.c
@@ -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;
 	}