xfs: don't bother reporting blocks trimmed via FITRIM
Don't bother reporting the number of bytes that we "trimmed" because the underlying storage isn't required to do anything(!) and failed discard IOs aren't reported to the caller anyway. It's not like userspace can use the reported value for anything useful like adjusting the offset parameter of the next call, and it's not like anyone ever wrote a manpage about FITRIM's out parameters. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Tested-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
This commit is contained in:
parent
95179935be
commit
410e8a18f8
@ -158,8 +158,7 @@ static int
|
||||
xfs_trim_gather_extents(
|
||||
struct xfs_perag *pag,
|
||||
struct xfs_trim_cur *tcur,
|
||||
struct xfs_busy_extents *extents,
|
||||
uint64_t *blocks_trimmed)
|
||||
struct xfs_busy_extents *extents)
|
||||
{
|
||||
struct xfs_mount *mp = pag->pag_mount;
|
||||
struct xfs_trans *tp;
|
||||
@ -280,7 +279,6 @@ xfs_trim_gather_extents(
|
||||
|
||||
xfs_extent_busy_insert_discard(pag, fbno, flen,
|
||||
&extents->extent_list);
|
||||
*blocks_trimmed += flen;
|
||||
next_extent:
|
||||
if (tcur->by_bno)
|
||||
error = xfs_btree_increment(cur, 0, &i);
|
||||
@ -327,8 +325,7 @@ xfs_trim_perag_extents(
|
||||
struct xfs_perag *pag,
|
||||
xfs_agblock_t start,
|
||||
xfs_agblock_t end,
|
||||
xfs_extlen_t minlen,
|
||||
uint64_t *blocks_trimmed)
|
||||
xfs_extlen_t minlen)
|
||||
{
|
||||
struct xfs_trim_cur tcur = {
|
||||
.start = start,
|
||||
@ -354,8 +351,7 @@ xfs_trim_perag_extents(
|
||||
extents->owner = extents;
|
||||
INIT_LIST_HEAD(&extents->extent_list);
|
||||
|
||||
error = xfs_trim_gather_extents(pag, &tcur, extents,
|
||||
blocks_trimmed);
|
||||
error = xfs_trim_gather_extents(pag, &tcur, extents);
|
||||
if (error) {
|
||||
kfree(extents);
|
||||
break;
|
||||
@ -389,8 +385,7 @@ xfs_trim_datadev_extents(
|
||||
struct xfs_mount *mp,
|
||||
xfs_daddr_t start,
|
||||
xfs_daddr_t end,
|
||||
xfs_extlen_t minlen,
|
||||
uint64_t *blocks_trimmed)
|
||||
xfs_extlen_t minlen)
|
||||
{
|
||||
xfs_agnumber_t start_agno, end_agno;
|
||||
xfs_agblock_t start_agbno, end_agbno;
|
||||
@ -411,8 +406,7 @@ xfs_trim_datadev_extents(
|
||||
|
||||
if (start_agno == end_agno)
|
||||
agend = end_agbno;
|
||||
error = xfs_trim_perag_extents(pag, start_agbno, agend, minlen,
|
||||
blocks_trimmed);
|
||||
error = xfs_trim_perag_extents(pag, start_agbno, agend, minlen);
|
||||
if (error)
|
||||
last_error = error;
|
||||
|
||||
@ -431,9 +425,6 @@ struct xfs_trim_rtdev {
|
||||
/* list of rt extents to free */
|
||||
struct list_head extent_list;
|
||||
|
||||
/* pointer to count of blocks trimmed */
|
||||
uint64_t *blocks_trimmed;
|
||||
|
||||
/* minimum length that caller allows us to trim */
|
||||
xfs_rtblock_t minlen_fsb;
|
||||
|
||||
@ -551,7 +542,6 @@ xfs_trim_gather_rtextent(
|
||||
busyp->length = rlen;
|
||||
INIT_LIST_HEAD(&busyp->list);
|
||||
list_add_tail(&busyp->list, &tr->extent_list);
|
||||
*tr->blocks_trimmed += rlen;
|
||||
|
||||
tr->restart_rtx = rec->ar_startext + rec->ar_extcount;
|
||||
return 0;
|
||||
@ -562,13 +552,11 @@ xfs_trim_rtdev_extents(
|
||||
struct xfs_mount *mp,
|
||||
xfs_daddr_t start,
|
||||
xfs_daddr_t end,
|
||||
xfs_daddr_t minlen,
|
||||
uint64_t *blocks_trimmed)
|
||||
xfs_daddr_t minlen)
|
||||
{
|
||||
struct xfs_rtalloc_rec low = { };
|
||||
struct xfs_rtalloc_rec high = { };
|
||||
struct xfs_trim_rtdev tr = {
|
||||
.blocks_trimmed = blocks_trimmed,
|
||||
.minlen_fsb = XFS_BB_TO_FSB(mp, minlen),
|
||||
};
|
||||
struct xfs_trans *tp;
|
||||
@ -634,7 +622,7 @@ xfs_trim_rtdev_extents(
|
||||
return error;
|
||||
}
|
||||
#else
|
||||
# define xfs_trim_rtdev_extents(m,s,e,n,b) (-EOPNOTSUPP)
|
||||
# define xfs_trim_rtdev_extents(...) (-EOPNOTSUPP)
|
||||
#endif /* CONFIG_XFS_RT */
|
||||
|
||||
/*
|
||||
@ -661,7 +649,6 @@ xfs_ioc_trim(
|
||||
xfs_daddr_t start, end;
|
||||
xfs_extlen_t minlen;
|
||||
xfs_rfsblock_t max_blocks;
|
||||
uint64_t blocks_trimmed = 0;
|
||||
int error, last_error = 0;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
@ -706,15 +693,13 @@ xfs_ioc_trim(
|
||||
end = start + BTOBBT(range.len) - 1;
|
||||
|
||||
if (bdev_max_discard_sectors(mp->m_ddev_targp->bt_bdev)) {
|
||||
error = xfs_trim_datadev_extents(mp, start, end, minlen,
|
||||
&blocks_trimmed);
|
||||
error = xfs_trim_datadev_extents(mp, start, end, minlen);
|
||||
if (error)
|
||||
last_error = error;
|
||||
}
|
||||
|
||||
if (rt_bdev && !xfs_trim_should_stop()) {
|
||||
error = xfs_trim_rtdev_extents(mp, start, end, minlen,
|
||||
&blocks_trimmed);
|
||||
error = xfs_trim_rtdev_extents(mp, start, end, minlen);
|
||||
if (error)
|
||||
last_error = error;
|
||||
}
|
||||
@ -722,7 +707,8 @@ xfs_ioc_trim(
|
||||
if (last_error)
|
||||
return last_error;
|
||||
|
||||
range.len = XFS_FSB_TO_B(mp, blocks_trimmed);
|
||||
range.len = min_t(unsigned long long, range.len,
|
||||
XFS_FSB_TO_B(mp, max_blocks));
|
||||
if (copy_to_user(urange, &range, sizeof(range)))
|
||||
return -EFAULT;
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user