static void fail(char *msg, int i);
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, struct xfs_defer_ops *dfops,
+static int newfile(xfs_trans_t *tp, xfs_inode_t *ip,
xfs_fsblock_t *first, int dolocal, int logit, char *buf, int len);
static char *newregfile(char **pp, int *len);
static void rtinit(xfs_mount_t *mp);
newfile(
xfs_trans_t *tp,
xfs_inode_t *ip,
- struct xfs_defer_ops *dfops,
xfs_fsblock_t *first,
int dolocal,
int logit,
nb = XFS_B_TO_FSB(mp, len);
nmap = 1;
error = -libxfs_bmapi_write(tp, ip, 0, nb, 0, first, nb,
- &map, &nmap, dfops);
+ &map, &nmap);
if (error) {
fail(_("error allocating space for a file"), error);
}
xname.len = name ? strlen(name) : 0;
xname.type = 0;
flags = XFS_ILOG_CORE;
- libxfs_defer_init(&dfops, &first);
switch (fmt) {
case IF_REGULAR:
buf = newregfile(pp, &len);
tp = getres(mp, XFS_B_TO_FSB(mp, len));
+ libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0,
&creds, fsxp, &ip);
if (error)
fail(_("Inode allocation failed"), error);
- flags |= newfile(tp, ip, &dfops, &first, 0, 0, buf, len);
+ flags |= newfile(tp, ip, &first, 0, 0, buf, len);
if (buf)
free(buf);
libxfs_trans_ijoin(tp, pip, 0);
exit(1);
}
tp = getres(mp, XFS_B_TO_FSB(mp, llen));
+ libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFREG, 1, 0,
&creds, fsxp, &ip);
case IF_BLOCK:
tp = getres(mp, 0);
+ libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
majdev = getnum(getstr(pp), 0, 0, false);
mindev = getnum(getstr(pp), 0, 0, false);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFBLK, 1,
case IF_CHAR:
tp = getres(mp, 0);
+ libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
majdev = getnum(getstr(pp), 0, 0, false);
mindev = getnum(getstr(pp), 0, 0, false);
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFCHR, 1,
case IF_FIFO:
tp = getres(mp, 0);
+ libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFIFO, 1, 0,
&creds, fsxp, &ip);
if (error)
buf = getstr(pp);
len = (int)strlen(buf);
tp = getres(mp, XFS_B_TO_FSB(mp, len));
+ libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFLNK, 1, 0,
&creds, fsxp, &ip);
if (error)
fail(_("Inode allocation failed"), error);
- flags |= newfile(tp, ip, &dfops, &first, 1, 1, buf, len);
+ flags |= newfile(tp, ip, &first, 1, 1, buf, len);
libxfs_trans_ijoin(tp, pip, 0);
xname.type = XFS_DIR3_FT_SYMLINK;
newdirent(mp, tp, pip, &xname, ip->i_ino, &first);
break;
case IF_DIRECTORY:
tp = getres(mp, 0);
+ libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
error = -libxfs_inode_alloc(&tp, pip, mode|S_IFDIR, 1, 0,
&creds, fsxp, &ip);
if (error)
libxfs_trans_ijoin(tp, rbmip, 0);
bno = 0;
libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
while (bno < mp->m_sb.sb_rbmblocks) {
nmap = XFS_BMAP_MAX_NMAP;
error = -libxfs_bmapi_write(tp, rbmip, bno,
(xfs_extlen_t)(mp->m_sb.sb_rbmblocks - bno),
- 0, &first, mp->m_sb.sb_rbmblocks,
- map, &nmap, &dfops);
+ 0, &first, mp->m_sb.sb_rbmblocks, map, &nmap);
if (error) {
fail(_("Allocation of the realtime bitmap failed"),
error);
libxfs_trans_ijoin(tp, rsumip, 0);
bno = 0;
libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
while (bno < nsumblocks) {
nmap = XFS_BMAP_MAX_NMAP;
error = -libxfs_bmapi_write(tp, rsumip, bno,
(xfs_extlen_t)(nsumblocks - bno),
- 0, &first, nsumblocks,
- map, &nmap, &dfops);
+ 0, &first, nsumblocks, map, &nmap);
if (error) {
fail(_("Allocation of the realtime summary failed"),
error);
res_failed(i);
libxfs_trans_ijoin(tp, rbmip, 0);
libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
ebno = XFS_RTMIN(mp->m_sb.sb_rextents,
bno + NBBY * mp->m_sb.sb_blocksize);
error = -libxfs_rtfree_extent(tp, bno, (xfs_extlen_t)(ebno-bno));
libxfs_trans_ijoin(tp, ip, 0);
bno = 0;
libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
while (bno < mp->m_sb.sb_rbmblocks) {
nmap = XFS_BMAP_MAX_NMAP;
error = -libxfs_bmapi_write(tp, ip, bno,
(xfs_extlen_t)(mp->m_sb.sb_rbmblocks - bno),
- 0, &first, mp->m_sb.sb_rbmblocks,
- map, &nmap, &dfops);
+ 0, &first, mp->m_sb.sb_rbmblocks, map, &nmap);
if (error) {
do_error(
_("couldn't allocate realtime bitmap, error = %d\n"),
*/
nmap = 1;
error = -libxfs_bmapi_write(tp, ip, bno, 1, 0,
- &first, 1, &map, &nmap, NULL);
+ &first, 1, &map, &nmap);
if (error || nmap != 1) {
do_error(
_("couldn't map realtime bitmap block %" PRIu64 ", error = %d\n"),
*/
nmap = 1;
error = -libxfs_bmapi_write(tp, ip, bno, 1, 0,
- &first, 1, &map, &nmap, NULL);
+ &first, 1, &map, &nmap);
if (error || nmap != 1) {
do_error(
_("couldn't map realtime summary inode block %" PRIu64 ", error = %d\n"),
* then allocate blocks for file and fill with zeroes (stolen
* from mkfs)
*/
- libxfs_defer_init(&dfops, &first);
-
nsumblocks = mp->m_rsumsize >> mp->m_sb.sb_blocklog;
blocks = nsumblocks + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) - 1;
error = -libxfs_trans_alloc_rollable(mp, blocks, &tp);
libxfs_trans_ijoin(tp, ip, 0);
bno = 0;
libxfs_defer_init(&dfops, &first);
+ tp->t_dfops = &dfops;
while (bno < nsumblocks) {
nmap = XFS_BMAP_MAX_NMAP;
error = -libxfs_bmapi_write(tp, ip, bno,
(xfs_extlen_t)(nsumblocks - bno),
- 0, &first, nsumblocks, map, &nmap, &dfops);
+ 0, &first, nsumblocks, map, &nmap);
if (error) {
do_error(
_("couldn't allocate realtime summary inode, error = %d\n"),