Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Chaitanya Kulkarni and committed by
Carlos Maiolino
2145f447 8f0b4cce

+6 -23
+5 -22
fs/xfs/xfs_discard.c
··· 108 108 * list. We plug and chain the bios so that we only need a single completion 109 109 * call to clear all the busy extents once the discards are complete. 110 110 */ 111 - int 111 + void 112 112 xfs_discard_extents( 113 113 struct xfs_mount *mp, 114 114 struct xfs_busy_extents *extents) ··· 116 116 struct xfs_extent_busy *busyp; 117 117 struct bio *bio = NULL; 118 118 struct blk_plug plug; 119 - int error = 0; 120 119 121 120 blk_start_plug(&plug); 122 121 list_for_each_entry(busyp, &extents->extent_list, list) { ··· 125 126 126 127 trace_xfs_discard_extent(xg, busyp->bno, busyp->length); 127 128 128 - error = __blkdev_issue_discard(btp->bt_bdev, 129 + __blkdev_issue_discard(btp->bt_bdev, 129 130 xfs_gbno_to_daddr(xg, busyp->bno), 130 131 XFS_FSB_TO_BB(mp, busyp->length), 131 132 GFP_KERNEL, &bio); 132 - if (error && error != -EOPNOTSUPP) { 133 - xfs_info(mp, 134 - "discard failed for extent [0x%llx,%u], error %d", 135 - (unsigned long long)busyp->bno, 136 - busyp->length, 137 - error); 138 - break; 139 - } 140 133 } 141 134 142 135 if (bio) { ··· 139 148 xfs_discard_endio_work(&extents->endio_work); 140 149 } 141 150 blk_finish_plug(&plug); 142 - 143 - return error; 144 151 } 145 152 146 153 /* ··· 374 385 * list after this function call, as it may have been freed by 375 386 * the time control returns to us. 376 387 */ 377 - error = xfs_discard_extents(pag_mount(pag), extents); 378 - if (error) 379 - break; 388 + xfs_discard_extents(pag_mount(pag), extents); 380 389 381 390 if (xfs_trim_should_stop()) 382 391 break; ··· 483 496 484 497 trace_xfs_discard_rtextent(mp, busyp->bno, busyp->length); 485 498 486 - error = __blkdev_issue_discard(bdev, 499 + __blkdev_issue_discard(bdev, 487 500 xfs_rtb_to_daddr(mp, busyp->bno), 488 501 XFS_FSB_TO_BB(mp, busyp->length), 489 502 GFP_NOFS, &bio); 490 - if (error) 491 - break; 492 503 } 493 504 xfs_discard_free_rtdev_extents(tr); 494 505 ··· 726 741 * list after this function call, as it may have been freed by 727 742 * the time control returns to us. 728 743 */ 729 - error = xfs_discard_extents(rtg_mount(rtg), tr.extents); 730 - if (error) 731 - break; 744 + xfs_discard_extents(rtg_mount(rtg), tr.extents); 732 745 733 746 low = tr.restart_rtx; 734 747 } while (!xfs_trim_should_stop() && low <= high);
+1 -1
fs/xfs/xfs_discard.h
··· 6 6 struct xfs_mount; 7 7 struct xfs_busy_extents; 8 8 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); 10 10 int xfs_ioc_trim(struct xfs_mount *mp, struct fstrim_range __user *fstrim); 11 11 12 12 #endif /* XFS_DISCARD_H */