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>
This commit is contained in:
committed by
Darrick J. Wong
parent
f467cad95f
commit
02dff7bf81
@ -26,6 +26,7 @@
|
||||
#include "xfs_dir2.h"
|
||||
#include "xfs_trans_space.h"
|
||||
#include "xfs_iomap.h"
|
||||
#include "xfs_defer.h"
|
||||
|
||||
#include <linux/capability.h>
|
||||
#include <linux/xattr.h>
|
||||
@ -812,6 +813,7 @@ xfs_setattr_size(
|
||||
struct inode *inode = VFS_I(ip);
|
||||
xfs_off_t oldsize, newsize;
|
||||
struct xfs_trans *tp;
|
||||
struct xfs_defer_ops dfops;
|
||||
int error;
|
||||
uint lock_flags = 0;
|
||||
bool did_zeroing = false;
|
||||
@ -915,6 +917,7 @@ xfs_setattr_size(
|
||||
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
xfs_defer_init(tp, &dfops);
|
||||
|
||||
lock_flags |= XFS_ILOCK_EXCL;
|
||||
xfs_ilock(ip, XFS_ILOCK_EXCL);
|
||||
|
Reference in New Issue
Block a user