rsvd ? XFS_TRANS_RESERVE : 0, &args.trans);
if (error)
return error;
- xfs_defer_init(&dfops, &firstblock);
- args.trans->t_dfops = &dfops;
+ xfs_defer_init(args.trans, &dfops, &firstblock);
xfs_ilock(dp, XFS_ILOCK_EXCL);
error = xfs_trans_reserve_quota_nblks(args.trans, dp, args.total, 0,
&args.trans);
if (error)
return error;
- xfs_defer_init(&dfops, &firstblock);
- args.trans->t_dfops = &dfops;
+ xfs_defer_init(args.trans, &dfops, &firstblock);
xfs_ilock(dp, XFS_ILOCK_EXCL);
/*
* Commit that transaction so that the node_addname() call
* can manage its own transactions.
*/
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock);
error = xfs_attr3_leaf_to_node(args);
if (error)
goto out_defer_cancel;
* If the result is small enough, shrink it all into the inode.
*/
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops,
+ args->firstblock);
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */
if (error)
* If the result is small enough, shrink it all into the inode.
*/
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock);
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */
if (error)
*/
xfs_da_state_free(state);
state = NULL;
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops,
+ args->firstblock);
error = xfs_attr3_leaf_to_node(args);
if (error)
goto out_defer_cancel;
* in the index/blkno/rmtblkno/rmtblkcnt fields and
* in the index2/blkno2/rmtblkno2/rmtblkcnt2 fields.
*/
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock);
error = xfs_da3_split(state);
if (error)
goto out_defer_cancel;
* Check to see if the tree needs to be collapsed.
*/
if (retval && (state->path.active > 1)) {
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops,
+ args->firstblock);
error = xfs_da3_join(state);
if (error)
goto out_defer_cancel;
* Check to see if the tree needs to be collapsed.
*/
if (retval && (state->path.active > 1)) {
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock);
error = xfs_da3_join(state);
if (error)
goto out_defer_cancel;
goto out;
if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops,
+ args->firstblock);
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */
if (error)
* extent and then crash then the block may not contain the
* correct metadata after log recovery occurs.
*/
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock);
nmap = 1;
error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno,
blkcnt, XFS_BMAPI_ATTRFORK, args->firstblock,
ASSERT(blkcnt > 0);
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock);
nmap = 1;
error = xfs_bmapi_read(dp, (xfs_fileoff_t)lblkno,
blkcnt, &map, &nmap,
blkcnt = args->rmtblkcnt;
done = 0;
while (!done) {
- xfs_defer_init(args->trans->t_dfops, args->firstblock);
+ xfs_defer_init(NULL, args->trans->t_dfops, args->firstblock);
error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
XFS_BMAPI_ATTRFORK, 1, args->firstblock,
&done);
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 ?
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);
/* Initialize a deferred operation. */
void
xfs_defer_init(
+ struct xfs_trans *tp,
struct xfs_defer_ops *dop,
xfs_fsblock_t *fbp)
{
+ struct xfs_mount *mp = NULL;
+
memset(dop, 0, sizeof(struct xfs_defer_ops));
*fbp = NULLFSBLOCK;
INIT_LIST_HEAD(&dop->dop_intake);
INIT_LIST_HEAD(&dop->dop_pending);
- trace_xfs_defer_init(NULL, dop, _RET_IP_);
+ if (tp) {
+ tp->t_dfops = dop;
+ mp = tp->t_mountp;
+ }
+ trace_xfs_defer_init(mp, dop, _RET_IP_);
}
struct list_head *h);
int xfs_defer_finish(struct xfs_trans **tp, struct xfs_defer_ops *dop);
void xfs_defer_cancel(struct xfs_defer_ops *dop);
-void xfs_defer_init(struct xfs_defer_ops *dop, xfs_fsblock_t *fbp);
+void xfs_defer_init(struct xfs_trans *tp, struct xfs_defer_ops *dop,
+ xfs_fsblock_t *fbp);
bool xfs_defer_has_unfinished_work(struct xfs_defer_ops *dop);
int xfs_defer_ijoin(struct xfs_defer_ops *dop, struct xfs_inode *ip);
int xfs_defer_bjoin(struct xfs_defer_ops *dop, struct xfs_buf *bp);
trace_xfs_refcount_recover_extent(mp, agno, &rr->rr_rrec);
/* Free the orphan record */
- xfs_defer_init(&dfops, &fsb);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &fsb);
agbno = rr->rr_rrec.rc_startblock - XFS_REFC_COW_START;
fsb = XFS_AGB_TO_FSB(mp, agno, agbno);
error = xfs_refcount_free_cow_extent(mp, tp->t_dfops, fsb,
xfs_trans_ijoin(tp, ip, 0);
- xfs_defer_init(&dfops, &firstfsb);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstfsb);
error = xfs_bmapi_write(tp, ip, startoffset_fsb,
allocatesize_fsb, alloc_type, &firstfsb,
resblks, imapp, &nimaps);
xfs_trans_ijoin(tp, ip, 0);
- xfs_defer_init(&dfops, &firstfsb);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstfsb);
error = xfs_bunmapi(tp, ip, startoffset_fsb, len_fsb, 0, 2, &firstfsb,
done);
if (error)
goto out_trans_cancel;
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
error = xfs_bmap_collapse_extents(tp, ip, &next_fsb, shift_fsb,
&done, &first_block);
if (error)
xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
error = xfs_bmap_insert_extents(tp, ip, &next_fsb, shift_fsb,
&done, stop_fsb, &first_block);
if (error)
/* Unmap the old blocks in the source file. */
while (tirec.br_blockcount) {
- xfs_defer_init(tp->t_dfops, &firstfsb);
+ xfs_defer_init(tp, tp->t_dfops, &firstfsb);
trace_xfs_swap_extent_rmap_remap_piece(tip, &tirec);
/* Read extent from the source file */
error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0, 0, &tp);
if (error)
goto out_unlock;
- xfs_defer_init(&dfops, &firstfsb);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstfsb);
/*
* Lock and join the inodes to the tansaction so that transaction commit
trace_xfs_dqalloc(dqp);
- xfs_defer_init(tp->t_dfops, &firstblock);
+ xfs_defer_init(tp, tp->t_dfops, &firstblock);
xfs_ilock(quotip, XFS_ILOCK_EXCL);
if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) {
XFS_QM_DQALLOC_SPACE_RES(mp), 0, 0, &tp);
if (error)
goto err;
- xfs_defer_init(&dfops, &firstblock);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstblock);
error = xfs_dquot_disk_alloc(&tp, dqp, &bp);
if (error)
xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
unlock_dp_on_error = true;
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
/*
* Reserve disk quota and the inode.
goto error_return;
}
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
/*
* Handle initial link state of O_TMPFILE inode
ASSERT(first_unmap_block < last_block);
unmap_len = last_block - first_unmap_block + 1;
while (!done) {
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
error = xfs_bunmapi(tp, ip, first_unmap_block, unmap_len, flags,
XFS_ITRUNC_MAX_EXTENTS, &first_block,
&done);
xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, 0);
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
error = xfs_ifree(tp, ip);
if (error) {
/*
if (error)
goto out_trans_cancel;
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
error = xfs_dir_removename(tp, dp, name, ip->i_ino, &first_block,
resblks);
if (error) {
goto out_trans_cancel;
}
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
/* RENAME_EXCHANGE is unique from here on. */
if (flags & RENAME_EXCHANGE)
* From this point onwards we overwrite the imap pointer that the
* caller gave to us.
*/
- xfs_defer_init(&dfops, &firstfsb);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstfsb);
nimaps = 1;
error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
bmapi_flags, &firstfsb, resblks, imap,
xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, 0);
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
/*
* it is possible that the extents have changed since
/*
* Modify the unwritten extent state of the buffer.
*/
- xfs_defer_init(&dfops, &firstfsb);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstfsb);
nimaps = 1;
error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
XFS_BMAPI_CONVERT, &firstfsb, resblks,
#if defined(DEBUG) || defined(XFS_WARN)
last_lsn = xlog_assign_lsn(log->l_curr_cycle, log->l_curr_block);
#endif
- xfs_defer_init(&dfops, &firstfsb);
+ xfs_defer_init(NULL, &dfops, &firstfsb);
while (lip != NULL) {
/*
* We're done when we see something other than an intent.
xfs_trans_ijoin(tp, ip, 0);
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
nimaps = 1;
/* Allocate the entire reservation as unwritten blocks. */
if (error)
break;
} else if (del.br_state == XFS_EXT_UNWRITTEN || cancel_real) {
- xfs_defer_init(&dfops, &firstfsb);
- (*tpp)->t_dfops = &dfops;
+ xfs_defer_init(*tpp, &dfops, &firstfsb);
/* Free the CoW orphan record. */
error = xfs_refcount_free_cow_extent(ip->i_mount,
goto prev_extent;
/* Unmap the old blocks in the data fork. */
- xfs_defer_init(&dfops, &firstfsb);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstfsb);
rlen = del.br_blockcount;
error = __xfs_bunmapi(tp, ip, del.br_startoff, &rlen, 0, 1,
&firstfsb);
/* Unmap the old blocks in the data fork. */
rlen = unmap_len;
while (rlen) {
- xfs_defer_init(&dfops, &firstfsb);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstfsb);
error = __xfs_bunmapi(tp, ip, destoff, &rlen, 0, 1, &firstfsb);
if (error)
goto out_defer;
xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
- xfs_defer_init(&dfops, &firstblock);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &firstblock);
/*
* Allocate blocks to the bitmap file.
*/
* Initialize the bmap freelist prior to calling either
* bmapi or the directory create code.
*/
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
/*
* Allocate an inode for the symlink.
* Find the block(s) so we can inval and unmap them.
*/
done = 0;
- xfs_defer_init(&dfops, &first_block);
- tp->t_dfops = &dfops;
+ xfs_defer_init(tp, &dfops, &first_block);
nmaps = ARRAY_SIZE(mval);
error = xfs_bmapi_read(ip, 0, xfs_symlink_blocks(mp, size),
mval, &nmaps, 0);