xfs: refactor dfops init to attach to transaction

Most callers of xfs_defer_init() immediately attach the dfops
structure to a transaction. Add a transaction parameter to eliminate
much of this boilerplate code. This also helps self-document the
fact that many codepaths now expect a dfops pointer implicitly via
xfs_trans->t_dfops.

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>
This commit is contained in:
Brian Foster
2018-07-11 22:26:19 -07:00
committed by Darrick J. Wong
parent d5669ed581
commit bcd2c9f335
14 changed files with 55 additions and 70 deletions

View File

@@ -1050,8 +1050,7 @@ xfs_bmap_add_attrfork(
rsvd ? XFS_TRANS_RESERVE : 0, &tp);
if (error)
return error;
xfs_defer_init(&dfops, &firstblock);
tp->t_dfops = &dfops;
xfs_defer_init(tp, &dfops, &firstblock);
xfs_ilock(ip, XFS_ILOCK_EXCL);
error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
@@ -6025,8 +6024,7 @@ xfs_bmap_split_extent(
XFS_DIOSTRAT_SPACE_RES(mp, 0), 0, 0, &tp);
if (error)
return error;
xfs_defer_init(&dfops, &firstfsb);
tp->t_dfops = &dfops;
xfs_defer_init(tp, &dfops, &firstfsb);
xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);