]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: remove dfops param from high level dirname calls
authorBrian Foster <bfoster@redhat.com>
Thu, 4 Oct 2018 19:25:01 +0000 (14:25 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 4 Oct 2018 19:25:01 +0000 (14:25 -0500)
Source kernel commit: c9cfdb381172174ade2445e7b468f1be550b1a44

All callers of the directory create, rename and remove interfaces
already associate the dfops with the transaction. Drop the dfops
parameters in these calls in preparation for further cleanups in the
layers below. 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/xfs_dir2.c
libxfs/xfs_dir2.h
mkfs/proto.c
repair/phase6.c

index 24ffb29b5006fb0c2e8cb9a7573e488b543fa425..05b270abaf33ec7fcab4c87ebbf1bc093d86823a 100644 (file)
@@ -242,7 +242,6 @@ xfs_dir_createname(
        struct xfs_name         *name,
        xfs_ino_t               inum,           /* new entry inode number */
        xfs_fsblock_t           *first,         /* bmap's firstblock */
-       struct xfs_defer_ops    *dfops,         /* bmap's freeblock list */
        xfs_extlen_t            total)          /* bmap's total block count */
 {
        struct xfs_da_args      *args;
@@ -250,6 +249,8 @@ xfs_dir_createname(
        int                     v;              /* type-checking value */
 
        ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
+       ASSERT(tp->t_dfops || !first);
+
        if (inum) {
                rval = xfs_dir_ino_validate(tp->t_mountp, inum);
                if (rval)
@@ -268,11 +269,11 @@ xfs_dir_createname(
        args->hashval = dp->i_mount->m_dirnameops->hashname(name);
        args->inumber = inum;
        args->dp = dp;
-       args->firstblock = first;
-       args->dfops = dfops;
        args->total = total;
        args->whichfork = XFS_DATA_FORK;
        args->trans = tp;
+       args->dfops = tp->t_dfops;
+       args->firstblock = first;
        args->op_flags = XFS_DA_OP_ADDNAME | XFS_DA_OP_OKNOENT;
        if (!inum)
                args->op_flags |= XFS_DA_OP_JUSTCHECK;
@@ -419,7 +420,6 @@ xfs_dir_removename(
        struct xfs_name *name,
        xfs_ino_t       ino,
        xfs_fsblock_t   *first,         /* bmap's firstblock */
-       struct xfs_defer_ops    *dfops,         /* bmap's freeblock list */
        xfs_extlen_t    total)          /* bmap's total block count */
 {
        struct xfs_da_args *args;
@@ -427,6 +427,7 @@ xfs_dir_removename(
        int             v;              /* type-checking value */
 
        ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
+       ASSERT(tp->t_dfops);
        XFS_STATS_INC(dp->i_mount, xs_dir_remove);
 
        args = kmem_zalloc(sizeof(*args), KM_SLEEP | KM_NOFS);
@@ -441,10 +442,10 @@ xfs_dir_removename(
        args->inumber = ino;
        args->dp = dp;
        args->firstblock = first;
-       args->dfops = dfops;
        args->total = total;
        args->whichfork = XFS_DATA_FORK;
        args->trans = tp;
+       args->dfops = tp->t_dfops;
 
        if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
                rval = xfs_dir2_sf_removename(args);
@@ -481,7 +482,6 @@ xfs_dir_replace(
        struct xfs_name *name,          /* name of entry to replace */
        xfs_ino_t       inum,           /* new inode number */
        xfs_fsblock_t   *first,         /* bmap's firstblock */
-       struct xfs_defer_ops    *dfops,         /* bmap's freeblock list */
        xfs_extlen_t    total)          /* bmap's total block count */
 {
        struct xfs_da_args *args;
@@ -489,6 +489,7 @@ xfs_dir_replace(
        int             v;              /* type-checking value */
 
        ASSERT(S_ISDIR(VFS_I(dp)->i_mode));
+       ASSERT(tp->t_dfops);
 
        rval = xfs_dir_ino_validate(tp->t_mountp, inum);
        if (rval)
@@ -506,10 +507,10 @@ xfs_dir_replace(
        args->inumber = inum;
        args->dp = dp;
        args->firstblock = first;
-       args->dfops = dfops;
        args->total = total;
        args->whichfork = XFS_DATA_FORK;
        args->trans = tp;
+       args->dfops = tp->t_dfops;
 
        if (dp->i_d.di_format == XFS_DINODE_FMT_LOCAL) {
                rval = xfs_dir2_sf_replace(args);
@@ -545,7 +546,7 @@ xfs_dir_canenter(
        xfs_inode_t     *dp,
        struct xfs_name *name)          /* name of entry to add */
 {
-       return xfs_dir_createname(tp, dp, name, 0, NULL, NULL, 0);
+       return xfs_dir_createname(tp, dp, name, 0, NULL, 0);
 }
 
 /*
index ed385316c7dccc6d08bde28fbb5f65b2ed7abba8..f203aebc07edcc00e48568f8cfd8f727e90719c5 100644 (file)
@@ -118,19 +118,16 @@ extern int xfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp,
                                struct xfs_inode *pdp);
 extern int xfs_dir_createname(struct xfs_trans *tp, struct xfs_inode *dp,
                                struct xfs_name *name, xfs_ino_t inum,
-                               xfs_fsblock_t *first,
-                               struct xfs_defer_ops *dfops, xfs_extlen_t tot);
+                               xfs_fsblock_t *first, xfs_extlen_t tot);
 extern int xfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp,
                                struct xfs_name *name, xfs_ino_t *inum,
                                struct xfs_name *ci_name);
 extern int xfs_dir_removename(struct xfs_trans *tp, struct xfs_inode *dp,
                                struct xfs_name *name, xfs_ino_t ino,
-                               xfs_fsblock_t *first,
-                               struct xfs_defer_ops *dfops, xfs_extlen_t tot);
+                               xfs_fsblock_t *first, xfs_extlen_t tot);
 extern int xfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
                                struct xfs_name *name, xfs_ino_t inum,
-                               xfs_fsblock_t *first,
-                               struct xfs_defer_ops *dfops, xfs_extlen_t tot);
+                               xfs_fsblock_t *first, xfs_extlen_t tot);
 extern int xfs_dir_canenter(struct xfs_trans *tp, struct xfs_inode *dp,
                                struct xfs_name *name);
 
index 9eb561b34e65dd7e5f62725812311c9f73489a42..b35691920ec4237e07d026c0b4d1d45bcb8c4875 100644 (file)
@@ -310,15 +310,14 @@ newdirent(
        xfs_inode_t     *pip,
        struct xfs_name *name,
        xfs_ino_t       inum,
-       xfs_fsblock_t   *first,
-       struct xfs_defer_ops    *dfops)
+       xfs_fsblock_t   *first)
 {
        int     error;
        int     rsv;
 
        rsv = XFS_DIRENTER_SPACE_RES(mp, name->len);
 
-       error = -libxfs_dir_createname(tp, pip, name, inum, first, dfops, rsv);
+       error = -libxfs_dir_createname(tp, pip, name, inum, first, rsv);
        if (error)
                fail(_("directory createname error"), error);
 }
@@ -456,7 +455,7 @@ parseproto(
                        free(buf);
                libxfs_trans_ijoin(tp, pip, 0);
                xname.type = XFS_DIR3_FT_REG_FILE;
-               newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &dfops);
+               newdirent(mp, tp, pip, &xname, ip->i_ino, &first);
                break;
 
        case IF_RESERVED:                       /* pre-allocated space only */
@@ -479,7 +478,7 @@ parseproto(
                libxfs_trans_ijoin(tp, pip, 0);
 
                xname.type = XFS_DIR3_FT_REG_FILE;
-               newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &dfops);
+               newdirent(mp, tp, pip, &xname, ip->i_ino, &first);
                libxfs_trans_log_inode(tp, ip, flags);
 
                libxfs_defer_ijoin(&dfops, ip);
@@ -502,7 +501,7 @@ parseproto(
                }
                libxfs_trans_ijoin(tp, pip, 0);
                xname.type = XFS_DIR3_FT_BLKDEV;
-               newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &dfops);
+               newdirent(mp, tp, pip, &xname, ip->i_ino, &first);
                flags |= XFS_ILOG_DEV;
                break;
 
@@ -516,7 +515,7 @@ parseproto(
                        fail(_("Inode allocation failed"), error);
                libxfs_trans_ijoin(tp, pip, 0);
                xname.type = XFS_DIR3_FT_CHRDEV;
-               newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &dfops);
+               newdirent(mp, tp, pip, &xname, ip->i_ino, &first);
                flags |= XFS_ILOG_DEV;
                break;
 
@@ -528,7 +527,7 @@ parseproto(
                        fail(_("Inode allocation failed"), error);
                libxfs_trans_ijoin(tp, pip, 0);
                xname.type = XFS_DIR3_FT_FIFO;
-               newdirent(mp, tp, pip, &xname, ip->i_ino, &first, &dfops);
+               newdirent(mp, tp, pip, &xname, ip->i_ino, &first);
                break;
        case IF_SYMLINK:
                buf = getstr(pp);
@@ -541,7 +540,7 @@ parseproto(
                flags |= newfile(tp, ip, &dfops, &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, &dfops);
+               newdirent(mp, tp, pip, &xname, ip->i_ino, &first);
                break;
        case IF_DIRECTORY:
                tp = getres(mp, 0);
@@ -558,8 +557,7 @@ parseproto(
                } else {
                        libxfs_trans_ijoin(tp, pip, 0);
                        xname.type = XFS_DIR3_FT_DIR;
-                       newdirent(mp, tp, pip, &xname, ip->i_ino,
-                                 &first, &dfops);
+                       newdirent(mp, tp, pip, &xname, ip->i_ino, &first);
                        inc_nlink(VFS_I(pip));
                        libxfs_trans_log_inode(tp, pip, XFS_ILOG_CORE);
                }
index 6680db88e48116cc12ff9ee84ebb1f9bbbcd5dcd..f011e24e159866eeb6cc5451f9392200fe6c83cc 100644 (file)
@@ -1043,7 +1043,7 @@ mk_orphanage(xfs_mount_t *mp)
         * create the actual entry
         */
        error = -libxfs_dir_createname(tp, pip, &xname, ip->i_ino, &first,
-                                       &dfops, nres);
+                                       nres);
        if (error)
                do_error(
                _("can't make %s, createname error %d\n"),
@@ -1152,7 +1152,7 @@ mv_orphanage(
 
                        libxfs_defer_init(&dfops, &first);
                        err = -libxfs_dir_createname(tp, orphanage_ip, &xname,
-                                               ino, &first, &dfops, nres);
+                                               ino, &first, nres);
                        if (err)
                                do_error(
        _("name create failed in %s (%d), filesystem may be out of space\n"),
@@ -1165,7 +1165,7 @@ mv_orphanage(
                        libxfs_trans_log_inode(tp, orphanage_ip, XFS_ILOG_CORE);
 
                        err = -libxfs_dir_createname(tp, ino_p, &xfs_name_dotdot,
-                                       orphanage_ino, &first, &dfops, nres);
+                                       orphanage_ino, &first, nres);
                        if (err)
                                do_error(
        _("creation of .. entry failed (%d), filesystem may be out of space\n"),
@@ -1196,7 +1196,7 @@ mv_orphanage(
                        libxfs_defer_init(&dfops, &first);
 
                        err = -libxfs_dir_createname(tp, orphanage_ip, &xname,
-                                               ino, &first, &dfops, nres);
+                                               ino, &first, nres);
                        if (err)
                                do_error(
        _("name create failed in %s (%d), filesystem may be out of space\n"),
@@ -1215,7 +1215,7 @@ mv_orphanage(
                        if (entry_ino_num != orphanage_ino)  {
                                err = -libxfs_dir_replace(tp, ino_p,
                                                &xfs_name_dotdot, orphanage_ino,
-                                               &first, &dfops, nres);
+                                               &first, nres);
                                if (err)
                                        do_error(
        _("name replace op failed (%d), filesystem may be out of space\n"),
@@ -1252,7 +1252,7 @@ mv_orphanage(
 
                libxfs_defer_init(&dfops, &first);
                err = -libxfs_dir_createname(tp, orphanage_ip, &xname, ino,
-                                               &first, &dfops, nres);
+                                               &first, nres);
                if (err)
                        do_error(
        _("name create failed in %s (%d), filesystem may be out of space\n"),
@@ -1436,7 +1436,7 @@ longform_dir2_rebuild(
 
                libxfs_defer_init(&dfops, &firstblock);
                error = -libxfs_dir_createname(tp, ip, &p->name, p->inum,
-                                               &firstblock, &dfops, nres);
+                                               &firstblock, nres);
                if (error) {
                        do_warn(
 _("name create failed in ino %" PRIu64 " (%d), filesystem may be out of space\n"),
@@ -3040,7 +3040,7 @@ process_dir_inode(
                libxfs_defer_init(&dfops, &first);
 
                error = -libxfs_dir_createname(tp, ip, &xfs_name_dotdot,
-                                       ip->i_ino, &first, &dfops, nres);
+                                       ip->i_ino, &first, nres);
                if (error)
                        do_error(
        _("can't make \"..\" entry in root inode %" PRIu64 ", createname error %d\n"), ino, error);
@@ -3098,7 +3098,7 @@ process_dir_inode(
                        libxfs_defer_init(&dfops, &first);
 
                        error = -libxfs_dir_createname(tp, ip, &xfs_name_dot,
-                                       ip->i_ino, &first, &dfops, nres);
+                                       ip->i_ino, &first, nres);
                        if (error)
                                do_error(
        _("can't make \".\" entry in dir ino %" PRIu64 ", createname error %d\n"),