]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: make the btree ag cursor private union anonymous
authorDave Chinner <dchinner@redhat.com>
Fri, 1 May 2020 21:37:09 +0000 (17:37 -0400)
committerEric Sandeen <sandeen@redhat.com>
Fri, 1 May 2020 21:37:09 +0000 (17:37 -0400)
Source kernel commit: c4aa10d041968f55f00fe8ca768b6f45f4066a69

This is much less widely used than the bc_private union was, so this
is done as a single patch. The named union xfs_btree_cur_private
goes away and is embedded into the struct xfs_btree_cur_ag as an
anonymous union, and the code is modified via this script:

$ sed -i 's/priv\.\([abt|refc]\)/\1/g' fs/xfs/*[ch] fs/xfs/*/*[ch]

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_alloc.c
libxfs/xfs_alloc_btree.c
libxfs/xfs_btree.h
libxfs/xfs_refcount.c
libxfs/xfs_refcount_btree.c

index 434856eaaf23bbc468da1fcb58aa0c8a3137bd9a..841b030509d32396a912f5dedbbeb6f528f8f8ef 100644 (file)
@@ -147,7 +147,7 @@ xfs_alloc_lookup_eq(
        cur->bc_rec.a.ar_startblock = bno;
        cur->bc_rec.a.ar_blockcount = len;
        error = xfs_btree_lookup(cur, XFS_LOOKUP_EQ, stat);
-       cur->bc_ag.priv.abt.active = (*stat == 1);
+       cur->bc_ag.abt.active = (*stat == 1);
        return error;
 }
 
@@ -167,7 +167,7 @@ xfs_alloc_lookup_ge(
        cur->bc_rec.a.ar_startblock = bno;
        cur->bc_rec.a.ar_blockcount = len;
        error = xfs_btree_lookup(cur, XFS_LOOKUP_GE, stat);
-       cur->bc_ag.priv.abt.active = (*stat == 1);
+       cur->bc_ag.abt.active = (*stat == 1);
        return error;
 }
 
@@ -186,7 +186,7 @@ xfs_alloc_lookup_le(
        cur->bc_rec.a.ar_startblock = bno;
        cur->bc_rec.a.ar_blockcount = len;
        error = xfs_btree_lookup(cur, XFS_LOOKUP_LE, stat);
-       cur->bc_ag.priv.abt.active = (*stat == 1);
+       cur->bc_ag.abt.active = (*stat == 1);
        return error;
 }
 
@@ -194,7 +194,7 @@ static inline bool
 xfs_alloc_cur_active(
        struct xfs_btree_cur    *cur)
 {
-       return cur && cur->bc_ag.priv.abt.active;
+       return cur && cur->bc_ag.abt.active;
 }
 
 /*
@@ -904,7 +904,7 @@ xfs_alloc_cur_check(
                deactivate = true;
 out:
        if (deactivate)
-               cur->bc_ag.priv.abt.active = false;
+               cur->bc_ag.abt.active = false;
        trace_xfs_alloc_cur_check(args->mp, cur->bc_btnum, bno, len, diff,
                                  *new);
        return 0;
@@ -1348,7 +1348,7 @@ xfs_alloc_walk_iter(
                if (error)
                        return error;
                if (i == 0)
-                       cur->bc_ag.priv.abt.active = false;
+                       cur->bc_ag.abt.active = false;
 
                if (count > 0)
                        count--;
@@ -1463,7 +1463,7 @@ xfs_alloc_ag_vextent_locality(
                if (error)
                        return error;
                if (i) {
-                       acur->cnt->bc_ag.priv.abt.active = true;
+                       acur->cnt->bc_ag.abt.active = true;
                        fbcur = acur->cnt;
                        fbinc = false;
                }
index dac354b1c258bf8cf1c2530d1181ec6e7176e6fa..72983927dd39241e79b2705e91506b26a55db342 100644 (file)
@@ -505,7 +505,7 @@ xfs_allocbt_init_cursor(
 
        cur->bc_ag.agbp = agbp;
        cur->bc_ag.agno = agno;
-       cur->bc_ag.priv.abt.active = false;
+       cur->bc_ag.abt.active = false;
 
        if (xfs_sb_version_hascrc(&mp->m_sb))
                cur->bc_flags |= XFS_BTREE_CRC_BLOCKS;
index 5e1bae45f53b037f6bbef5b6789c741cde808de9..6faed2141e27c5e97017d1133e457348b1a5b3cf 100644 (file)
@@ -177,22 +177,19 @@ union xfs_btree_irec {
        struct xfs_refcount_irec        rc;
 };
 
-/* Per-AG btree private information. */
-union xfs_btree_cur_private {
-       struct {
-               unsigned long   nr_ops;         /* # record updates */
-               int             shape_changes;  /* # of extent splits */
-       } refc;
-       struct {
-               bool            active;         /* allocation cursor state */
-       } abt;
-};
-
 /* Per-AG btree information. */
 struct xfs_btree_cur_ag {
-       struct xfs_buf                  *agbp;
-       xfs_agnumber_t                  agno;
-       union xfs_btree_cur_private     priv;
+       struct xfs_buf          *agbp;
+       xfs_agnumber_t          agno;
+       union {
+               struct {
+                       unsigned long nr_ops;   /* # record updates */
+                       int     shape_changes;  /* # of extent splits */
+               } refc;
+               struct {
+                       bool    active;         /* allocation cursor state */
+               } abt;
+       };
 };
 
 /* Btree-in-inode cursor information */
