From: Brian Foster Date: Thu, 4 Oct 2018 19:30:01 +0000 (-0500) Subject: xfs: remove xfs_bmapi_write() dfops param X-Git-Tag: v4.19.0-rc0~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cbdfb3aba3d3a88a84dc56af98c9e15f4bda5178;p=thirdparty%2Fxfsprogs-dev.git xfs: remove xfs_bmapi_write() dfops param Source kernel commit: 6e702a5dcbe1d38cf479931dd2e2a3da884143f0 Now that all callers use ->t_dfops, the xfs_bmapi_write() dfops parameter is no longer necessary. Remove it and access ->t_dfops directly. This patch does not change behavior. Signed-off-by: Brian Foster Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/libxfs/util.c b/libxfs/util.c index afa6b348a..5eb4e557d 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -584,8 +584,7 @@ libxfs_alloc_file_space( xfs_defer_init(&free_list, &firstfsb); error = xfs_bmapi_write(tp, ip, startoffset_fsb, allocatesize_fsb, - xfs_bmapi_flags, &firstfsb, 0, imapp, - &reccount, &free_list); + xfs_bmapi_flags, &firstfsb, 0, imapp, &reccount); if (error) goto error0; diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index 8905b70da..862eaaaba 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -479,8 +479,7 @@ xfs_attr_rmtval_set( nmap = 1; error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno, blkcnt, XFS_BMAPI_ATTRFORK, args->firstblock, - args->total, &map, &nmap, - args->trans->t_dfops); + args->total, &map, &nmap); if (error) goto out_defer_cancel; xfs_defer_ijoin(args->trans->t_dfops, dp); diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 6d82d78e8..301ff6a08 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -4236,8 +4236,7 @@ xfs_bmapi_write( controls a.g. for allocs */ xfs_extlen_t total, /* total blocks needed */ struct xfs_bmbt_irec *mval, /* output: map values */ - int *nmap, /* i/o: mval size/count */ - struct xfs_defer_ops *dfops) /* i/o: list extents to free */ + int *nmap) /* i/o: mval size/count */ { struct xfs_mount *mp = ip->i_mount; struct xfs_ifork *ifp; @@ -4328,7 +4327,7 @@ xfs_bmapi_write( bma.ip = ip; bma.total = total; bma.datatype = 0; - bma.dfops = dfops; + bma.dfops = tp ? tp->t_dfops : NULL; bma.firstblock = firstblock; while (bno < end && n < *nmap) { @@ -4405,8 +4404,9 @@ xfs_bmapi_write( * the refcount btree for orphan recovery. */ if (whichfork == XFS_COW_FORK) { - error = xfs_refcount_alloc_cow_extent(mp, dfops, - bma.blkno, bma.length); + error = xfs_refcount_alloc_cow_extent(mp, + tp->t_dfops, bma.blkno, + bma.length); if (error) goto error0; } diff --git a/libxfs/xfs_bmap.h b/libxfs/xfs_bmap.h index 44639588d..fc86cc218 100644 --- a/libxfs/xfs_bmap.h +++ b/libxfs/xfs_bmap.h @@ -203,8 +203,7 @@ int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno, int xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len, int flags, xfs_fsblock_t *firstblock, xfs_extlen_t total, - struct xfs_bmbt_irec *mval, int *nmap, - struct xfs_defer_ops *dfops); + struct xfs_bmbt_irec *mval, int *nmap); int __xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t *rlen, int flags, xfs_extnum_t nexts, xfs_fsblock_t *firstblock, diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index 6b5858557..e74e64d3a 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -2057,8 +2057,7 @@ xfs_da_grow_inode_int( ASSERT(args->firstblock != NULL); error = xfs_bmapi_write(tp, dp, *bno, count, xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG, - args->firstblock, args->total, &map, &nmap, - args->trans->t_dfops); + args->firstblock, args->total, &map, &nmap); if (error) return error; @@ -2081,8 +2080,7 @@ xfs_da_grow_inode_int( error = xfs_bmapi_write(tp, dp, b, c, xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA, args->firstblock, args->total, - &mapp[mapi], &nmap, - args->trans->t_dfops); + &mapp[mapi], &nmap); if (error) goto out_free_map; if (nmap < 1) diff --git a/mkfs/proto.c b/mkfs/proto.c index b35691920..9d5d68db4 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -15,7 +15,7 @@ static char *getstr(char **pp); 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); @@ -218,7 +218,6 @@ static int newfile( xfs_trans_t *tp, xfs_inode_t *ip, - struct xfs_defer_ops *dfops, xfs_fsblock_t *first, int dolocal, int logit, @@ -249,7 +248,7 @@ newfile( 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); } @@ -441,16 +440,17 @@ parseproto( 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); @@ -469,6 +469,8 @@ parseproto( 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); @@ -492,6 +494,8 @@ parseproto( 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, @@ -507,6 +511,8 @@ parseproto( 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, @@ -521,6 +527,8 @@ parseproto( 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) @@ -533,17 +541,21 @@ parseproto( 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) @@ -682,12 +694,12 @@ rtinit( 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); @@ -718,12 +730,12 @@ rtinit( 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); @@ -753,6 +765,7 @@ rtinit( 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)); diff --git a/repair/phase6.c b/repair/phase6.c index d3000c728..57d009896 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -590,12 +590,12 @@ mk_rbmino(xfs_mount_t *mp) 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"), @@ -653,7 +653,7 @@ fill_rbmino(xfs_mount_t *mp) */ 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"), @@ -723,7 +723,7 @@ fill_rsumino(xfs_mount_t *mp) */ 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"), @@ -827,8 +827,6 @@ mk_rsumino(xfs_mount_t *mp) * 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); @@ -838,11 +836,12 @@ mk_rsumino(xfs_mount_t *mp) 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"),