]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs: fix xfs_btree_query_range callers to initialize btree rec fully
authorDarrick J. Wong <djwong@kernel.org>
Wed, 6 Sep 2023 11:53:48 +0000 (13:53 +0200)
committerCarlos Maiolino <cem@kernel.org>
Thu, 7 Sep 2023 09:55:50 +0000 (11:55 +0200)
Source kernel commit: 75dc0345312221971903b2e28279b7e24b7dbb1b

Use struct initializers to ensure that the xfs_btree_irecs passed into
the query_range function are completely initialized.  No functional
changes, just closing some sloppy hygiene.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/xfs_alloc.c
libxfs/xfs_refcount.c
libxfs/xfs_rmap.c

index b074d3fa1b6f7f32966dddb33d02894525a7fcd9..a66a8b8c3819d42b024086bc0a1918a141ce3632 100644 (file)
@@ -3819,15 +3819,11 @@ xfs_alloc_query_range(
        xfs_alloc_query_range_fn                fn,
        void                                    *priv)
 {
-       union xfs_btree_irec                    low_brec;
-       union xfs_btree_irec                    high_brec;
-       struct xfs_alloc_query_range_info       query;
+       union xfs_btree_irec                    low_brec = { .a = *low_rec };
+       union xfs_btree_irec                    high_brec = { .a = *high_rec };
+       struct xfs_alloc_query_range_info       query = { .priv = priv, .fn = fn };
 
        ASSERT(cur->bc_btnum == XFS_BTNUM_BNO);
-       low_brec.a = *low_rec;
-       high_brec.a = *high_rec;
-       query.priv = priv;
-       query.fn = fn;
        return xfs_btree_query_range(cur, &low_brec, &high_brec,
                        xfs_alloc_query_range_helper, &query);
 }
index 8f30dc196ebac21c8760dc6dcc12d0646442b422..ae72f25077adc9d3da158bea890a23118ce01dea 100644 (file)
@@ -1920,8 +1920,13 @@ xfs_refcount_recover_cow_leftovers(
        struct xfs_buf                  *agbp;
        struct xfs_refcount_recovery    *rr, *n;
        struct list_head                debris;
-       union xfs_btree_irec            low;
-       union xfs_btree_irec            high;
+       union xfs_btree_irec            low = {
+               .rc.rc_domain           = XFS_REFC_DOMAIN_COW,
+       };
+       union xfs_btree_irec            high = {
+               .rc.rc_domain           = XFS_REFC_DOMAIN_COW,
+               .rc.rc_startblock       = -1U,
+       };
        xfs_fsblock_t                   fsb;
        int                             error;
 
@@ -1952,10 +1957,6 @@ xfs_refcount_recover_cow_leftovers(
        cur = xfs_refcountbt_init_cursor(mp, tp, agbp, pag);
 
        /* Find all the leftover CoW staging extents. */
-       memset(&low, 0, sizeof(low));
-       memset(&high, 0, sizeof(high));
-       low.rc.rc_domain = high.rc.rc_domain = XFS_REFC_DOMAIN_COW;
-       high.rc.rc_startblock = -1U;
        error = xfs_btree_query_range(cur, &low, &high,
                        xfs_refcount_recover_extent, &debris);
        xfs_btree_del_cursor(cur, error);
index 4c01dda75b3d56b976e996ab5b2428a0bbb702b0..5ff6d7a32f2f17988946cdee3f9e266deab9b275 100644 (file)
@@ -2388,14 +2388,10 @@ xfs_rmap_query_range(
        xfs_rmap_query_range_fn                 fn,
        void                                    *priv)
 {
-       union xfs_btree_irec                    low_brec;
-       union xfs_btree_irec                    high_brec;
-       struct xfs_rmap_query_range_info        query;
+       union xfs_btree_irec                    low_brec = { .r = *low_rec };
+       union xfs_btree_irec                    high_brec = { .r = *high_rec };
+       struct xfs_rmap_query_range_info        query = { .priv = priv, .fn = fn };
 
-       low_brec.r = *low_rec;
-       high_brec.r = *high_rec;
-       query.priv = priv;
-       query.fn = fn;
        return xfs_btree_query_range(cur, &low_brec, &high_brec,
                        xfs_rmap_query_range_helper, &query);
 }