xfs: pass struct xfs_eofblocks to the inode scan callback
authorDarrick J. Wong <djwong@kernel.org>
Mon, 31 May 2021 18:32:01 +0000 (11:32 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 3 Jun 2021 22:56:04 +0000 (15:56 -0700)
Pass a pointer to the actual eofb structure around the inode scanner
functions instead of a void pointer, now that none of the functions is
used as a callback.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/xfs_icache.c

index 806faa8..0c40c39 100644 (file)
@@ -55,9 +55,9 @@ xfs_icwalk_tag(enum xfs_icwalk_goal goal)
 }
 
 static int xfs_icwalk(struct xfs_mount *mp,
-               enum xfs_icwalk_goal goal, void *args);
+               enum xfs_icwalk_goal goal, struct xfs_eofblocks *eofb);
 static int xfs_icwalk_ag(struct xfs_perag *pag,
-               enum xfs_icwalk_goal goal, void *args);
+               enum xfs_icwalk_goal goal, struct xfs_eofblocks *eofb);
 
 /*
  * Private inode cache walk flags for struct xfs_eofblocks.  Must not coincide
@@ -814,10 +814,8 @@ out_unlock:
 static void
 xfs_dqrele_inode(
        struct xfs_inode        *ip,
-       void                    *priv)
+       struct xfs_eofblocks    *eofb)
 {
-       struct xfs_eofblocks    *eofb = priv;
-
        if (xfs_iflags_test(ip, XFS_INEW))
                xfs_inew_wait(ip);
 
@@ -1232,10 +1230,9 @@ xfs_reclaim_worker(
 STATIC int
 xfs_inode_free_eofblocks(
        struct xfs_inode        *ip,
-       void                    *args,
+       struct xfs_eofblocks    *eofb,
        unsigned int            *lockflags)
 {
-       struct xfs_eofblocks    *eofb = args;
        bool                    wait;
 
        wait = eofb && (eofb->eof_flags & XFS_EOF_FLAGS_SYNC);
@@ -1439,10 +1436,9 @@ xfs_prep_free_cowblocks(
 STATIC int
 xfs_inode_free_cowblocks(
        struct xfs_inode        *ip,
-       void                    *args,
+       struct xfs_eofblocks    *eofb,
        unsigned int            *lockflags)
 {
-       struct xfs_eofblocks    *eofb = args;
        bool                    wait;
        int                     ret = 0;
 
@@ -1579,16 +1575,16 @@ out_unlock_noent:
 static int
 xfs_blockgc_scan_inode(
        struct xfs_inode        *ip,
-       void                    *args)
+       struct xfs_eofblocks    *eofb)
 {
        unsigned int            lockflags = 0;
        int                     error;
 
-       error = xfs_inode_free_eofblocks(ip, args, &lockflags);
+       error = xfs_inode_free_eofblocks(ip, eofb, &lockflags);
        if (error)
                goto unlock;
 
-       error = xfs_inode_free_cowblocks(ip, args, &lockflags);
+       error = xfs_inode_free_cowblocks(ip, eofb, &lockflags);
 unlock:
        if (lockflags)
                xfs_iunlock(ip, lockflags);
@@ -1724,16 +1720,16 @@ static inline int
 xfs_icwalk_process_inode(
        enum xfs_icwalk_goal    goal,
        struct xfs_inode        *ip,
-       void                    *args)
+       struct xfs_eofblocks    *eofb)
 {
        int                     error = 0;
 
        switch (goal) {
        case XFS_ICWALK_DQRELE:
-               xfs_dqrele_inode(ip, args);
+               xfs_dqrele_inode(ip, eofb);
                break;
        case XFS_ICWALK_BLOCKGC:
-               error = xfs_blockgc_scan_inode(ip, args);
+               error = xfs_blockgc_scan_inode(ip, eofb);
                break;
        }
        return error;
@@ -1747,7 +1743,7 @@ static int
 xfs_icwalk_ag(
        struct xfs_perag        *pag,
        enum xfs_icwalk_goal    goal,
-       void                    *args)
+       struct xfs_eofblocks    *eofb)
 {
        struct xfs_mount        *mp = pag->pag_mount;
        uint32_t                first_index;
@@ -1819,7 +1815,7 @@ restart:
                for (i = 0; i < nr_found; i++) {
                        if (!batch[i])
                                continue;
-                       error = xfs_icwalk_process_inode(goal, batch[i], args);
+                       error = xfs_icwalk_process_inode(goal, batch[i], eofb);
                        if (error == -EAGAIN) {
                                skipped++;
                                continue;
@@ -1862,7 +1858,7 @@ static int
 xfs_icwalk(
        struct xfs_mount        *mp,
        enum xfs_icwalk_goal    goal,
-       void                    *args)
+       struct xfs_eofblocks    *eofb)
 {
        struct xfs_perag        *pag;
        int                     error = 0;
@@ -1871,7 +1867,7 @@ xfs_icwalk(
 
        while ((pag = xfs_icwalk_get_perag(mp, agno, goal))) {
                agno = pag->pag_agno + 1;
-               error = xfs_icwalk_ag(pag, goal, args);
+               error = xfs_icwalk_ag(pag, goal, eofb);
                xfs_perag_put(pag);
                if (error) {
                        last_error = error;