diff mbox series

[09/10] dm-thin: switch to using blk_next_discard_bio directly

Message ID 20240307151157.466013-10-hch@lst.de (mailing list archive)
State New
Headers show
Series [01/10] block: remove the discard_granularity check in __blkdev_issue_discard | expand

Commit Message

Christoph Hellwig March 7, 2024, 3:11 p.m. UTC
This fixes fatal signals getting into the way and corrupting the bio
chain and removes the need to handle synchronous errors.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/md/dm-thin.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 07c7f9795b107b..becf1b66262d34 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -398,10 +398,13 @@  static void begin_discard(struct discard_op *op, struct thin_c *tc, struct bio *
 static int issue_discard(struct discard_op *op, dm_block_t data_b, dm_block_t data_e)
 {
 	struct thin_c *tc = op->tc;
+	struct block_device *bdev = tc->pool_dev->bdev;
 	sector_t s = block_to_sectors(tc->pool, data_b);
 	sector_t len = block_to_sectors(tc->pool, data_e - data_b);
 
-	return __blkdev_issue_discard(tc->pool_dev->bdev, s, len, GFP_NOIO, &op->bio);
+	while (blk_next_discard_bio(bdev, &op->bio, &s, &len, GFP_NOIO))
+		;
+	return 0;
 }
 
 static void end_discard(struct discard_op *op, int r)