}
xfs_trans_ijoin(tp, ip, 0);
- xfs_defer_init(&free_list, &firstfsb);
+ xfs_defer_init(NULL, &free_list, &firstfsb);
error = xfs_bmapi_write(tp, ip, startoffset_fsb, allocatesize_fsb,
xfs_bmapi_flags, &firstfsb, 0, imapp, &reccount);
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,
case IF_REGULAR:
buf = newregfile(pp, &len);
tp = getres(mp, XFS_B_TO_FSB(mp, len));
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0,
&creds, fsxp, &ip);
if (error)
exit(1);
}
tp = getres(mp, XFS_B_TO_FSB(mp, llen));
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0,
&creds, fsxp, &ip);
case IF_BLOCK:
tp = getres(mp, 0);
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
majdev = getnum(getstr(pp), 0, 0, false);
mindev = getnum(getstr(pp), 0, 0, false);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFBLK, 1,
case IF_CHAR:
tp = getres(mp, 0);
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
majdev = getnum(getstr(pp), 0, 0, false);
mindev = getnum(getstr(pp), 0, 0, false);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFCHR, 1,
case IF_FIFO:
tp = getres(mp, 0);
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFIFO, 1, 0,
&creds, fsxp, &ip);
if (error)
buf = getstr(pp);
len = (int)strlen(buf);
tp = getres(mp, XFS_B_TO_FSB(mp, len));
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFLNK, 1, 0,
&creds, fsxp, &ip);
if (error)
break;
case IF_DIRECTORY:
tp = getres(mp, 0);
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, 1, 0,
&creds, fsxp, &ip);
if (error)
libxfs_trans_ijoin(tp, rbmip, 0);
bno = 0;
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
while (bno < mp->m_sb.sb_rbmblocks) {
nmap = XFS_BMAP_MAX_NMAP;
error = -libxfs_bmapi_write(tp, rbmip, bno,
res_failed(i);
libxfs_trans_ijoin(tp, rsumip, 0);
bno = 0;
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
while (bno < nsumblocks) {
nmap = XFS_BMAP_MAX_NMAP;
error = -libxfs_bmapi_write(tp, rsumip, bno,
if (i)
res_failed(i);
libxfs_trans_ijoin(tp, rbmip, 0);
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
ebno = XFS_RTMIN(mp->m_sb.sb_rextents,
bno + NBBY * mp->m_sb.sb_blocksize);
error = -libxfs_rtfree_extent(tp, bno, (xfs_extlen_t)(ebno-bno));
libxfs_trans_ijoin(tp, ip, 0);
bno = 0;
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
while (bno < mp->m_sb.sb_rbmblocks) {
nmap = XFS_BMAP_MAX_NMAP;
error = -libxfs_bmapi_write(tp, ip, bno,
libxfs_trans_ijoin(tp, ip, 0);
bno = 0;
- libxfs_defer_init(&dfops, &first);
- tp->t_dfops = &dfops;
+ libxfs_defer_init(tp, &dfops, &first);
while (bno < nsumblocks) {
nmap = XFS_BMAP_MAX_NMAP;
error = -libxfs_bmapi_write(tp, ip, bno,
/*
* could not be found, create it
*/
- libxfs_defer_init(&dfops, &first);
nres = XFS_MKDIR_SPACE_RES(mp, xname.len);
i = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_mkdir, nres, 0, 0, &tp);
if (i)
res_failed(i);
+ libxfs_defer_init(tp, &dfops, &first);
/*
* use iget/ijoin instead of trans_iget because the ialloc
libxfs_trans_ijoin(tp, orphanage_ip, 0);
libxfs_trans_ijoin(tp, ino_p, 0);
- libxfs_defer_init(&dfops, &first);
+ libxfs_defer_init(tp, &dfops, &first);
err = -libxfs_dir_createname(tp, orphanage_ip, &xname,
ino, &first, nres);
if (err)
libxfs_trans_ijoin(tp, orphanage_ip, 0);
libxfs_trans_ijoin(tp, ino_p, 0);
- libxfs_defer_init(&dfops, &first);
+ libxfs_defer_init(tp, &dfops, &first);
err = -libxfs_dir_createname(tp, orphanage_ip, &xname,
ino, &first, nres);
libxfs_trans_ijoin(tp, orphanage_ip, 0);
libxfs_trans_ijoin(tp, ino_p, 0);
- libxfs_defer_init(&dfops, &first);
+ libxfs_defer_init(tp, &dfops, &first);
err = -libxfs_dir_createname(tp, orphanage_ip, &xname, ino,
&first, nres);
if (err)
libxfs_dir_ino_validate(mp, pip.i_ino))
pip.i_ino = mp->m_sb.sb_rootino;
- libxfs_defer_init(&dfops, &firstblock);
+ libxfs_defer_init(NULL, &dfops, &firstblock);
nres = XFS_REMOVE_SPACE_RES(mp);
error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_remove, nres, 0, 0, &tp);
libxfs_trans_ijoin(tp, ip, 0);
- libxfs_defer_init(&dfops, &firstblock);
+ libxfs_defer_init(tp, &dfops, &firstblock);
error = -libxfs_dir_createname(tp, ip, &p->name, p->inum,
&firstblock, nres);
if (error) {
libxfs_trans_ijoin(tp, ip, 0);
libxfs_trans_bjoin(tp, bp);
memset(&args, 0, sizeof(args));
- libxfs_defer_init(&dfops, &firstblock);
+ libxfs_defer_init(tp, &dfops, &firstblock);
args.dp = ip;
args.trans = tp;
args.firstblock = &firstblock;
libxfs_trans_ijoin(tp, ip, 0);
libxfs_trans_bjoin(tp, bp);
libxfs_trans_bhold(tp, bp);
- libxfs_defer_init(&dfops, &firstblock);
+ libxfs_defer_init(tp, &dfops, &firstblock);
if (be32_to_cpu(d->magic) != wantmagic) {
do_warn(
_("bad directory block magic # %#x for directory inode %" PRIu64 " block %d: "),
libxfs_trans_ijoin(tp, ip, 0);
- libxfs_defer_init(&dfops, &first);
+ libxfs_defer_init(tp, &dfops, &first);
error = -libxfs_dir_createname(tp, ip, &xfs_name_dotdot,
ip->i_ino, &first, nres);
libxfs_trans_ijoin(tp, ip, 0);
- libxfs_defer_init(&dfops, &first);
+ libxfs_defer_init(tp, &dfops, &first);
error = -libxfs_dir_createname(tp, ip, &xfs_name_dot,
ip->i_ino, &first, nres);