summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_attr_inactive.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2018-07-24 23:43:07 +0300
committerDarrick J. Wong <darrick.wong@oracle.com>2018-07-26 20:15:12 +0300
commit02dff7bf81685b6770a082243060e0b5aac348cf (patch)
treeff388c2693bcf870418f1b3941c0bf38c98928cf /fs/xfs/xfs_attr_inactive.c
parentf467cad95f5e3814fda408dea76eb962ab19685d (diff)
downloadlinux-02dff7bf81685b6770a082243060e0b5aac348cf.tar.xz
xfs: pull up dfops from xfs_itruncate_extents()
xfs_itruncate_extents[_flags]() uses a local dfops with a transaction provided by the caller. It uses hacky ->t_dfops replacement logic to avoid stomping over an already populated ->t_dfops. The latter never occurs for current callers and the logic itself is not really appropriate. Clean this up by updating all callers to initialize a dfops and to use that down in xfs_itruncate_extents(). This more closely resembles the upcoming logic where dfops will be embedded within the transaction. We can also replace the xfs_defer_init() in the xfs_itruncate_extents_flags() loop with an assert. Both dfops and firstblock should be in a valid state after xfs_defer_finish() and the inode joined to the dfops is fixed throughout the loop. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bill O'Donnell <billodo@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_attr_inactive.c')
-rw-r--r--fs/xfs/xfs_attr_inactive.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c
index 7ce10055f275..d3055972d3a6 100644
--- a/fs/xfs/xfs_attr_inactive.c
+++ b/fs/xfs/xfs_attr_inactive.c
@@ -26,6 +26,7 @@
#include "xfs_quota.h"
#include "xfs_trace.h"
#include "xfs_dir2.h"
+#include "xfs_defer.h"
/*
* Look at all the extents for this logical region,
@@ -381,6 +382,7 @@ xfs_attr_inactive(
{
struct xfs_trans *trans;
struct xfs_mount *mp;
+ struct xfs_defer_ops dfops;
int lock_mode = XFS_ILOCK_SHARED;
int error = 0;
@@ -397,6 +399,7 @@ xfs_attr_inactive(
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_attrinval, 0, 0, 0, &trans);
if (error)
goto out_destroy_fork;
+ xfs_defer_init(trans, &dfops);
lock_mode = XFS_ILOCK_EXCL;
xfs_ilock(dp, lock_mode);