summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_trans_extfree.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2018-05-09 18:45:04 +0300
committerDarrick J. Wong <darrick.wong@oracle.com>2018-05-10 18:56:46 +0300
commitfcb762f5de2e534ab47b5f034fe484c2b25b4d51 (patch)
tree2f8ff2257d0939652cee00e0f801ab559dd48c41 /fs/xfs/xfs_trans_extfree.c
parente6631f85546c8ff8842f62c73be44ff502d4287a (diff)
downloadlinux-fcb762f5de2e534ab47b5f034fe484c2b25b4d51.tar.xz
xfs: add bmapi nodiscard flag
Freed extents are unconditionally discarded when online discard is enabled. Define XFS_BMAPI_NODISCARD to allow callers to bypass discards when unnecessary. For example, this will be useful for eofblocks trimming. This patch does not change behavior. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/xfs_trans_extfree.c')
-rw-r--r--fs/xfs/xfs_trans_extfree.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/xfs/xfs_trans_extfree.c b/fs/xfs/xfs_trans_extfree.c
index c60395eea21f..28a1d5a0467c 100644
--- a/fs/xfs/xfs_trans_extfree.c
+++ b/fs/xfs/xfs_trans_extfree.c
@@ -68,7 +68,8 @@ xfs_trans_free_extent(
struct xfs_efd_log_item *efdp,
xfs_fsblock_t start_block,
xfs_extlen_t ext_len,
- struct xfs_owner_info *oinfo)
+ struct xfs_owner_info *oinfo,
+ bool skip_discard)
{
struct xfs_mount *mp = tp->t_mountp;
uint next_extent;
@@ -79,8 +80,12 @@ xfs_trans_free_extent(
trace_xfs_bmap_free_deferred(tp->t_mountp, agno, 0, agbno, ext_len);
- error = xfs_free_extent(tp, start_block, ext_len, oinfo,
- XFS_AG_RESV_NONE);
+ if (skip_discard)
+ error = xfs_free_extent_nodiscard(tp, start_block, ext_len,
+ oinfo, XFS_AG_RESV_NONE);
+ else
+ error = xfs_free_extent(tp, start_block, ext_len, oinfo,
+ XFS_AG_RESV_NONE);
/*
* Mark the transaction dirty, even on error. This ensures the
@@ -195,7 +200,7 @@ xfs_extent_free_finish_item(
error = xfs_trans_free_extent(tp, done_item,
free->xefi_startblock,
free->xefi_blockcount,
- &free->xefi_oinfo);
+ &free->xefi_oinfo, free->xefi_skip_discard);
kmem_free(free);
return error;
}