aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_bmap.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2018-05-10 09:35:42 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2018-05-15 17:57:05 -0700
commit4e529339af15226a30e0ca044aa2d78ba3518494 (patch)
tree39c57177919a3f48ec4d934401951ab625ca75f0 /fs/xfs/libxfs/xfs_bmap.c
parentiomap: add a swapfile activation function (diff)
downloadlinux-dev-4e529339af15226a30e0ca044aa2d78ba3518494.tar.xz
linux-dev-4e529339af15226a30e0ca044aa2d78ba3518494.zip
xfs: factor out nodiscard helpers
The changes to skip discards of speculative preallocation and unwritten extents introduced several new wrapper functions through the bunmapi -> extent free codepath to reduce churn in all of the associated callers. In several cases, these wrappers simply toggle a single flag to skip or not skip discards for the resulting blocks. The explicit _nodiscard() wrappers for such an isolated set of callers is a bit overkill. Kill off these wrappers and replace with the calls to the underlying functions in the contexts that need to control discard behavior. Retain the wrappers that preserve the original calling conventions to serve the original purpose of reducing code churn. This is a refactoring patch and does not change behavior. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to '')
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index c7ea3d6f89f1..0fd051064ff0 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -5116,15 +5116,10 @@ xfs_bmap_del_extent_real(
if (error)
goto done;
} else {
- if ((bflags & XFS_BMAPI_NODISCARD) ||
- (del->br_state == XFS_EXT_UNWRITTEN)) {
- 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);
- }
+ __xfs_bmap_add_free(mp, dfops, del->br_startblock,
+ del->br_blockcount, NULL,
+ (bflags & XFS_BMAPI_NODISCARD) ||
+ del->br_state == XFS_EXT_UNWRITTEN);
}
}