extern int libxfs_alloc_file_space (struct xfs_inode *, xfs_off_t,
xfs_off_t, int, int);
-extern int libxfs_bmap_finish(xfs_trans_t **, xfs_bmap_free_t *, int *);
extern void libxfs_fs_repair_cmn_err(int, struct xfs_mount *, char *, ...);
extern void libxfs_fs_cmn_err(int, struct xfs_mount *, char *, ...);
int
libxfs_bmap_finish(
- xfs_trans_t **tp,
- xfs_bmap_free_t *flist,
- int *committed)
+ struct xfs_trans **tp,
+ struct xfs_bmap_free *flist,
+ struct xfs_inode *ip)
{
xfs_bmap_free_item_t *free; /* free extent list item */
xfs_bmap_free_item_t *next; /* next item on free list */
int error;
- if (flist->xbf_count == 0) {
- *committed = 0;
+ if (flist->xbf_count == 0)
return 0;
- }
for (free = flist->xbf_first; free != NULL; free = next) {
next = free->xbfi_next;
- if ((error = xfs_free_extent(*tp, free->xbfi_startblock,
- free->xbfi_blockcount)))
+ error = xfs_free_extent(*tp, free->xbfi_startblock,
+ free->xbfi_blockcount);
+ if (error)
return error;
xfs_bmap_del_free(flist, NULL, free);
}
- *committed = 0;
return 0;
}
xfs_fileoff_t startoffset_fsb;
xfs_trans_t *tp;
int xfs_bmapi_flags;
- int committed;
int error;
if (len <= 0)
goto error0;
/* complete the transaction */
- error = xfs_bmap_finish(&tp, &free_list, &committed);
+ error = xfs_bmap_finish(&tp, &free_list, ip);
if (error)
goto error0;
struct xfs_trans_res tres;
xfs_fsblock_t firstblock;
int rsvd = (flags & ATTR_ROOT) != 0;
- int error, err2, committed, local;
+ int error, err2, local;
XFS_STATS_INC(mp, xs_attr_set);
*/
xfs_bmap_init(args.flist, args.firstblock);
error = xfs_attr_shortform_to_leaf(&args);
- if (!error) {
- error = xfs_bmap_finish(&args.trans, args.flist,
- &committed);
- }
+ if (!error)
+ error = xfs_bmap_finish(&args.trans, args.flist, dp);
if (error) {
- ASSERT(committed);
args.trans = NULL;
xfs_bmap_cancel(&flist);
goto out;
}
- /*
- * bmap_finish() may have committed the last trans and started
- * a new one. We need the inode to be in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args.trans, dp, 0);
-
/*
* Commit the leaf transformation. We'll need another (linked)
* transaction to add the new attribute to the leaf.
{
xfs_inode_t *dp;
struct xfs_buf *bp;
- int retval, error, committed, forkoff;
+ int retval, error, forkoff;
trace_xfs_attr_leaf_addname(args);
*/
xfs_bmap_init(args->flist, args->firstblock);
error = xfs_attr3_leaf_to_node(args);
- if (!error) {
- error = xfs_bmap_finish(&args->trans, args->flist,
- &committed);
- }
+ if (!error)
+ error = xfs_bmap_finish(&args->trans, args->flist, dp);
if (error) {
- ASSERT(committed);
args->trans = NULL;
xfs_bmap_cancel(args->flist);
return error;
}
- /*
- * bmap_finish() may have committed the last trans and started
- * a new one. We need the inode to be in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args->trans, dp, 0);
-
/*
* Commit the current trans (including the inode) and start
* a new one.
xfs_bmap_init(args->flist, args->firstblock);
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */
- if (!error) {
+ if (!error)
error = xfs_bmap_finish(&args->trans,
- args->flist,
- &committed);
- }
+ args->flist, dp);
if (error) {
- ASSERT(committed);
args->trans = NULL;
xfs_bmap_cancel(args->flist);
return error;
}
-
- /*
- * bmap_finish() may have committed the last trans
- * and started a new one. We need the inode to be
- * in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args->trans, dp, 0);
}
/*
{
xfs_inode_t *dp;
struct xfs_buf *bp;
- int error, committed, forkoff;
+ int error, forkoff;
trace_xfs_attr_leaf_removename(args);
xfs_bmap_init(args->flist, args->firstblock);
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */
- if (!error) {
- error = xfs_bmap_finish(&args->trans, args->flist,
- &committed);
- }
+ if (!error)
+ error = xfs_bmap_finish(&args->trans, args->flist, dp);
if (error) {
- ASSERT(committed);
args->trans = NULL;
xfs_bmap_cancel(args->flist);
return error;
}
-
- /*
- * bmap_finish() may have committed the last trans and started
- * a new one. We need the inode to be in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args->trans, dp, 0);
}
return 0;
}
xfs_da_state_blk_t *blk;
xfs_inode_t *dp;
xfs_mount_t *mp;
- int committed, retval, error;
+ int retval, error;
trace_xfs_attr_node_addname(args);
state = NULL;
xfs_bmap_init(args->flist, args->firstblock);
error = xfs_attr3_leaf_to_node(args);
- if (!error) {
+ if (!error)
error = xfs_bmap_finish(&args->trans,
- args->flist,
- &committed);
- }
+ args->flist, dp);
if (error) {
- ASSERT(committed);
args->trans = NULL;
xfs_bmap_cancel(args->flist);
goto out;
}
- /*
- * bmap_finish() may have committed the last trans
- * and started a new one. We need the inode to be
- * in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args->trans, dp, 0);
-
/*
* Commit the node conversion and start the next
* trans in the chain.
*/
xfs_bmap_init(args->flist, args->firstblock);
error = xfs_da3_split(state);
- if (!error) {
- error = xfs_bmap_finish(&args->trans, args->flist,
- &committed);
- }
+ if (!error)
+ error = xfs_bmap_finish(&args->trans, args->flist, dp);
if (error) {
- ASSERT(committed);
args->trans = NULL;
xfs_bmap_cancel(args->flist);
goto out;
}
-
- /*
- * bmap_finish() may have committed the last trans and started
- * a new one. We need the inode to be in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args->trans, dp, 0);
} else {
/*
* Addition succeeded, update Btree hashvals.
if (retval && (state->path.active > 1)) {
xfs_bmap_init(args->flist, args->firstblock);
error = xfs_da3_join(state);
- if (!error) {
+ if (!error)
error = xfs_bmap_finish(&args->trans,
- args->flist,
- &committed);
- }
+ args->flist, dp);
if (error) {
- ASSERT(committed);
args->trans = NULL;
xfs_bmap_cancel(args->flist);
goto out;
}
-
- /*
- * bmap_finish() may have committed the last trans
- * and started a new one. We need the inode to be
- * in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args->trans, dp, 0);
}
/*
xfs_da_state_blk_t *blk;
xfs_inode_t *dp;
struct xfs_buf *bp;
- int retval, error, committed, forkoff;
+ int retval, error, forkoff;
trace_xfs_attr_node_removename(args);
if (retval && (state->path.active > 1)) {
xfs_bmap_init(args->flist, args->firstblock);
error = xfs_da3_join(state);
- if (!error) {
- error = xfs_bmap_finish(&args->trans, args->flist,
- &committed);
- }
+ if (!error)
+ error = xfs_bmap_finish(&args->trans, args->flist, dp);
if (error) {
- ASSERT(committed);
args->trans = NULL;
xfs_bmap_cancel(args->flist);
goto out;
}
-
- /*
- * bmap_finish() may have committed the last trans and started
- * a new one. We need the inode to be in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args->trans, dp, 0);
-
/*
* Commit the Btree join operation and start a new trans.
*/
xfs_bmap_init(args->flist, args->firstblock);
error = xfs_attr3_leaf_to_shortform(bp, args, forkoff);
/* bp is gone due to xfs_da_shrink_inode */
- if (!error) {
+ if (!error)
error = xfs_bmap_finish(&args->trans,
- args->flist,
- &committed);
- }
+ args->flist, dp);
if (error) {
- ASSERT(committed);
args->trans = NULL;
xfs_bmap_cancel(args->flist);
goto out;
}
-
- /*
- * bmap_finish() may have committed the last trans
- * and started a new one. We need the inode to be
- * in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args->trans, dp, 0);
} else
xfs_trans_brelse(args->trans, bp);
}
* Roll through the "value", allocating blocks on disk as required.
*/
while (blkcnt > 0) {
- int committed;
-
/*
* Allocate a single extent, up to the size of the value.
*
error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno,
blkcnt, XFS_BMAPI_ATTRFORK, args->firstblock,
args->total, &map, &nmap, args->flist);
- if (!error) {
- error = xfs_bmap_finish(&args->trans, args->flist,
- &committed);
- }
+ if (!error)
+ error = xfs_bmap_finish(&args->trans, args->flist, dp);
if (error) {
- ASSERT(committed);
args->trans = NULL;
xfs_bmap_cancel(args->flist);
return error;
}
- /*
- * bmap_finish() may have committed the last trans and started
- * a new one. We need the inode to be in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args->trans, dp, 0);
-
ASSERT(nmap == 1);
ASSERT((map.br_startblock != DELAYSTARTBLOCK) &&
(map.br_startblock != HOLESTARTBLOCK));
blkcnt = args->rmtblkcnt;
done = 0;
while (!done) {
- int committed;
-
xfs_bmap_init(args->flist, args->firstblock);
error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
XFS_BMAPI_ATTRFORK, 1, args->firstblock,
args->flist, &done);
- if (!error) {
+ if (!error)
error = xfs_bmap_finish(&args->trans, args->flist,
- &committed);
- }
+ args->dp);
if (error) {
- ASSERT(committed);
args->trans = NULL;
xfs_bmap_cancel(args->flist);
return error;
}
- /*
- * bmap_finish() may have committed the last trans and started
- * a new one. We need the inode to be in all transactions.
- */
- if (committed)
- xfs_trans_ijoin(args->trans, args->dp, 0);
-
/*
* Close out trans and start the next one in the chain.
*/
xfs_trans_t *tp; /* transaction pointer */
int blks; /* space reservation */
int version = 1; /* superblock attr version */
- int committed; /* xaction was committed */
int logflags; /* logging flags */
int error; /* error return value */
xfs_log_sb(tp);
}
- error = xfs_bmap_finish(&tp, &flist, &committed);
+ error = xfs_bmap_finish(&tp, &flist, NULL);
if (error)
goto bmap_cancel;
error = xfs_trans_commit(tp);
struct xfs_trans *tp;
struct xfs_bmap_free free_list;
xfs_fsblock_t firstfsb;
- int committed;
int error;
tp = xfs_trans_alloc(mp, XFS_TRANS_DIOSTRAT);
if (error)
goto out;
- error = xfs_bmap_finish(&tp, &free_list, &committed);
+ error = xfs_bmap_finish(&tp, &free_list, NULL);
if (error)
goto out;
xfs_fsblock_t bno, xfs_filblks_t len);
void xfs_bmap_cancel(struct xfs_bmap_free *flist);
int xfs_bmap_finish(struct xfs_trans **tp, struct xfs_bmap_free *flist,
- int *committed);
+ struct xfs_inode *ip);
void xfs_bmap_compute_maxlevels(struct xfs_mount *mp, int whichfork);
int xfs_bmap_first_unused(struct xfs_trans *tp, struct xfs_inode *ip,
xfs_extlen_t len, xfs_fileoff_t *unused, int whichfork);
#define IF_FIFO 6
char *buf;
- int committed;
int error;
xfs_fsblock_t first;
int flags;
newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &flist);
libxfs_trans_log_inode(tp, ip, flags);
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, ip);
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_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, ip);
if (error)
fail(_("Directory creation failed"), error);
libxfs_trans_commit(tp);
fail(_("Unknown format"), EINVAL);
}
libxfs_trans_log_inode(tp, ip, flags);
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, ip);
if (error) {
fail(_("Error encountered creating file from prototype file"),
error);
xfs_mount_t *mp)
{
xfs_fileoff_t bno;
- int committed;
xfs_fileoff_t ebno;
xfs_bmbt_irec_t *ep;
int error;
}
}
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, rbmip);
if (error) {
fail(_("Completion of the realtime bitmap failed"), error);
}
bno += ep->br_blockcount;
}
}
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, rsumip);
if (error) {
fail(_("Completion of the realtime summary failed"), error);
}
fail(_("Error initializing the realtime space"),
error);
}
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, rbmip);
if (error) {
fail(_("Error completing the realtime space"), error);
}
xfs_fsblock_t first;
int i;
int nmap;
- int committed;
int error;
xfs_bmap_free_t flist;
xfs_fileoff_t bno;
bno += ep->br_blockcount;
}
}
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, ip);
if (error) {
do_error(
_("allocation of the realtime bitmap failed, error = %d\n"),
xfs_fsblock_t first;
int i;
int nmap;
- int committed;
int error;
int nsumblocks;
xfs_bmap_free_t flist;
bno += ep->br_blockcount;
}
}
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, ip);
if (error) {
do_error(
_("allocation of the realtime summary ino failed, error = %d\n"),
ino_tree_node_t *irec;
int ino_offset = 0;
int i;
- int committed;
int error;
xfs_bmap_free_t flist;
const int mode = 0755;
libxfs_dir_init(tp, ip, pip);
libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, ip);
if (error) {
do_error(_("%s directory creation failed -- bmapf error %d\n"),
ORPHANAGE, error);
xfs_fsblock_t first;
xfs_bmap_free_t flist;
int err;
- int committed;
unsigned char fname[MAXPATHLEN + 1];
int nres;
int incr;
ino_p->i_d.di_nlink++;
libxfs_trans_log_inode(tp, ino_p, XFS_ILOG_CORE);
- err = -libxfs_bmap_finish(&tp, &flist, &committed);
+ err = -libxfs_bmap_finish(&tp, &flist, ino_p);
if (err)
do_error(
_("bmap finish failed (err - %d), filesystem may be out of space\n"),
err);
}
- err = -libxfs_bmap_finish(&tp, &flist, &committed);
+ err = -libxfs_bmap_finish(&tp, &flist, ino_p);
if (err)
do_error(
_("bmap finish failed (%d), filesystem may be out of space\n"),
ino_p->i_d.di_nlink = 1;
libxfs_trans_log_inode(tp, ino_p, XFS_ILOG_CORE);
- err = -libxfs_bmap_finish(&tp, &flist, &committed);
+ err = -libxfs_bmap_finish(&tp, &flist, ino_p);
if (err)
do_error(
_("bmap finish failed (%d), filesystem may be out of space\n"),
xfs_bmap_free_t flist;
xfs_inode_t pip;
dir_hash_ent_t *p;
- int committed;
int done;
/*
goto out_bmap_cancel;
}
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, ip);
libxfs_trans_commit(tp);
goto out_bmap_cancel;
}
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, ip);
if (error) {
do_warn(
_("bmap finish failed (%d), filesystem may be out of space\n"),
struct xfs_buf *bp)
{
xfs_da_args_t args;
- int committed;
int error;
xfs_fsblock_t firstblock;
xfs_bmap_free_t flist;
if (error)
do_error(_("shrink_inode failed inode %" PRIu64 " block %u\n"),
ip->i_ino, da_bno);
- libxfs_bmap_finish(&tp, &flist, &committed);
+ libxfs_bmap_finish(&tp, &flist, ip);
libxfs_trans_commit(tp);
}
xfs_dir2_leaf_entry_t *blp;
struct xfs_buf *bp;
xfs_dir2_block_tail_t *btp;
- int committed;
struct xfs_dir2_data_hdr *d;
xfs_dir2_db_t db;
xfs_dir2_data_entry_t *dep;
libxfs_dir2_data_freescan(mp->m_dir_geo, M_DIROPS(mp), d, &i);
if (needlog)
libxfs_dir2_data_log_header(&da, bp);
- libxfs_bmap_finish(&tp, &flist, &committed);
+ libxfs_bmap_finish(&tp, &flist, ip);
libxfs_trans_commit(tp);
/* record the largest free space in the freetab for later checking */
xfs_inode_t *ip;
xfs_trans_t *tp;
dir_hash_tab_t *hashtab;
- int need_dot, committed;
+ int need_dot;
int dirty, num_illegal, error, nres;
ino = XFS_AGINO_TO_INO(mp, agno, irec->ino_startnum + ino_offset);
libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, ip);
ASSERT(error == 0);
libxfs_trans_commit(tp);
libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
- error = -libxfs_bmap_finish(&tp, &flist, &committed);
+ error = -libxfs_bmap_finish(&tp, &flist, ip);
ASSERT(error == 0);
libxfs_trans_commit(tp);
}