Skip to content

Commit 1dd3b43

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: make FAULT_DISCARD obsolete
__blkdev_issue_discard() in __submit_discard_cmd() will never fail, so let's make FAULT_DISCARD fault injection obsolete. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent ce2739e commit 1dd3b43

4 files changed

Lines changed: 6 additions & 18 deletions

File tree

Documentation/ABI/testing/sysfs-fs-f2fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ Description: Support configuring fault injection type, should be
732732
FAULT_TRUNCATE 0x00000400
733733
FAULT_READ_IO 0x00000800
734734
FAULT_CHECKPOINT 0x00001000
735-
FAULT_DISCARD 0x00002000
735+
FAULT_DISCARD 0x00002000 (obsolete)
736736
FAULT_WRITE_IO 0x00004000
737737
FAULT_SLAB_ALLOC 0x00008000
738738
FAULT_DQUOT_INIT 0x00010000

Documentation/filesystems/f2fs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ fault_type=%d Support configuring fault injection type, should be
206206
FAULT_TRUNCATE 0x00000400
207207
FAULT_READ_IO 0x00000800
208208
FAULT_CHECKPOINT 0x00001000
209-
FAULT_DISCARD 0x00002000
209+
FAULT_DISCARD 0x00002000 (obsolete)
210210
FAULT_WRITE_IO 0x00004000
211211
FAULT_SLAB_ALLOC 0x00008000
212212
FAULT_DQUOT_INIT 0x00010000

fs/f2fs/f2fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ enum {
5454
FAULT_TRUNCATE,
5555
FAULT_READ_IO,
5656
FAULT_CHECKPOINT,
57-
FAULT_DISCARD,
57+
FAULT_DISCARD, /* it's obsolete due to __blkdev_issue_discard() will never fail */
5858
FAULT_WRITE_IO,
5959
FAULT_SLAB_ALLOC,
6060
FAULT_DQUOT_INIT,

fs/f2fs/segment.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,6 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
12871287
&(dcc->fstrim_list) : &(dcc->wait_list);
12881288
blk_opf_t flag = dpolicy->sync ? REQ_SYNC : 0;
12891289
block_t lstart, start, len, total_len;
1290-
int err = 0;
12911290

12921291
if (dc->state != D_PREP)
12931292
return 0;
@@ -1328,7 +1327,7 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
13281327

13291328
dc->di.len = 0;
13301329

1331-
while (total_len && *issued < dpolicy->max_requests && !err) {
1330+
while (total_len && *issued < dpolicy->max_requests) {
13321331
struct bio *bio = NULL;
13331332
unsigned long flags;
13341333
bool last = true;
@@ -1344,17 +1343,6 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
13441343

13451344
dc->di.len += len;
13461345

1347-
err = 0;
1348-
if (time_to_inject(sbi, FAULT_DISCARD)) {
1349-
err = -EIO;
1350-
spin_lock_irqsave(&dc->lock, flags);
1351-
if (dc->state == D_PARTIAL)
1352-
dc->state = D_SUBMIT;
1353-
spin_unlock_irqrestore(&dc->lock, flags);
1354-
1355-
break;
1356-
}
1357-
13581346
__blkdev_issue_discard(bdev, SECTOR_FROM_BLOCK(start),
13591347
SECTOR_FROM_BLOCK(len), GFP_NOFS, &bio);
13601348
f2fs_bug_on(sbi, !bio);
@@ -1393,11 +1381,11 @@ static int __submit_discard_cmd(struct f2fs_sb_info *sbi,
13931381
len = total_len;
13941382
}
13951383

1396-
if (!err && len) {
1384+
if (len) {
13971385
dcc->undiscard_blks -= len;
13981386
__update_discard_tree_range(sbi, bdev, lstart, start, len);
13991387
}
1400-
return err;
1388+
return 0;
14011389
}
14021390

14031391
static void __insert_discard_cmd(struct f2fs_sb_info *sbi,

0 commit comments

Comments
 (0)