]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: remove unnecessary fd parameter from file scrubbers
authorDarrick J. Wong <darrick.wong@oracle.com>
Thu, 26 Sep 2019 17:41:35 +0000 (13:41 -0400)
committerEric Sandeen <sandeen@redhat.com>
Thu, 26 Sep 2019 17:41:35 +0000 (13:41 -0400)
xfs_scrub's scrub ioctl wrapper functions always take a scrub_ctx and an
fd, but we always set the fd to ctx->mnt.fd.  Remove the redundant
parameter.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/phase3.c
scrub/scrub.c
scrub/scrub.h

index 5eff7907158bd80165fd83e430566d069a8261a7..81c64cd199531d08bbb7a653b8aa852d10e8374c 100644 (file)
 static bool
 xfs_scrub_fd(
        struct scrub_ctx        *ctx,
-       bool                    (*fn)(struct scrub_ctx *, uint64_t,
-                                     uint32_t, int, struct xfs_action_list *),
+       bool                    (*fn)(struct scrub_ctx *ctx, uint64_t ino,
+                                     uint32_t gen, struct xfs_action_list *a),
        struct xfs_bstat        *bs,
        struct xfs_action_list  *alist)
 {
-       return fn(ctx, bs->bs_ino, bs->bs_gen, ctx->mnt.fd, alist);
+       return fn(ctx, bs->bs_ino, bs->bs_gen, alist);
 }
 
 struct scrub_inode_ctx {
@@ -114,8 +114,8 @@ xfs_scrub_inode(
 
        if (S_ISLNK(bstat->bs_mode)) {
                /* Check symlink contents. */
-               moveon = xfs_scrub_symlink(ctx, bstat->bs_ino,
-                               bstat->bs_gen, ctx->mnt.fd, &alist);
+               moveon = xfs_scrub_symlink(ctx, bstat->bs_ino, bstat->bs_gen,
+                               &alist);
        } else if (S_ISDIR(bstat->bs_mode)) {
                /* Check the directory entries. */
                moveon = xfs_scrub_fd(ctx, xfs_scrub_dir, bstat, &alist);
index ac67f8ec0a6f60c809a05c42affc56bbde105ffb..62edc361499c842908ee97a2991f36315aac1a37 100644 (file)
@@ -176,7 +176,6 @@ xfs_scrub_warn_incomplete_scrub(
 static enum check_outcome
 xfs_check_metadata(
        struct scrub_ctx                *ctx,
-       int                             fd,
        struct xfs_scrub_metadata       *meta,
        bool                            is_inode)
 {
@@ -191,7 +190,7 @@ xfs_check_metadata(
 
        dbg_printf("check %s flags %xh\n", buf, meta->sm_flags);
 retry:
-       error = ioctl(fd, XFS_IOC_SCRUB_METADATA, meta);
+       error = ioctl(ctx->mnt.fd, XFS_IOC_SCRUB_METADATA, meta);
        if (debug_tweak_on("XFS_SCRUB_FORCE_REPAIR") && !error)
                meta->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
        if (error) {
@@ -363,7 +362,7 @@ xfs_scrub_metadata(
                background_sleep();
 
                /* Check the item. */
-               fix = xfs_check_metadata(ctx, ctx->mnt.fd, &meta, false);
+               fix = xfs_check_metadata(ctx, &meta, false);
                progress_add(1);
                switch (fix) {
                case CHECK_ABORT:
@@ -399,7 +398,7 @@ xfs_scrub_primary_super(
        enum check_outcome              fix;
 
        /* Check the item. */
-       fix = xfs_check_metadata(ctx, ctx->mnt.fd, &meta, false);
+       fix = xfs_check_metadata(ctx, &meta, false);
        switch (fix) {
        case CHECK_ABORT:
                return false;
@@ -478,7 +477,6 @@ __xfs_scrub_file(
        struct scrub_ctx                *ctx,
        uint64_t                        ino,
        uint32_t                        gen,
-       int                             fd,
        unsigned int                    type,
        struct xfs_action_list          *alist)
 {
@@ -493,7 +491,7 @@ __xfs_scrub_file(
        meta.sm_gen = gen;
 
        /* Scrub the piece of metadata. */
-       fix = xfs_check_metadata(ctx, fd, &meta, true);
+       fix = xfs_check_metadata(ctx, &meta, true);
        if (fix == CHECK_ABORT)
                return false;
        if (fix == CHECK_DONE)
@@ -507,10 +505,9 @@ xfs_scrub_inode_fields(
        struct scrub_ctx        *ctx,
        uint64_t                ino,
        uint32_t                gen,
-       int                     fd,
        struct xfs_action_list  *alist)
 {
-       return __xfs_scrub_file(ctx, ino, gen, fd, XFS_SCRUB_TYPE_INODE, alist);
+       return __xfs_scrub_file(ctx, ino, gen, XFS_SCRUB_TYPE_INODE, alist);
 }
 
 bool
@@ -518,10 +515,9 @@ xfs_scrub_data_fork(
        struct scrub_ctx        *ctx,
        uint64_t                ino,
        uint32_t                gen,
-       int                     fd,
        struct xfs_action_list  *alist)
 {
-       return __xfs_scrub_file(ctx, ino, gen, fd, XFS_SCRUB_TYPE_BMBTD, alist);
+       return __xfs_scrub_file(ctx, ino, gen, XFS_SCRUB_TYPE_BMBTD, alist);
 }
 
 bool
@@ -529,10 +525,9 @@ xfs_scrub_attr_fork(
        struct scrub_ctx        *ctx,
        uint64_t                ino,
        uint32_t                gen,
-       int                     fd,
        struct xfs_action_list  *alist)
 {
-       return __xfs_scrub_file(ctx, ino, gen, fd, XFS_SCRUB_TYPE_BMBTA, alist);
+       return __xfs_scrub_file(ctx, ino, gen, XFS_SCRUB_TYPE_BMBTA, alist);
 }
 
 bool
@@ -540,10 +535,9 @@ xfs_scrub_cow_fork(
        struct scrub_ctx        *ctx,
        uint64_t                ino,
        uint32_t                gen,
-       int                     fd,
        struct xfs_action_list  *alist)
 {
-       return __xfs_scrub_file(ctx, ino, gen, fd, XFS_SCRUB_TYPE_BMBTC, alist);
+       return __xfs_scrub_file(ctx, ino, gen, XFS_SCRUB_TYPE_BMBTC, alist);
 }
 
 bool
@@ -551,10 +545,9 @@ xfs_scrub_dir(
        struct scrub_ctx        *ctx,
        uint64_t                ino,
        uint32_t                gen,
-       int                     fd,
        struct xfs_action_list  *alist)
 {
-       return __xfs_scrub_file(ctx, ino, gen, fd, XFS_SCRUB_TYPE_DIR, alist);
+       return __xfs_scrub_file(ctx, ino, gen, XFS_SCRUB_TYPE_DIR, alist);
 }
 
 bool
@@ -562,10 +555,9 @@ xfs_scrub_attr(
        struct scrub_ctx        *ctx,
        uint64_t                ino,
        uint32_t                gen,
-       int                     fd,
        struct xfs_action_list  *alist)
 {
-       return __xfs_scrub_file(ctx, ino, gen, fd, XFS_SCRUB_TYPE_XATTR, alist);
+       return __xfs_scrub_file(ctx, ino, gen, XFS_SCRUB_TYPE_XATTR, alist);
 }
 
 bool
@@ -573,10 +565,9 @@ xfs_scrub_symlink(
        struct scrub_ctx        *ctx,
        uint64_t                ino,
        uint32_t                gen,
-       int                     fd,
        struct xfs_action_list  *alist)
 {
-       return __xfs_scrub_file(ctx, ino, gen, fd, XFS_SCRUB_TYPE_SYMLINK, alist);
+       return __xfs_scrub_file(ctx, ino, gen, XFS_SCRUB_TYPE_SYMLINK, alist);
 }
 
 bool
@@ -584,10 +575,9 @@ xfs_scrub_parent(
        struct scrub_ctx        *ctx,
        uint64_t                ino,
        uint32_t                gen,
-       int                     fd,
        struct xfs_action_list  *alist)
 {
-       return __xfs_scrub_file(ctx, ino, gen, fd, XFS_SCRUB_TYPE_PARENT, alist);
+       return __xfs_scrub_file(ctx, ino, gen, XFS_SCRUB_TYPE_PARENT, alist);
 }
 
 /* Test the availability of a kernel scrub command. */
index e6e3f16fde0dda757b89302d132412e065c093e3..7e28b522d1892d0c2c5d6f398644a2ceef436775 100644 (file)
@@ -36,21 +36,21 @@ bool xfs_can_scrub_parent(struct scrub_ctx *ctx);
 bool xfs_can_repair(struct scrub_ctx *ctx);
 
 bool xfs_scrub_inode_fields(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen,
-               int fd, struct xfs_action_list *alist);
+               struct xfs_action_list *alist);
 bool xfs_scrub_data_fork(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen,
-               int fd, struct xfs_action_list *alist);
+               struct xfs_action_list *alist);
 bool xfs_scrub_attr_fork(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen,
-               int fd, struct xfs_action_list *alist);
+               struct xfs_action_list *alist);
 bool xfs_scrub_cow_fork(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen,
-               int fd, struct xfs_action_list *alist);
+               struct xfs_action_list *alist);
 bool xfs_scrub_dir(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen,
-               int fd, struct xfs_action_list *alist);
+               struct xfs_action_list *alist);
 bool xfs_scrub_attr(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen,
-               int fd, struct xfs_action_list *alist);
+               struct xfs_action_list *alist);
 bool xfs_scrub_symlink(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen,
-               int fd, struct xfs_action_list *alist);
+               struct xfs_action_list *alist);
 bool xfs_scrub_parent(struct scrub_ctx *ctx, uint64_t ino, uint32_t gen,
-               int fd, struct xfs_action_list *alist);
+               struct xfs_action_list *alist);
 
 /* Repair parameters are the scrub inputs and retry count. */
 struct action_item {