]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: remove xfs_bmapi_write() dfops param
authorBrian Foster <bfoster@redhat.com>
Thu, 4 Oct 2018 19:30:01 +0000 (14:30 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 4 Oct 2018 19:30:01 +0000 (14:30 -0500)
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 <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 afa6b348aba3b30cffeb3fb25660ae59a76193d7..5eb4e557d2970665fc5eed594625c2724eb6bf53 100644 (file)
@@ -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;
index 8905b70da8caf8a389e36aba16e79a0e505be3c0..862eaaabaede35f0d405b0313ff1142b0e8c97ba 100644 (file)
@@ -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);
index 6d82d78e8c846e1aa7b66361da96c9ea5d7b1619..301ff6a08edbc318e6cd47559b2f995197bff2b5 100644 (file)
@@ -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;
                        }
index 44639588d1c7a1fbf929984f153fb68ce6feac9b..fc86cc218c58882e3b9adcd5774954f89ce78639 100644 (file)
@@ -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,
index 6b58585570a2a3ca209a19c2b993ceee1b43e1ce..e74e64d3a1747a3946946e4975a6973bd6ac54b7 100644 (file)
@@ -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)
index b35691920ec4237e07d026c0b4d1d45bcb8c4875..9d5d68db446c6b781166ca4e2234f8ec4aa5abed 100644 (file)
@@ -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));
index d3000c728a74978694d6ecb0a05b64831b380cfa..57d00989682752f71e57c9365f73ffa8a1b26c84 100644 (file)
@@ -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"),