Skip to content

Commit 2145f44

Browse files
ChaitanayaKulkarnicmaiolino
authored andcommitted
xfs: ignore discard return value
__blkdev_issue_discard() always returns 0, making all error checking in XFS discard functions dead code. Change xfs_discard_extents() return type to void, remove error variable, error checking, and error logging for the __blkdev_issue_discard() call in same function. Update xfs_trim_perag_extents() and xfs_trim_rtgroup_extents() to ignore the xfs_discard_extents() return value and error checking code. Update xfs_discard_rtdev_extents() to ignore __blkdev_issue_discard() return value and error checking code. Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent 8f0b4cc commit 2145f44

2 files changed

Lines changed: 6 additions & 23 deletions

File tree

fs/xfs/xfs_discard.c

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,14 @@ xfs_discard_endio(
108108
* list. We plug and chain the bios so that we only need a single completion
109109
* call to clear all the busy extents once the discards are complete.
110110
*/
111-
int
111+
void
112112
xfs_discard_extents(
113113
struct xfs_mount *mp,
114114
struct xfs_busy_extents *extents)
115115
{
116116
struct xfs_extent_busy *busyp;
117117
struct bio *bio = NULL;
118118
struct blk_plug plug;
119-
int error = 0;
120119

121120
blk_start_plug(&plug);
122121
list_for_each_entry(busyp, &extents->extent_list, list) {
@@ -126,18 +125,10 @@ xfs_discard_extents(
126125

127126
trace_xfs_discard_extent(xg, busyp->bno, busyp->length);
128127

129-
error = __blkdev_issue_discard(btp->bt_bdev,
128+
__blkdev_issue_discard(btp->bt_bdev,
130129
xfs_gbno_to_daddr(xg, busyp->bno),
131130
XFS_FSB_TO_BB(mp, busyp->length),
132131
GFP_KERNEL, &bio);
133-
if (error && error != -EOPNOTSUPP) {
134-
xfs_info(mp,
135-
"discard failed for extent [0x%llx,%u], error %d",
136-
(unsigned long long)busyp->bno,
137-
busyp->length,
138-
error);
139-
break;
140-
}
141132
}
142133

143134
if (bio) {
@@ -148,8 +139,6 @@ xfs_discard_extents(
148139
xfs_discard_endio_work(&extents->endio_work);
149140
}
150141
blk_finish_plug(&plug);
151-
152-
return error;
153142
}
154143

155144
/*
@@ -385,9 +374,7 @@ xfs_trim_perag_extents(
385374
* list after this function call, as it may have been freed by
386375
* the time control returns to us.
387376
*/
388-
error = xfs_discard_extents(pag_mount(pag), extents);
389-
if (error)
390-
break;
377+
xfs_discard_extents(pag_mount(pag), extents);
391378

392379
if (xfs_trim_should_stop())
393380
break;
@@ -496,12 +483,10 @@ xfs_discard_rtdev_extents(
496483

497484
trace_xfs_discard_rtextent(mp, busyp->bno, busyp->length);
498485

499-
error = __blkdev_issue_discard(bdev,
486+
__blkdev_issue_discard(bdev,
500487
xfs_rtb_to_daddr(mp, busyp->bno),
501488
XFS_FSB_TO_BB(mp, busyp->length),
502489
GFP_NOFS, &bio);
503-
if (error)
504-
break;
505490
}
506491
xfs_discard_free_rtdev_extents(tr);
507492

@@ -741,9 +726,7 @@ xfs_trim_rtgroup_extents(
741726
* list after this function call, as it may have been freed by
742727
* the time control returns to us.
743728
*/
744-
error = xfs_discard_extents(rtg_mount(rtg), tr.extents);
745-
if (error)
746-
break;
729+
xfs_discard_extents(rtg_mount(rtg), tr.extents);
747730

748731
low = tr.restart_rtx;
749732
} while (!xfs_trim_should_stop() && low <= high);

fs/xfs/xfs_discard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct fstrim_range;
66
struct xfs_mount;
77
struct xfs_busy_extents;
88

9-
int xfs_discard_extents(struct xfs_mount *mp, struct xfs_busy_extents *busy);
9+
void xfs_discard_extents(struct xfs_mount *mp, struct xfs_busy_extents *busy);
1010
int xfs_ioc_trim(struct xfs_mount *mp, struct fstrim_range __user *fstrim);
1111

1212
#endif /* XFS_DISCARD_H */

0 commit comments

Comments
 (0)