return 0;
}
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error) {
- dbprintf(_("failed to allocate empty transaction\n"));
- return 0;
- }
+ tp = libxfs_trans_alloc_empty(mp);
error = -libxfs_iget(mp, NULL, iocur_top->ino, 0, &ip);
if (error) {
xfs_ino_t ret = NULLFSINO;
int error;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- return NULLFSINO;
+ tp = libxfs_trans_alloc_empty(mp);
if (xfs_has_metadir(mp)) {
error = -libxfs_dqinode_load_parent(tp, &dp);
struct xfs_btree_cur *bt_cur;
int error;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error) {
- dbprintf(
- _("Cannot alloc transaction to look up rtgroup %u rmap inode\n"),
- rtg_rgno(rtg));
- return error;
- }
+ tp = libxfs_trans_alloc_empty(mp);
error = -libxfs_rtginode_load_parent(tp);
if (error) {
xfs_filblks_t used = 0;
int error;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error) {
- dbprintf(
- _("Cannot alloc transaction to look up rtgroup %u rmap inode\n"),
- rtg_rgno(rtg));
- return;
- }
+ tp = libxfs_trans_alloc_empty(mp);
error = -libxfs_rtginode_load_parent(tp);
if (error) {
unsigned int i;
int error;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- return error;
+ tp = libxfs_trans_alloc_empty(mp);
error = -libxfs_iget(mp, tp, ino, 0, &dp);
if (error)
set_cur_inode(mp->m_sb.sb_rootino);
}
- ret = -libxfs_trans_alloc_empty(mp, &tp);
- if (ret) {
- dbprintf(_("allocating state: %s\n"), strerror(ret));
- goto out_pbuf;
- }
+ tp = libxfs_trans_alloc_empty(mp);
ret = rdump_file(tp, iocur_top->ino, destdir, pbuf);
libxfs_trans_cancel(tp);
-out_pbuf:
free(pbuf);
return ret;
}
struct xfs_trans **tpp, int *nospace_error);
int libxfs_trans_alloc_rollable(struct xfs_mount *mp, uint blocks,
struct xfs_trans **tpp);
-int libxfs_trans_alloc_empty(struct xfs_mount *mp, struct xfs_trans **tpp);
+struct xfs_trans *libxfs_trans_alloc_empty(struct xfs_mount *mp);
int libxfs_trans_commit(struct xfs_trans *);
void libxfs_trans_cancel(struct xfs_trans *);
int libxfs_trans_reserve_more(struct xfs_trans *tp, uint blocks,
struct xfs_trans *tp;
int error;
- error = libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- return error;
+ tp = libxfs_trans_alloc_empty(mp);
error = libxfs_trans_metafile_iget(tp, ino, metafile_type, ipp);
libxfs_trans_cancel(tp);
return error;
}
+static inline struct xfs_trans *
+__libxfs_trans_alloc(
+ struct xfs_mount *mp,
+ uint flags)
+{
+ struct xfs_trans *tp;
+
+ tp = kmem_cache_zalloc(xfs_trans_cache, 0);
+ tp->t_mountp = mp;
+ INIT_LIST_HEAD(&tp->t_items);
+ INIT_LIST_HEAD(&tp->t_dfops);
+ tp->t_highest_agno = NULLAGNUMBER;
+
+ return tp;
+}
+
int
libxfs_trans_alloc(
struct xfs_mount *mp,
struct xfs_trans **tpp)
{
- struct xfs_trans *tp;
+ struct xfs_trans *tp = __libxfs_trans_alloc(mp, flags);
int error;
- tp = kmem_cache_zalloc(xfs_trans_cache, 0);
- tp->t_mountp = mp;
- INIT_LIST_HEAD(&tp->t_items);
- INIT_LIST_HEAD(&tp->t_dfops);
- tp->t_highest_agno = NULLAGNUMBER;
-
error = xfs_trans_reserve(tp, resp, blocks, rtextents);
if (error) {
xfs_trans_cancel(tp);
* Note the zero-length reservation; this transaction MUST be cancelled
* without any dirty data.
*/
-int
+struct xfs_trans *
libxfs_trans_alloc_empty(
- struct xfs_mount *mp,
- struct xfs_trans **tpp)
+ struct xfs_mount *mp)
{
- struct xfs_trans_res resv = {0};
-
- return xfs_trans_alloc(mp, &resv, 0, 0, XFS_TRANS_NO_WRITECOUNT, tpp);
+ return __libxfs_trans_alloc(mp, XFS_TRANS_NO_WRITECOUNT);
}
/*
* recording the CoW debris we cancel the (empty) transaction
* and everything goes away cleanly.
*/
- error = xfs_trans_alloc_empty(mp, &tp);
- if (error)
- return error;
+ tp = xfs_trans_alloc_empty(mp);
if (isrt) {
xfs_rtgroup_lock(to_rtg(xg), XFS_RTGLOCK_REFCOUNT);
* there while we try to make a per-AG reservation with the new
* geometry.
*/
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- do_error(
- _("Cannot reserve resources for upgrade check, err=%d.\n"),
- error);
+ tp = libxfs_trans_alloc_empty(mp);
error = -libxfs_ialloc_read_agi(pag, tp, 0, &agi_bp);
if (error)
fscan->have_garbage = false;
fscan->nr_file_pptrs = 0;
- libxfs_trans_alloc_empty(ip->i_mount, &tp);
+ tp = libxfs_trans_alloc_empty(ip->i_mount);
error = xattr_walk(tp, ip, examine_xattr, fscan);
if (tp)
libxfs_trans_cancel(tp);
do_error("init garbage pptr names failed: %s\n",
strerror(error));
- libxfs_trans_alloc_empty(ip->i_mount, &tp);
+ tp = libxfs_trans_alloc_empty(ip->i_mount);
error = xattr_walk(tp, ip, erase_pptrs, &fscan);
if (tp)
libxfs_trans_cancel(tp);
if (!dquots || !chkd_flags)
return;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- do_error(_("could not alloc transaction to open quota file\n"));
+ tp = libxfs_trans_alloc_empty(mp);
ino = get_quota_inode(type);
error = -libxfs_trans_metafile_iget(tp, ino, metafile_type, &ip);
struct xfs_inode *dp = NULL;
int error, err2;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- goto out;
+ tp = libxfs_trans_alloc_empty(mp);
error = -libxfs_dqinode_load_parent(tp, &dp);
if (error)
libxfs_irele(dp);
out_cancel:
libxfs_trans_cancel(tp);
-out:
if (error) {
switch (error) {
case EFSCORRUPTED:
int has;
int error;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- do_error(_("allocating tx for refcount bag update\n"));
+ tp = libxfs_trans_alloc_empty(mp);
cur = rcbagbt_mem_cursor(mp, tp, &bag->xfbtree);
error = rcbagbt_lookup_eq(cur, rmap, &has);
int has;
int error;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- do_error(_("allocating tx for refcount bag update\n"));
+ tp = libxfs_trans_alloc_empty(mp);
/* go to the right edge of the tree */
cur = rcbagbt_mem_cursor(mp, tp, &bag->xfbtree);
int error;
xfbt = &rmaps_for_group(isrt, agno)->ar_xfbtree;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- do_error(_("allocating tx for in-memory rmap update\n"));
+ tp = libxfs_trans_alloc_empty(mp);
error = rmap_init_mem_cursor(mp, tp, isrt, agno, &rmcur);
if (error)
if (rtg->rtg_inodes[type])
goto out_rtg;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- goto out_rtg;
-
+ tp = libxfs_trans_alloc_empty(mp);
error = -libxfs_rtginode_load(rtg, type, tp);
if (error)
int error, err2;
int i;
- error = -libxfs_trans_alloc_empty(mp, &tp);
- if (error)
- goto out;
+ tp = libxfs_trans_alloc_empty(mp);
if (xfs_has_rtgroups(mp) && mp->m_sb.sb_rgcount > 0) {
error = -libxfs_rtginode_load_parent(tp);
if (error)
out_cancel:
libxfs_trans_cancel(tp);
-out:
if (xfs_has_rtgroups(mp) && error) {
/*
* Old xfs_repair didn't complain if rtbitmaps didn't load