summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.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/xfs_inode.c
parent67482129cdabf7cede1301d2415ef4f0156d35cd (diff)
downloadlinux-4e529339af15226a30e0ca044aa2d78ba3518494.tar.bz2
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 'fs/xfs/xfs_inode.c')
-rw-r--r--fs/xfs/xfs_inode.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 74d5cbee8a71..05207a64dd53 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1548,12 +1548,12 @@ xfs_itruncate_clear_reflink_flags(
* dirty on error so that transactions can be easily aborted if possible.
*/
int
-__xfs_itruncate_extents(
+xfs_itruncate_extents_flags(
struct xfs_trans **tpp,
struct xfs_inode *ip,
int whichfork,
xfs_fsize_t new_size,
- bool skip_discard)
+ int flags)
{
struct xfs_mount *mp = ip->i_mount;
struct xfs_trans *tp = *tpp;
@@ -1564,7 +1564,6 @@ __xfs_itruncate_extents(
xfs_filblks_t unmap_len;
int error = 0;
int done = 0;
- int flags;
ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
ASSERT(!atomic_read(&VFS_I(ip)->i_count) ||
@@ -1577,9 +1576,7 @@ __xfs_itruncate_extents(
trace_xfs_itruncate_extents_start(ip, new_size);
- flags = xfs_bmapi_aflag(whichfork);
- if (skip_discard)
- flags |= XFS_BMAPI_NODISCARD;
+ flags |= xfs_bmapi_aflag(whichfork);
/*
* Since it is possible for space to become allocated beyond