]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: remove xfs_bmapi_write() firstblock param
authorBrian Foster <bfoster@redhat.com>
Fri, 5 Oct 2018 02:36:08 +0000 (21:36 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 5 Oct 2018 02:36:08 +0000 (21:36 -0500)
Source kernel commit: a7beabeae221db2118a51f6948239d63b84499ca

All callers pass ->t_firstblock from the current transaction.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/util.c
libxfs/xfs_attr_remote.c
libxfs/xfs_bmap.c
libxfs/xfs_bmap.h
libxfs/xfs_da_btree.c
mkfs/proto.c
repair/phase6.c

index cf4dd83fc3de13ccbeffb903be32dff3274c2164..33f531a4b3a5ac925ae732d15a960745e0982e72 100644 (file)
@@ -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;
index 1d39ace1dde6a9be94a8051d843d959235733687..4b97085bbeec22eb861c33fced161bc1b12fbf97 100644 (file)
@@ -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;
index 63f22e1de6606b58f5e92130c0f609f4a7442087..ab4df57681af8eca92ebcc844ecdba71f5fe25d9 100644 (file)
@@ -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);
index 83180c7cf3ee83109c41999b05b9329eaa29a2c5..88c2b5dc499edf1c6fedacd611d8661f815b2938 100644 (file)
@@ -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);
index d736edaa419fb77925f464efca59b8dead947a8f..4541961b6dc523121bc609b3d7cfe2568e2ba37d 100644 (file)
@@ -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)
index a2a36937ce2bee88746f75f3544857d1355d9d9b..dbac6d39834e38ec56bdfd4e596feb624a5a0341 100644 (file)
@@ -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);
index 7ec206b568e448cc7ba14847864ecff2e27f83c5..420d3b1779d5a0db651660bc452048dda6252679 100644 (file)
@@ -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"),