#define xfs_zero_extent libxfs_zero_extent
#define xfs_defer_init libxfs_defer_init
+#define xfs_defer_ijoin libxfs_defer_ijoin
#define xfs_defer_finish libxfs_defer_finish
#define xfs_defer_cancel libxfs_defer_cancel
if (error)
goto error0;
- /* complete the transaction */
- error = xfs_defer_finish(&tp, &free_list, ip);
+ /*
+ * Complete the transaction
+ */
+ error = xfs_defer_finish(&tp, &free_list);
if (error)
goto error0;
*/
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;
newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &dfops);
libxfs_trans_log_inode(tp, ip, flags);
- error = -libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ error = -libxfs_defer_finish(&tp, &dfops);
if (error)
fail(_("Pre-allocated file creation failed"), error);
libxfs_trans_commit(tp);
}
newdirectory(mp, tp, ip, pip);
libxfs_trans_log_inode(tp, ip, flags);
- error = -libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ error = -libxfs_defer_finish(&tp, &dfops);
if (error)
fail(_("Directory creation failed"), error);
libxfs_trans_commit(tp);
fail(_("Unknown format"), EINVAL);
}
libxfs_trans_log_inode(tp, ip, flags);
- error = -libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ error = -libxfs_defer_finish(&tp, &dfops);
if (error) {
fail(_("Error encountered creating file from prototype file"),
error);
}
}
- error = -libxfs_defer_finish(&tp, &dfops, rbmip);
+ libxfs_defer_ijoin(&dfops, rbmip);
+ error = -libxfs_defer_finish(&tp, &dfops);
if (error) {
fail(_("Completion of the realtime bitmap failed"), error);
}
bno += ep->br_blockcount;
}
}
- error = -libxfs_defer_finish(&tp, &dfops, rsumip);
+ libxfs_defer_ijoin(&dfops, rsumip);
+ error = -libxfs_defer_finish(&tp, &dfops);
if (error) {
fail(_("Completion of the realtime summary failed"), error);
}
fail(_("Error initializing the realtime space"),
error);
}
- error = -libxfs_defer_finish(&tp, &dfops, rbmip);
+ libxfs_defer_ijoin(&dfops, rbmip);
+ error = -libxfs_defer_finish(&tp, &dfops);
if (error) {
fail(_("Error completing the realtime space"), error);
}
bno += ep->br_blockcount;
}
}
- error = -libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ error = -libxfs_defer_finish(&tp, &dfops);
if (error) {
do_error(
_("allocation of the realtime bitmap failed, error = %d\n"),
bno += ep->br_blockcount;
}
}
- error = -libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ error = -libxfs_defer_finish(&tp, &dfops);
if (error) {
do_error(
_("allocation of the realtime summary ino failed, error = %d\n"),
libxfs_dir_init(tp, ip, pip);
libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
- error = -libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ error = -libxfs_defer_finish(&tp, &dfops);
if (error) {
do_error(_("%s directory creation failed -- bmapf error %d\n"),
ORPHANAGE, error);
inc_nlink(VFS_I(ino_p));
libxfs_trans_log_inode(tp, ino_p, XFS_ILOG_CORE);
- err = -libxfs_defer_finish(&tp, &dfops, ino_p);
+ libxfs_defer_ijoin(&dfops, ino_p);
+ err = -libxfs_defer_finish(&tp, &dfops);
if (err)
do_error(
_("bmap finish failed (err - %d), filesystem may be out of space\n"),
err);
}
- err = -libxfs_defer_finish(&tp, &dfops, ino_p);
+ libxfs_defer_ijoin(&dfops, ino_p);
+ err = -libxfs_defer_finish(&tp, &dfops);
if (err)
do_error(
_("bmap finish failed (%d), filesystem may be out of space\n"),
set_nlink(VFS_I(ino_p), 1);
libxfs_trans_log_inode(tp, ino_p, XFS_ILOG_CORE);
- err = -libxfs_defer_finish(&tp, &dfops, ino_p);
+ libxfs_defer_ijoin(&dfops, ino_p);
+ err = -libxfs_defer_finish(&tp, &dfops);
if (err)
do_error(
_("bmap finish failed (%d), filesystem may be out of space\n"),
goto out_bmap_cancel;
}
- error = -libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ error = -libxfs_defer_finish(&tp, &dfops);
libxfs_trans_commit(tp);
goto out_bmap_cancel;
}
- error = -libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ error = -libxfs_defer_finish(&tp, &dfops);
if (error) {
do_warn(
_("bmap finish failed (%d), filesystem may be out of space\n"),
if (error)
do_error(_("shrink_inode failed inode %" PRIu64 " block %u\n"),
ip->i_ino, da_bno);
- libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ libxfs_defer_finish(&tp, &dfops);
libxfs_trans_commit(tp);
}
d, &i);
if (needlog)
libxfs_dir2_data_log_header(&da, bp);
- libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ libxfs_defer_finish(&tp, &dfops);
libxfs_trans_commit(tp);
/* record the largest free space in the freetab for later checking */
libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
- error = -libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ error = -libxfs_defer_finish(&tp, &dfops);
ASSERT(error == 0);
libxfs_trans_commit(tp);
libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
- error = -libxfs_defer_finish(&tp, &dfops, ip);
+ libxfs_defer_ijoin(&dfops, ip);
+ error = -libxfs_defer_finish(&tp, &dfops);
ASSERT(error == 0);
libxfs_trans_commit(tp);
}