diff mbox series

[05/10] f2fs: switch to using blk_next_discard_bio directly

Message ID 20240307151157.466013-6-hch@lst.de (mailing list archive)
State New, archived
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>
---
 fs/f2fs/segment.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index e1065ba7020761..c131e138d74f94 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1305,10 +1305,12 @@  static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
 		if (time_to_inject(sbi, FAULT_DISCARD)) {
 			err = -EIO;
 		} else {
-			err = __blkdev_issue_discard(bdev,
-					SECTOR_FROM_BLOCK(start),
-					SECTOR_FROM_BLOCK(len),
-					GFP_NOFS, &bio);
+			sector_t sector = SECTOR_FROM_BLOCK(start);
+			sector_t nr_sects = SECTOR_FROM_BLOCK(len);
+
+			while (blk_next_discard_bio(bdev, &bio, &sector,
+					&nr_sects, GFP_NOFS))
+				;
 		}
 		if (err) {
 			spin_lock_irqsave(&dc->lock, flags);