*/
xfs_defer_init(args.dfops, args.firstblock);
error = xfs_attr_shortform_to_leaf(&args);
- if (!error)
- error = xfs_defer_finish(&args.trans, args.dfops, dp);
- if (error) {
- args.trans = NULL;
- xfs_defer_cancel(&dfops);
- goto out;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args.dfops, dp);
+ error = xfs_defer_finish(&args.trans, args.dfops);
+ if (error)
+ goto out_defer_cancel;
/*
* Commit the leaf transformation. We'll need another (linked)
return error;
+out_defer_cancel:
+ xfs_defer_cancel(&dfops);
+ args.trans = NULL;
out:
if (args.trans)
xfs_trans_cancel(args.trans);
*/
xfs_defer_init(args->dfops, args->firstblock);
error = xfs_attr3_leaf_to_node(args);
- if (!error)
- error = xfs_defer_finish(&args->trans, args->dfops, dp);
- if (error) {
- args->trans = NULL;
- xfs_defer_cancel(args->dfops);
- return error;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args->dfops, dp);
+ error = xfs_defer_finish(&args->trans, args->dfops);
+ if (error)
+ goto out_defer_cancel;
/*
* Commit the current trans (including the inode) and start
xfs_defer_init(args->dfops, args->firstblock);
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */
- if (!error)
- error = xfs_defer_finish(&args->trans,
- args->dfops, dp);
- if (error) {
- args->trans = NULL;
- xfs_defer_cancel(args->dfops);
- return error;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args->dfops, dp);
+ error = xfs_defer_finish(&args->trans, args->dfops);
+ if (error)
+ goto out_defer_cancel;
}
/*
error = xfs_attr3_leaf_clearflag(args);
}
return error;
+out_defer_cancel:
+ xfs_defer_cancel(args->dfops);
+ args->trans = NULL;
+ return error;
}
/*
xfs_defer_init(args->dfops, args->firstblock);
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */
- if (!error)
- error = xfs_defer_finish(&args->trans, args->dfops, dp);
- if (error) {
- args->trans = NULL;
- xfs_defer_cancel(args->dfops);
- return error;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args->dfops, dp);
+ error = xfs_defer_finish(&args->trans, args->dfops);
+ if (error)
+ goto out_defer_cancel;
}
return 0;
+out_defer_cancel:
+ xfs_defer_cancel(args->dfops);
+ args->trans = NULL;
+ return error;
}
/*
state = NULL;
xfs_defer_init(args->dfops, args->firstblock);
error = xfs_attr3_leaf_to_node(args);
- if (!error)
- error = xfs_defer_finish(&args->trans,
- args->dfops, dp);
- if (error) {
- args->trans = NULL;
- xfs_defer_cancel(args->dfops);
- goto out;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args->dfops, dp);
+ error = xfs_defer_finish(&args->trans, args->dfops);
+ if (error)
+ goto out_defer_cancel;
/*
* Commit the node conversion and start the next
*/
xfs_defer_init(args->dfops, args->firstblock);
error = xfs_da3_split(state);
- if (!error)
- error = xfs_defer_finish(&args->trans, args->dfops, dp);
- if (error) {
- args->trans = NULL;
- xfs_defer_cancel(args->dfops);
- goto out;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args->dfops, dp);
+ error = xfs_defer_finish(&args->trans, args->dfops);
+ if (error)
+ goto out_defer_cancel;
} else {
/*
* Addition succeeded, update Btree hashvals.
if (retval && (state->path.active > 1)) {
xfs_defer_init(args->dfops, args->firstblock);
error = xfs_da3_join(state);
- if (!error)
- error = xfs_defer_finish(&args->trans,
- args->dfops, dp);
- if (error) {
- args->trans = NULL;
- xfs_defer_cancel(args->dfops);
- goto out;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args->dfops, dp);
+ error = xfs_defer_finish(&args->trans, args->dfops);
+ if (error)
+ goto out_defer_cancel;
}
/*
if (error)
return error;
return retval;
+out_defer_cancel:
+ xfs_defer_cancel(args->dfops);
+ args->trans = NULL;
+ goto out;
}
/*
if (retval && (state->path.active > 1)) {
xfs_defer_init(args->dfops, args->firstblock);
error = xfs_da3_join(state);
- if (!error)
- error = xfs_defer_finish(&args->trans, args->dfops, dp);
- if (error) {
- args->trans = NULL;
- xfs_defer_cancel(args->dfops);
- goto out;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args->dfops, dp);
+ error = xfs_defer_finish(&args->trans, args->dfops);
+ if (error)
+ goto out_defer_cancel;
/*
* Commit the Btree join operation and start a new trans.
*/
xfs_defer_init(args->dfops, args->firstblock);
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */
- if (!error)
- error = xfs_defer_finish(&args->trans,
- args->dfops, dp);
- if (error) {
- args->trans = NULL;
- xfs_defer_cancel(args->dfops);
- goto out;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args->dfops, dp);
+ error = xfs_defer_finish(&args->trans, args->dfops);
+ if (error)
+ goto out_defer_cancel;
} else
xfs_trans_brelse(args->trans, bp);
}
out:
xfs_da_state_free(state);
return error;
+out_defer_cancel:
+ xfs_defer_cancel(args->dfops);
+ args->trans = NULL;
+ goto out;
}
/*
error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno,
blkcnt, XFS_BMAPI_ATTRFORK, args->firstblock,
args->total, &map, &nmap, args->dfops);
- if (!error)
- error = xfs_defer_finish(&args->trans, args->dfops, dp);
- if (error) {
- args->trans = NULL;
- xfs_defer_cancel(args->dfops);
- return error;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args->dfops, dp);
+ error = xfs_defer_finish(&args->trans, args->dfops);
+ if (error)
+ goto out_defer_cancel;
ASSERT(nmap == 1);
ASSERT((map.br_startblock != DELAYSTARTBLOCK) &&
}
ASSERT(valuelen == 0);
return 0;
+out_defer_cancel:
+ xfs_defer_cancel(args->dfops);
+ args->trans = NULL;
+ return error;
}
/*
error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
XFS_BMAPI_ATTRFORK, 1, args->firstblock,
args->dfops, &done);
- if (!error)
- error = xfs_defer_finish(&args->trans, args->dfops,
- args->dp);
- if (error) {
- args->trans = NULL;
- xfs_defer_cancel(args->dfops);
- return error;
- }
+ if (error)
+ goto out_defer_cancel;
+ xfs_defer_ijoin(args->dfops, args->dp);
+ error = xfs_defer_finish(&args->trans, args->dfops);
+ if (error)
+ goto out_defer_cancel;
/*
* Close out trans and start the next one in the chain.
return error;
}
return 0;
+out_defer_cancel:
+ xfs_defer_cancel(args->dfops);
+ args->trans = NULL;
+ return error;
}
xfs_log_sb(tp);
}
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto bmap_cancel;
error = xfs_trans_commit(tp);
if (error)
goto out;
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out;
/*
* Add this inode to the deferred op. Each joined inode is relogged
- * each time we roll the transaction, in addition to any inode passed
- * to xfs_defer_finish().
+ * each time we roll the transaction.
*/
int
xfs_defer_ijoin(
int
xfs_defer_finish(
struct xfs_trans **tp,
- struct xfs_defer_ops *dop,
- struct xfs_inode *ip)
+ struct xfs_defer_ops *dop)
{
struct xfs_defer_pending *dfp;
struct list_head *li;
trace_xfs_defer_finish((*tp)->t_mountp, dop);
- xfs_defer_ijoin(dop, ip);
-
/* Until we run out of pending work to finish... */
while (xfs_defer_has_unfinished_work(dop)) {
/* Log intents for work items sitting in the intake. */
void xfs_defer_add(struct xfs_defer_ops *dop, enum xfs_defer_ops_type type,
struct list_head *h);
-int xfs_defer_finish(struct xfs_trans **tp, struct xfs_defer_ops *dop,
- struct xfs_inode *ip);
+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);
bool xfs_defer_has_unfinished_work(struct xfs_defer_ops *dop);
xfs_bmap_add_free(mp, &dfops, fsb,
rr->rr_rrec.rc_blockcount, NULL);
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_defer;
}
/* Finish transaction, free inodes. */
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto err_dfops;
/*
* Complete the transaction
*/
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto error0;
if (error)
goto out_bmap_cancel;
- error = xfs_defer_finish(&tp, &dfops, ip);
+ xfs_defer_ijoin(&dfops, ip);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_bmap_cancel;
if (error)
goto out_bmap_cancel;
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_bmap_cancel;
if (error)
goto out_defer;
- error = xfs_defer_finish(tpp, &dfops, ip);
+ xfs_defer_ijoin(&dfops, ip);
+ error = xfs_defer_finish(tpp, &dfops);
if (error)
goto out_defer;
xfs_trans_bhold(tp, bp);
- error = xfs_defer_finish(tpp, &dfops, NULL);
+ error = xfs_defer_finish(tpp, &dfops);
if (error)
goto error1;
*/
xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp);
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_bmap_cancel;
if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC))
xfs_trans_set_sync(tp);
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error) {
xfs_defer_cancel(&dfops);
goto error_return;
* Duplicate the transaction that has the permanent
* reservation and commit the old transaction.
*/
- error = xfs_defer_finish(&tp, &dfops, ip);
+ xfs_defer_ijoin(&dfops, ip);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_bmap_cancel;
* Just ignore errors at this point. There is nothing we can do except
* to try to keep going. Make sure it's not a silent error.
*/
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error) {
xfs_notice(mp, "%s: xfs_defer_finish returned error %d",
__func__, error);
if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC))
xfs_trans_set_sync(tp);
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_bmap_cancel;
if (tp->t_mountp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC))
xfs_trans_set_sync(tp);
- error = xfs_defer_finish(&tp, dfops, NULL);
+ error = xfs_defer_finish(&tp, dfops);
if (error) {
xfs_defer_cancel(dfops);
xfs_trans_cancel(tp);
/*
* Complete the transaction
*/
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_bmap_cancel;
if (error)
goto trans_cancel;
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto trans_cancel;
xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
}
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto error_on_bmapi_transaction;
}
xfs_refcount_finish_one_cleanup(tp, rcur, error);
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto abort_defer;
set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags);
goto out_bmap_cancel;
/* Finish up. */
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_bmap_cancel;
-(long)del.br_blockcount);
/* Roll the transaction */
- error = xfs_defer_finish(tpp, &dfops, ip);
+ xfs_defer_ijoin(&dfops, ip);
+ error = xfs_defer_finish(tpp, &dfops);
if (error) {
xfs_defer_cancel(&dfops);
break;
/* Remove the mapping from the CoW fork. */
xfs_bmap_del_extent_cow(ip, &idx, &got, &del);
- error = xfs_defer_finish(&tp, &dfops, ip);
+ xfs_defer_ijoin(&dfops, ip);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_defer;
next_extent:
next_extent:
/* Process all the deferred stuff. */
- error = xfs_defer_finish(&tp, &dfops, ip);
+ xfs_defer_ijoin(&dfops, ip);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_defer;
}
/*
* Free any blocks freed up in the transaction, then commit.
*/
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_bmap_cancel;
error = xfs_trans_commit(tp);
xfs_trans_set_sync(tp);
}
- error = xfs_defer_finish(&tp, &dfops, NULL);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto out_bmap_cancel;
/*
* Commit the first transaction. This logs the EFI and the inode.
*/
- error = xfs_defer_finish(&tp, &dfops, ip);
+ xfs_defer_ijoin(&dfops, ip);
+ error = xfs_defer_finish(&tp, &dfops);
if (error)
goto error_bmap_cancel;
/*