diff options
author | Brian Foster <bfoster@redhat.com> | 2018-05-09 08:45:04 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2018-05-10 08:56:46 -0700 |
commit | fcb762f5de2e534ab47b5f034fe484c2b25b4d51 (patch) | |
tree | 2f8ff2257d0939652cee00e0f801ab559dd48c41 /fs/xfs/libxfs/xfs_bmap.c | |
parent | e6631f85546c8ff8842f62c73be44ff502d4287a (diff) | |
download | lwn-fcb762f5de2e534ab47b5f034fe484c2b25b4d51.tar.gz lwn-fcb762f5de2e534ab47b5f034fe484c2b25b4d51.zip |
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/libxfs/xfs_bmap.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 3e5e9a667bc8..534ffb856c4a 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -544,12 +544,13 @@ xfs_bmap_validate_ret( * The list is maintained sorted (by block number). */ void -xfs_bmap_add_free( +__xfs_bmap_add_free( struct xfs_mount *mp, struct xfs_defer_ops *dfops, xfs_fsblock_t bno, xfs_filblks_t len, - struct xfs_owner_info *oinfo) + struct xfs_owner_info *oinfo, + bool skip_discard) { struct xfs_extent_free_item *new; /* new element */ #ifdef DEBUG @@ -576,6 +577,7 @@ xfs_bmap_add_free( new->xefi_oinfo = *oinfo; else xfs_rmap_skip_owner_update(&new->xefi_oinfo); + new->xefi_skip_discard = skip_discard; trace_xfs_bmap_free_defer(mp, XFS_FSB_TO_AGNO(mp, bno), 0, XFS_FSB_TO_AGBNO(mp, bno), len); xfs_defer_add(dfops, XFS_DEFER_OPS_TYPE_FREE, &new->xefi_list); @@ -5106,9 +5108,16 @@ xfs_bmap_del_extent_real( error = xfs_refcount_decrease_extent(mp, dfops, del); if (error) goto done; - } else - xfs_bmap_add_free(mp, dfops, del->br_startblock, + } else { + if (bflags & XFS_BMAPI_NODISCARD) { + xfs_bmap_add_free_nodiscard(mp, dfops, + del->br_startblock, del->br_blockcount, + NULL); + } else { + xfs_bmap_add_free(mp, dfops, del->br_startblock, del->br_blockcount, NULL); + } + } } /* |