void xfs_trans_init(struct xfs_mount *);
int xfs_trans_roll(struct xfs_trans **, struct xfs_inode *);
-xfs_trans_t *libxfs_trans_alloc(struct xfs_mount *, int);
-int libxfs_trans_reserve(struct xfs_trans *, struct xfs_trans_res *,
- uint, uint);
+int libxfs_trans_alloc(struct xfs_mount *mp, struct xfs_trans_res *resp,
+ uint blocks, uint rtextents, uint flags,
+ struct xfs_trans **tpp);
int libxfs_trans_commit(struct xfs_trans *);
void libxfs_trans_cancel(struct xfs_trans *);
struct xfs_buf *libxfs_trans_getsb(struct xfs_trans *, struct xfs_mount *, int);
#define xfs_trans_read_buf_map libxfs_trans_read_buf_map
#define xfs_trans_roll libxfs_trans_roll
#define xfs_trans_get_buf_map libxfs_trans_get_buf_map
-#define xfs_trans_reserve libxfs_trans_reserve
#define xfs_trans_resv_calc libxfs_trans_resv_calc
#define xfs_attr_get libxfs_attr_get
#define XFS_MOUNT_RDONLY 0 /* ignored in userspace */
-#define _xfs_trans_alloc(mp, type, f) libxfs_trans_alloc(mp, type)
#define xfs_trans_get_block_res(tp) 1
#define xfs_trans_set_sync(tp) ((void) 0)
#define xfs_trans_ordered_buf(tp, bp) ((void) 0)
*/
tres.tr_logres = trans->t_log_res;
tres.tr_logcount = trans->t_log_count;
- *tpp = libxfs_trans_alloc(trans->t_mountp, trans->t_type);
/*
* Commit the current transaction.
if (error)
return error;
- trans = *tpp;
/*
* Reserve space in the log for th next transaction.
* the prior and the next transactions.
*/
tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
- error = xfs_trans_reserve(trans, &tres, 0, 0);
+ error = libxfs_trans_alloc(trans->t_mountp, &tres, 0, 0, 0, tpp);
+ trans = *tpp;
/*
* Ensure that the inode is in the new transaction and locked.
*/
return 0;
}
-xfs_trans_t *
+int
libxfs_trans_alloc(
- xfs_mount_t *mp,
- int type)
+ struct xfs_mount *mp,
+ struct xfs_trans_res *resp,
+ unsigned int blocks,
+ unsigned int rtextents,
+ unsigned int flags,
+ struct xfs_trans **tpp)
+
{
- xfs_trans_t *ptr;
+ struct xfs_sb *sb = &mp->m_sb;
+ struct xfs_trans *ptr;
+
+ /*
+ * Attempt to reserve the needed disk blocks by decrementing
+ * the number needed from the number available. This will
+ * fail if the count would go below zero.
+ */
+ if (blocks > 0) {
+ if (sb->sb_fdblocks < blocks)
+ return -ENOSPC;
+ }
if ((ptr = calloc(sizeof(xfs_trans_t), 1)) == NULL) {
fprintf(stderr, _("%s: xact calloc failed (%d bytes): %s\n"),
exit(1);
}
ptr->t_mountp = mp;
- ptr->t_type = type;
INIT_LIST_HEAD(&ptr->t_items);
#ifdef XACT_DEBUG
fprintf(stderr, "allocated new transaction %p\n", ptr);
#endif
- return ptr;
-}
-
-int
-libxfs_trans_reserve(
- struct xfs_trans *tp,
- struct xfs_trans_res *resp,
- uint blocks,
- uint rtextents)
-{
- xfs_sb_t *mpsb = &tp->t_mountp->m_sb;
-
- /*
- * Attempt to reserve the needed disk blocks by decrementing
- * the number needed from the number available. This will
- * fail if the count would go below zero.
- */
- if (blocks > 0) {
- if (mpsb->sb_fdblocks < blocks)
- return -ENOSPC;
- }
- /* user space, don't need log/RT stuff (preserve the API though) */
+ *tpp = ptr;
return 0;
}
while (allocatesize_fsb && !error) {
datablocks = allocatesize_fsb;
- tp = xfs_trans_alloc(mp, XFS_TRANS_DIOSTRAT);
resblks = (uint)XFS_DIOSTRAT_SPACE_RES(mp, datablocks);
- error = xfs_trans_reserve(tp, &M_RES(mp)->tr_write,
- resblks, 0);
+ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks,
+ 0, 0, &tp);
/*
* Check for running out of space
*/
return error;
}
- /*
- * Start our first transaction of the day.
- *
- * All future transactions during this code must be "chained" off
- * this one via the trans_dup() call. All transactions will contain
- * the inode, and the inode will always be marked with trans_ihold().
- * Since the inode will be locked in all transactions, we must log
- * the inode in every transaction to let it float upward through
- * the log.
- */
- args.trans = xfs_trans_alloc(mp, XFS_TRANS_ATTR_SET);
+ tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres +
+ M_RES(mp)->tr_attrsetrt.tr_logres * args.total;
+ tres.tr_logcount = XFS_ATTRSET_LOG_COUNT;
+ tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
/*
* Root fork attributes can use reserved data blocks for this
* operation if necessary
*/
-
- if (rsvd)
- args.trans->t_flags |= XFS_TRANS_RESERVE;
-
- tres.tr_logres = M_RES(mp)->tr_attrsetm.tr_logres +
- M_RES(mp)->tr_attrsetrt.tr_logres * args.total;
- tres.tr_logcount = XFS_ATTRSET_LOG_COUNT;
- tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
- error = xfs_trans_reserve(args.trans, &tres, args.total, 0);
- if (error) {
- xfs_trans_cancel(args.trans);
+ error = xfs_trans_alloc(mp, &tres, args.total, 0,
+ rsvd ? XFS_TRANS_RESERVE : 0, &args.trans);
+ if (error)
return error;
- }
- xfs_ilock(dp, XFS_ILOCK_EXCL);
+ xfs_ilock(dp, XFS_ILOCK_EXCL);
error = xfs_trans_reserve_quota_nblks(args.trans, dp, args.total, 0,
rsvd ? XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_FORCE_RES :
XFS_QMOPT_RES_REGBLKS);
if (error)
return error;
- /*
- * Start our first transaction of the day.
- *
- * All future transactions during this code must be "chained" off
- * this one via the trans_dup() call. All transactions will contain
- * the inode, and the inode will always be marked with trans_ihold().
- * Since the inode will be locked in all transactions, we must log
- * the inode in every transaction to let it float upward through
- * the log.
- */
- args.trans = xfs_trans_alloc(mp, XFS_TRANS_ATTR_RM);
-
/*
* Root fork attributes can use reserved data blocks for this
* operation if necessary
*/
-
- if (flags & ATTR_ROOT)
- args.trans->t_flags |= XFS_TRANS_RESERVE;
-
- error = xfs_trans_reserve(args.trans, &M_RES(mp)->tr_attrrm,
- XFS_ATTRRM_SPACE_RES(mp), 0);
- if (error) {
- xfs_trans_cancel(args.trans);
+ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_attrrm,
+ XFS_ATTRRM_SPACE_RES(mp), 0,
+ (flags & ATTR_ROOT) ? XFS_TRANS_RESERVE : 0,
+ &args.trans);
+ if (error)
return error;
- }
xfs_ilock(dp, XFS_ILOCK_EXCL);
/*
mp = ip->i_mount;
ASSERT(!XFS_NOT_DQATTACHED(mp, ip));
- tp = xfs_trans_alloc(mp, XFS_TRANS_ADDAFORK);
+
blks = XFS_ADDAFORK_SPACE_RES(mp);
- if (rsvd)
- tp->t_flags |= XFS_TRANS_RESERVE;
- error = xfs_trans_reserve(tp, &M_RES(mp)->tr_addafork, blks, 0);
- if (error) {
- xfs_trans_cancel(tp);
+
+ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_addafork, blks, 0,
+ rsvd ? XFS_TRANS_RESERVE : 0, &tp);
+ if (error)
return error;
- }
+
xfs_ilock(ip, XFS_ILOCK_EXCL);
error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ?
XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_FORCE_RES :
xfs_fsblock_t firstfsb;
int error;
- tp = xfs_trans_alloc(mp, XFS_TRANS_DIOSTRAT);
- error = xfs_trans_reserve(tp, &M_RES(mp)->tr_write,
- XFS_DIOSTRAT_SPACE_RES(mp, 0), 0);
- if (error) {
- xfs_trans_cancel(tp);
+ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write,
+ XFS_DIOSTRAT_SPACE_RES(mp, 0), 0, 0, &tp);
+ if (error)
return error;
- }
xfs_ilock(ip, XFS_ILOCK_EXCL);
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
struct xfs_trans *tp;
int error;
- tp = _xfs_trans_alloc(mp, XFS_TRANS_SB_CHANGE, KM_SLEEP);
- error = xfs_trans_reserve(tp, &M_RES(mp)->tr_sb, 0, 0);
- if (error) {
- xfs_trans_cancel(tp);
+ error = xfs_trans_alloc(mp, &M_RES(mp)->tr_sb, 0, 0,
+ XFS_TRANS_NO_WRITECOUNT, &tp);
+ if (error)
return error;
- }
xfs_log_sb(tp);
if (wait)
#define XFS_TRANS_SYNC 0x08 /* make commit synchronous */
#define XFS_TRANS_DQ_DIRTY 0x10 /* at least one dquot in trx dirty */
#define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */
-#define XFS_TRANS_FREEZE_PROT 0x40 /* Transaction has elevated writer
- count in superblock */
+#define XFS_TRANS_NO_WRITECOUNT 0x40 /* do not elevate SB writecount */
+#define XFS_TRANS_NOFS 0x80 /* pass KM_NOFS to kmem_alloc */
+
/*
* Field values for xfs_trans_mod_sb.
*/
*/
static char *getstr(char **pp);
static void fail(char *msg, int i);
-static void getres(xfs_trans_t *tp, uint blocks);
+static struct xfs_trans * getres(struct xfs_mount *mp, uint blocks);
static void rsvfile(xfs_mount_t *mp, xfs_inode_t *ip, long long len);
static int newfile(xfs_trans_t *tp, xfs_inode_t *ip, xfs_bmap_free_t *flist,
xfs_fsblock_t *first, int dolocal, int logit, char *buf, int len);
fail(_("cannot reserve space"), i);
}
-static void
+static struct xfs_trans *
getres(
- xfs_trans_t *tp,
+ struct xfs_mount *mp,
uint blocks)
{
+ struct xfs_trans *tp;
int i;
- xfs_mount_t *mp;
uint r;
- mp = tp->t_mountp;
for (i = 0, r = MKFS_BLOCKRES(blocks); r >= blocks; r--) {
struct xfs_trans_res tres = {0};
- i = -libxfs_trans_reserve(tp, &tres, r, 0);
+ i = -libxfs_trans_alloc(mp, &tres, r, 0, 0, &tp);
if (i == 0)
- return;
+ return tp;
}
res_failed(i);
/* NOTREACHED */
+ return NULL;
}
static char *
{
int error;
xfs_trans_t *tp;
+ struct xfs_trans_res tres = {0};
error = -libxfs_alloc_file_space(ip, 0, llen, 1, 0);
/*
* update the inode timestamp, mode, and prealloc flag bits
*/
- tp = libxfs_trans_alloc(mp, 0);
-
+ libxfs_trans_alloc(mp, &tres, 0, 0, 0, &tp);
libxfs_trans_ijoin(tp, ip, 0);
VFS_I(ip)->i_mode &= ~S_ISUID;
xname.name = (unsigned char *)name;
xname.len = name ? strlen(name) : 0;
xname.type = 0;
- tp = libxfs_trans_alloc(mp, 0);
flags = XFS_ILOG_CORE;
xfs_bmap_init(&flist, &first);
switch (fmt) {
case IF_REGULAR:
buf = newregfile(pp, &len);
- getres(tp, XFS_B_TO_FSB(mp, len));
+ tp = getres(mp, XFS_B_TO_FSB(mp, len));
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0,
&creds, fsxp, &ip);
if (error)
progname, value, name);
exit(1);
}
- getres(tp, XFS_B_TO_FSB(mp, llen));
+ tp = getres(mp, XFS_B_TO_FSB(mp, llen));
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0,
&creds, fsxp, &ip);
return;
case IF_BLOCK:
- getres(tp, 0);
+ tp = getres(mp, 0);
majdev = getnum(getstr(pp), 0, 0, false);
mindev = getnum(getstr(pp), 0, 0, false);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFBLK, 1,
break;
case IF_CHAR:
- getres(tp, 0);
+ tp = getres(mp, 0);
majdev = getnum(getstr(pp), 0, 0, false);
mindev = getnum(getstr(pp), 0, 0, false);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFCHR, 1,
break;
case IF_FIFO:
- getres(tp, 0);
+ tp = getres(mp, 0);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFIFO, 1, 0,
&creds, fsxp, &ip);
if (error)
case IF_SYMLINK:
buf = getstr(pp);
len = (int)strlen(buf);
- getres(tp, XFS_B_TO_FSB(mp, len));
+ tp = getres(mp, XFS_B_TO_FSB(mp, len));
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFLNK, 1, 0,
&creds, fsxp, &ip);
if (error)
newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &flist);
break;
case IF_DIRECTORY:
- getres(tp, 0);
+ tp = getres(mp, 0);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, 1, 0,
&creds, fsxp, &ip);
if (error)
/*
* First, allocate the inodes.
*/
- tp = libxfs_trans_alloc(mp, 0);
- i = -libxfs_trans_reserve(tp, &tres, MKFS_BLOCKRES_INODE, 0);
+ i = -libxfs_trans_alloc(mp, &tres, MKFS_BLOCKRES_INODE, 0, 0, &tp);
if (i)
res_failed(i);
/*
* Next, give the bitmap file some zero-filled blocks.
*/
- tp = libxfs_trans_alloc(mp, 0);
- i = -libxfs_trans_reserve(tp, &tres, mp->m_sb.sb_rbmblocks +
- (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1), 0);
+ i = -libxfs_trans_alloc(mp, &tres,
+ mp->m_sb.sb_rbmblocks + (XFS_BM_MAXLEVELS(mp,XFS_DATA_FORK) - 1),
+ 0, 0, &tp);
if (i)
res_failed(i);
/*
* Give the summary file some zero-filled blocks.
*/
- tp = libxfs_trans_alloc(mp, 0);
nsumblocks = mp->m_rsumsize >> mp->m_sb.sb_blocklog;
- i = -libxfs_trans_reserve(tp, &tres, nsumblocks +
- (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1), 0);
+ i = -libxfs_trans_alloc(mp, &tres,
+ nsumblocks + (XFS_BM_MAXLEVELS(mp,XFS_DATA_FORK) - 1),
+ 0, 0, &tp);
if (i)
res_failed(i);
libxfs_trans_ijoin(tp, rsumip, 0);
* Do one transaction per bitmap block.
*/
for (bno = 0; bno < mp->m_sb.sb_rextents; bno = ebno) {
- tp = libxfs_trans_alloc(mp, 0);
- i = -libxfs_trans_reserve(tp, &tres, 0, 0);
+ i = -libxfs_trans_alloc(mp, &tres, 0, 0, 0, &tp);
if (i)
res_failed(i);
libxfs_trans_ijoin(tp, rbmip, 0);
xfs_trans_t *tp;
struct xfs_trans_res tres = {0};
+ c = libxfs_trans_alloc(mp, &tres, worst_freelist, 0, 0, &tp);
+ if (c)
+ res_failed(c);
+
memset(&args, 0, sizeof(args));
- args.tp = tp = libxfs_trans_alloc(mp, 0);
+ args.tp = tp;
args.mp = mp;
args.agno = agno;
args.alignment = 1;
args.pag = xfs_perag_get(mp,agno);
- c = -libxfs_trans_reserve(tp, &tres, worst_freelist, 0);
- if (c)
- res_failed(c);
libxfs_alloc_fix_freelist(&args, 0);
xfs_perag_put(args.pag);
int error;
memset(&args, 0, sizeof(args));
- args.tp = tp = libxfs_trans_alloc(mp, 0);
+ args.pag = xfs_perag_get(mp,agno);
+ libxfs_trans_alloc(mp, &tres,
+ xfs_alloc_min_freelist(mp, args.pag), 0, 0, &tp);
+ args.tp = tp;
args.mp = mp;
args.agno = agno;
args.alignment = 1;
- args.pag = xfs_perag_get(mp,agno);
- libxfs_trans_reserve(tp, &tres,
- xfs_alloc_min_freelist(mp, args.pag), 0);
error = libxfs_alloc_fix_freelist(&args, 0);
xfs_perag_put(args.pag);
if (error) {
/*
* first set up inode
*/
- tp = libxfs_trans_alloc(mp, 0);
-
- i = -libxfs_trans_reserve(tp, &tres, 10, 0);
+ i = -libxfs_trans_alloc(mp, &tres, 10, 0, 0, &tp);
if (i)
res_failed(i);
* then allocate blocks for file and fill with zeroes (stolen
* from mkfs)
*/
- tp = libxfs_trans_alloc(mp, 0);
- error = -libxfs_trans_reserve(tp, &tres, mp->m_sb.sb_rbmblocks +
- (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1), 0);
+ error = -libxfs_trans_alloc(mp, &tres,
+ mp->m_sb.sb_rbmblocks + (XFS_BM_MAXLEVELS(mp,XFS_DATA_FORK) - 1),
+ 0, 0, &tp);
if (error)
res_failed(error);
bmp = btmcompute;
bno = 0;
- tp = libxfs_trans_alloc(mp, 0);
-
- error = -libxfs_trans_reserve(tp, &tres, 10, 0);
+ error = -libxfs_trans_alloc(mp, &tres, 10, 0, 0, &tp);
if (error)
res_failed(error);
bno = 0;
end_bno = mp->m_rsumsize >> mp->m_sb.sb_blocklog;
- tp = libxfs_trans_alloc(mp, 0);
-
- error = -libxfs_trans_reserve(tp, &tres, 10, 0);
+ error = -libxfs_trans_alloc(mp, &tres, 10, 0, 0, &tp);
if (error)
res_failed(error);
/*
* first set up inode
*/
- tp = libxfs_trans_alloc(mp, 0);
-
- i = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 10, 0);
+ i = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 10, 0, 0, &tp);
if (i)
res_failed(i);
* then allocate blocks for file and fill with zeroes (stolen
* from mkfs)
*/
- tp = libxfs_trans_alloc(mp, 0);
xfs_bmap_init(&flist, &first);
nsumblocks = mp->m_rsumsize >> mp->m_sb.sb_blocklog;
tres.tr_logres = BBTOB(128);
tres.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT;
tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
- error = -libxfs_trans_reserve(tp, &tres, mp->m_sb.sb_rbmblocks +
- (XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1), 0);
+ error = -libxfs_trans_alloc(mp, &tres,
+ mp->m_sb.sb_rbmblocks + (XFS_BM_MAXLEVELS(mp,XFS_DATA_FORK) - 1),
+ 0, 0, &tp);
if (error)
res_failed(error);
int vers;
int times;
- tp = libxfs_trans_alloc(mp, 0);
ip = NULL;
-
- i = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 10, 0);
+ i = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_ichange, 10, 0, 0, &tp);
if (i)
res_failed(i);
/*
* could not be found, create it
*/
-
- tp = libxfs_trans_alloc(mp, 0);
xfs_bmap_init(&flist, &first);
-
nres = XFS_MKDIR_SPACE_RES(mp, xname.len);
- i = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_mkdir, nres, 0);
+ i = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_mkdir, nres, 0, 0, &tp);
if (i)
res_failed(i);
xname.len = snprintf((char *)fname, sizeof(fname), "%llu.%d",
(unsigned long long)ino, ++incr);
- tp = libxfs_trans_alloc(mp, 0);
-
if ((err = -libxfs_iget(mp, NULL, ino, 0, &ino_p, 0)))
do_error(_("%d - couldn't iget disconnected inode\n"), err);
if (err) {
ASSERT(err == ENOENT);
- err = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_rename,
- nres, 0);
+ err = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_rename,
+ nres, 0, 0, &tp);
if (err)
do_error(
_("space reservation failed (%d), filesystem may be out of space\n"),
libxfs_trans_commit(tp);
} else {
- err = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_rename,
- nres, 0);
+ err = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_rename,
+ nres, 0, 0, &tp);
if (err)
do_error(
_("space reservation failed (%d), filesystem may be out of space\n"),
* also accounted for in the create
*/
nres = XFS_DIRENTER_SPACE_RES(mp, xname.len);
- err = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove,
- nres, 0);
+ err = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_remove,
+ nres, 0, 0, &tp);
if (err)
do_error(
_("space reservation failed (%d), filesystem may be out of space\n"),
xfs_bmap_init(&flist, &firstblock);
- tp = libxfs_trans_alloc(mp, 0);
nres = XFS_REMOVE_SPACE_RES(mp);
- error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_remove, nres, 0, 0, &tp);
if (error)
res_failed(error);
libxfs_trans_ijoin(tp, ip, 0);
p->name.name[1] == '.'))))
continue;
- tp = libxfs_trans_alloc(mp, 0);
nres = XFS_CREATE_SPACE_RES(mp, p->name.len);
- error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_create,
- nres, 0);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_create,
+ nres, 0, 0, &tp);
if (error)
res_failed(error);
int nres;
xfs_trans_t *tp;
- tp = libxfs_trans_alloc(mp, 0);
nres = XFS_REMOVE_SPACE_RES(mp);
- error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_remove, nres, 0, 0, &tp);
if (error)
res_failed(error);
libxfs_trans_ijoin(tp, ip, 0);
if (freetab->nents < db + 1)
freetab->nents = db + 1;
- tp = libxfs_trans_alloc(mp, 0);
- error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, 0, 0);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_remove, 0, 0, 0, &tp);
if (error)
res_failed(error);
da.trans = tp;
break;
case XFS_DINODE_FMT_LOCAL:
- tp = libxfs_trans_alloc(mp, 0);
/*
* using the remove reservation is overkill
* since at most we'll only need to log the
* new define in ourselves.
*/
nres = no_modify ? 0 : XFS_REMOVE_SPACE_RES(mp);
- error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove,
- nres, 0);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_remove,
+ nres, 0, 0, &tp);
if (error)
res_failed(error);
do_warn(_("recreating root directory .. entry\n"));
- tp = libxfs_trans_alloc(mp, 0);
- ASSERT(tp != NULL);
-
nres = XFS_MKDIR_SPACE_RES(mp, 2);
- error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_mkdir, nres, 0);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_mkdir,
+ nres, 0, 0, &tp);
if (error)
res_failed(error);
do_warn(
_("creating missing \".\" entry in dir ino %" PRIu64 "\n"), ino);
- tp = libxfs_trans_alloc(mp, 0);
- ASSERT(tp != NULL);
-
nres = XFS_MKDIR_SPACE_RES(mp, 1);
- error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_mkdir,
- nres, 0);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_mkdir,
+ nres, 0, 0, &tp);
if (error)
res_failed(error);
int dirty;
int nres;
- tp = libxfs_trans_alloc(mp, XFS_TRANS_REMOVE);
-
nres = no_modify ? 0 : 10;
- error = -libxfs_trans_reserve(tp, &M_RES(mp)->tr_remove, nres, 0);
+ error = -libxfs_trans_alloc(mp, &M_RES(mp)->tr_remove, nres, 0, 0, &tp);
ASSERT(error == 0);
error = -libxfs_trans_iget(mp, tp, ino, 0, 0, &ip);