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

Christoph Hellwig hch at lst.de
Thu Mar 7 07:11:52 PST 2024


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 at lst.de>
---
 fs/f2fs/segment.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

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);
-- 
2.39.2




More information about the Linux-nvme mailing list