index 4d7f465af1ec7a48ad4198b50d58539e926dd13a..723c903eae8811b46bd593ab49efac87ee85820e 100644 (file)
@@ -882,7 +882,7 @@ xfs_refcount_still_have_space(
 {
        unsigned long                   overhead;
 
-       overhead = cur->bc_ag.priv.refc.shape_changes *
+       overhead = cur->bc_ag.refc.shape_changes *
                        xfs_allocfree_log_count(cur->bc_mp, 1);
        overhead *= cur->bc_mp->m_sb.sb_blocksize;
 
@@ -890,17 +890,17 @@ xfs_refcount_still_have_space(
         * Only allow 2 refcount extent updates per transaction if the
         * refcount continue update "error" has been injected.
         */
-       if (cur->bc_ag.priv.refc.nr_ops > 2 &&
+       if (cur->bc_ag.refc.nr_ops > 2 &&
            XFS_TEST_ERROR(false, cur->bc_mp,
                        XFS_ERRTAG_REFCOUNT_CONTINUE_UPDATE))
                return false;
 
-       if (cur->bc_ag.priv.refc.nr_ops == 0)
+       if (cur->bc_ag.refc.nr_ops == 0)
                return true;
        else if (overhead > cur->bc_tp->t_log_res)
                return false;
        return  cur->bc_tp->t_log_res - overhead >
-               cur->bc_ag.priv.refc.nr_ops * XFS_REFCOUNT_ITEM_OVERHEAD;
+               cur->bc_ag.refc.nr_ops * XFS_REFCOUNT_ITEM_OVERHEAD;
 }
 
 /*
@@ -967,7 +967,7 @@ xfs_refcount_adjust_extents(
                                        error = -EFSCORRUPTED;
                                        goto out_error;
                                }
-                               cur->bc_ag.priv.refc.nr_ops++;
+                               cur->bc_ag.refc.nr_ops++;
                        } else {
                                fsbno = XFS_AGB_TO_FSB(cur->bc_mp,
                                                cur->bc_ag.agno,
@@ -1002,7 +1002,7 @@ xfs_refcount_adjust_extents(
                        error = xfs_refcount_update(cur, &ext);
                        if (error)
                                goto out_error;
-                       cur->bc_ag.priv.refc.nr_ops++;
+                       cur->bc_ag.refc.nr_ops++;
                } else if (ext.rc_refcount == 1) {
                        error = xfs_refcount_delete(cur, &found_rec);
                        if (error)
@@ -1011,7 +1011,7 @@ xfs_refcount_adjust_extents(
                                error = -EFSCORRUPTED;
                                goto out_error;
                        }
-                       cur->bc_ag.priv.refc.nr_ops++;
+                       cur->bc_ag.refc.nr_ops++;
                        goto advloop;
                } else {
                        fsbno = XFS_AGB_TO_FSB(cur->bc_mp,
@@ -1087,7 +1087,7 @@ xfs_refcount_adjust(
        if (shape_changed)
                shape_changes++;
        if (shape_changes)
-               cur->bc_ag.priv.refc.shape_changes++;
+               cur->bc_ag.refc.shape_changes++;
 
        /* Now that we've taken care of the ends, adjust the middle extents */
        error = xfs_refcount_adjust_extents(cur, new_agbno, new_aglen,
@@ -1165,8 +1165,8 @@ xfs_refcount_finish_one(
         */
        rcur = *pcur;
        if (rcur != NULL && rcur->bc_ag.agno != agno) {
-               nr_ops = rcur->bc_ag.priv.refc.nr_ops;
-               shape_changes = rcur->bc_ag.priv.refc.shape_changes;
+               nr_ops = rcur->bc_ag.refc.nr_ops;
+               shape_changes = rcur->bc_ag.refc.shape_changes;
                xfs_refcount_finish_one_cleanup(tp, rcur, 0);
                rcur = NULL;
                *pcur = NULL;
@@ -1182,8 +1182,8 @@ xfs_refcount_finish_one(
                        error = -ENOMEM;
                        goto out_cur;
                }
-               rcur->bc_ag.priv.refc.nr_ops = nr_ops;
-               rcur->bc_ag.priv.refc.shape_changes = shape_changes;
+               rcur->bc_ag.refc.nr_ops = nr_ops;
+               rcur->bc_ag.refc.shape_changes = shape_changes;
        }
        *pcur = rcur;
 
index 4d925617870a52d42ee1f38ada589bb3649c1511..256229e9466333a6dd6822b8264644916cbc2ee9 100644 (file)
@@ -339,8 +339,8 @@ xfs_refcountbt_init_cursor(
        cur->bc_ag.agno = agno;
        cur->bc_flags |= XFS_BTREE_CRC_BLOCKS;
 
-       cur->bc_ag.priv.refc.nr_ops = 0;
-       cur->bc_ag.priv.refc.shape_changes = 0;
+       cur->bc_ag.refc.nr_ops = 0;
+       cur->bc_ag.refc.shape_changes = 0;
 
        return cur;
 }