From: Brian Foster Date: Fri, 5 Oct 2018 02:36:08 +0000 (-0500) Subject: xfs: remove xfs_bmapi_write() firstblock param X-Git-Tag: v4.19.0-rc0~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b39f9fcbdd8920387ed4af96e9843f0d5caeffc2;p=thirdparty%2Fxfsprogs-dev.git xfs: remove xfs_bmapi_write() firstblock param Source kernel commit: a7beabeae221db2118a51f6948239d63b84499ca All callers pass ->t_firstblock from the current transaction. 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 cf4dd83fc..33f531a4b 100644 --- a/libxfs/util.c +++ b/libxfs/util.c @@ -584,7 +584,7 @@ libxfs_alloc_file_space( xfs_defer_init(NULL, &free_list, &firstfsb); error = xfs_bmapi_write(tp, ip, startoffset_fsb, allocatesize_fsb, - xfs_bmapi_flags, &firstfsb, 0, imapp, &reccount); + xfs_bmapi_flags, 0, imapp, &reccount); if (error) goto error0; diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index 1d39ace1d..4b97085bb 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -479,8 +479,7 @@ xfs_attr_rmtval_set( &args->trans->t_firstblock); nmap = 1; error = xfs_bmapi_write(args->trans, dp, (xfs_fileoff_t)lblkno, - blkcnt, XFS_BMAPI_ATTRFORK, - &args->trans->t_firstblock, args->total, &map, + blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map, &nmap); if (error) goto out_defer_cancel; diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c index 63f22e1de..ab4df5768 100644 --- a/libxfs/xfs_bmap.c +++ b/libxfs/xfs_bmap.c @@ -4203,12 +4203,6 @@ xfs_bmapi_convert_unwritten( * extent state if necessary. Details behaviour is controlled by the flags * parameter. Only allocates blocks from a single allocation group, to avoid * locking problems. - * - * The returned value in "firstblock" from the first call in a transaction - * must be remembered and presented to subsequent calls in "firstblock". - * An upper bound for the number of blocks to be allocated is supplied to - * the first call in "total"; if no allocation group has that many free - * blocks then the call will fail (return NULLFSBLOCK in "firstblock"). */ int xfs_bmapi_write( @@ -4217,8 +4211,6 @@ xfs_bmapi_write( xfs_fileoff_t bno, /* starting file offs. mapped */ xfs_filblks_t len, /* length to map in file */ int flags, /* XFS_BMAPI_... */ - xfs_fsblock_t *firstblock, /* first allocated block - 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 */ @@ -4285,7 +4277,7 @@ xfs_bmapi_write( XFS_STATS_INC(mp, xs_blk_mapw); - if (!tp || *firstblock == NULLFSBLOCK) { + if (!tp || tp->t_firstblock == NULLFSBLOCK) { if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE) bma.minleft = be16_to_cpu(ifp->if_broot->bb_level) + 1; else @@ -4312,7 +4304,7 @@ xfs_bmapi_write( bma.ip = ip; bma.total = total; bma.datatype = 0; - bma.firstblock = firstblock; + bma.firstblock = &tp->t_firstblock; ASSERT(!tp || tp->t_dfops); while (bno < end && n < *nmap) { @@ -4465,11 +4457,11 @@ error0: if (bma.cur) { if (!error) { - ASSERT(*firstblock == NULLFSBLOCK || - XFS_FSB_TO_AGNO(mp, *firstblock) <= + ASSERT(tp->t_firstblock == NULLFSBLOCK || + XFS_FSB_TO_AGNO(mp, tp->t_firstblock) <= XFS_FSB_TO_AGNO(mp, bma.cur->bc_private.b.firstblock)); - *firstblock = bma.cur->bc_private.b.firstblock; + tp->t_firstblock = bma.cur->bc_private.b.firstblock; } xfs_btree_del_cursor(bma.cur, error ? XFS_BTREE_ERROR : XFS_BTREE_NOERROR); diff --git a/libxfs/xfs_bmap.h b/libxfs/xfs_bmap.h index 83180c7cf..88c2b5dc4 100644 --- a/libxfs/xfs_bmap.h +++ b/libxfs/xfs_bmap.h @@ -201,8 +201,7 @@ int xfs_bmapi_read(struct xfs_inode *ip, xfs_fileoff_t bno, int *nmap, int flags); 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); + xfs_extlen_t total, 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 d736edaa4..4541961b6 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -2056,7 +2056,7 @@ xfs_da_grow_inode_int( nmap = 1; error = xfs_bmapi_write(tp, dp, *bno, count, xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG, - &tp->t_firstblock, args->total, &map, &nmap); + args->total, &map, &nmap); if (error) return error; @@ -2078,8 +2078,7 @@ xfs_da_grow_inode_int( c = (int)(*bno + count - b); error = xfs_bmapi_write(tp, dp, b, c, xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA, - &tp->t_firstblock, args->total, - &mapp[mapi], &nmap); + args->total, &mapp[mapi], &nmap); if (error) goto out_free_map; if (nmap < 1) diff --git a/mkfs/proto.c b/mkfs/proto.c index a2a36937c..dbac6d398 100644 --- a/mkfs/proto.c +++ b/mkfs/proto.c @@ -15,8 +15,8 @@ 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, - xfs_fsblock_t *first, int dolocal, int logit, char *buf, int len); +static int newfile(xfs_trans_t *tp, xfs_inode_t *ip, int dolocal, int logit, + char *buf, int len); static char *newregfile(char **pp, int *len); static void rtinit(xfs_mount_t *mp); static long filesize(int fd); @@ -218,7 +218,6 @@ static int newfile( xfs_trans_t *tp, xfs_inode_t *ip, - xfs_fsblock_t *first, int dolocal, int logit, char *buf, @@ -247,8 +246,7 @@ newfile( } else if (len > 0) { nb = XFS_B_TO_FSB(mp, len); nmap = 1; - error = -libxfs_bmapi_write(tp, ip, 0, nb, 0, first, nb, - &map, &nmap); + error = -libxfs_bmapi_write(tp, ip, 0, nb, 0, nb, &map, &nmap); if (error) { fail(_("error allocating space for a file"), error); } @@ -448,7 +446,7 @@ parseproto( &creds, fsxp, &ip); if (error) fail(_("Inode allocation failed"), error); - flags |= newfile(tp, ip, &first, 0, 0, buf, len); + flags |= newfile(tp, ip, 0, 0, buf, len); if (buf) free(buf); libxfs_trans_ijoin(tp, pip, 0); @@ -540,7 +538,7 @@ parseproto( &creds, fsxp, &ip); if (error) fail(_("Inode allocation failed"), error); - flags |= newfile(tp, ip, &first, 1, 1, buf, len); + flags |= newfile(tp, ip, 1, 1, buf, len); libxfs_trans_ijoin(tp, pip, 0); xname.type = XFS_DIR3_FT_SYMLINK; newdirent(mp, tp, pip, &xname, ip->i_ino); @@ -690,7 +688,7 @@ rtinit( 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); + 0, mp->m_sb.sb_rbmblocks, map, &nmap); if (error) { fail(_("Allocation of the realtime bitmap failed"), error); @@ -725,7 +723,7 @@ rtinit( nmap = XFS_BMAP_MAX_NMAP; error = -libxfs_bmapi_write(tp, rsumip, bno, (xfs_extlen_t)(nsumblocks - bno), - 0, &first, nsumblocks, map, &nmap); + 0, nsumblocks, map, &nmap); if (error) { fail(_("Allocation of the realtime summary failed"), error); diff --git a/repair/phase6.c b/repair/phase6.c index 7ec206b56..420d3b177 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -594,7 +594,7 @@ mk_rbmino(xfs_mount_t *mp) 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); + 0, mp->m_sb.sb_rbmblocks, map, &nmap); if (error) { do_error( _("couldn't allocate realtime bitmap, error = %d\n"), @@ -625,7 +625,6 @@ fill_rbmino(xfs_mount_t *mp) xfs_trans_t *tp; xfs_inode_t *ip; xfs_rtword_t *bmp; - xfs_fsblock_t first; int nmap; int error; xfs_fileoff_t bno; @@ -645,14 +644,12 @@ fill_rbmino(xfs_mount_t *mp) error); } - first = NULLFSBLOCK; while (bno < mp->m_sb.sb_rbmblocks) { /* * fill the file one block at a time */ nmap = 1; - error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, - &first, 1, &map, &nmap); + error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, 1, &map, &nmap); if (error || nmap != 1) { do_error( _("couldn't map realtime bitmap block %" PRIu64 ", error = %d\n"), @@ -693,7 +690,6 @@ fill_rsumino(xfs_mount_t *mp) xfs_trans_t *tp; xfs_inode_t *ip; xfs_suminfo_t *smp; - xfs_fsblock_t first; int nmap; int error; xfs_fileoff_t bno; @@ -715,14 +711,12 @@ fill_rsumino(xfs_mount_t *mp) error); } - first = NULLFSBLOCK; while (bno < end_bno) { /* * fill the file one block at a time */ nmap = 1; - error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, - &first, 1, &map, &nmap); + error = -libxfs_bmapi_write(tp, ip, bno, 1, 0, 1, &map, &nmap); if (error || nmap != 1) { do_error( _("couldn't map realtime summary inode block %" PRIu64 ", error = %d\n"), @@ -839,7 +833,7 @@ mk_rsumino(xfs_mount_t *mp) nmap = XFS_BMAP_MAX_NMAP; error = -libxfs_bmapi_write(tp, ip, bno, (xfs_extlen_t)(nsumblocks - bno), - 0, &first, nsumblocks, map, &nmap); + 0, nsumblocks, map, &nmap); if (error) { do_error( _("couldn't allocate realtime summary inode, error = %d\n"),