Skip to content

Commit 75dc034

Browse files
author
Darrick J. Wong
committed
xfs: fix xfs_btree_query_range callers to initialize btree rec fully
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>
1 parent 3ee9351 commit 75dc034

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3823,15 +3823,11 @@ xfs_alloc_query_range(
38233823
xfs_alloc_query_range_fn fn,
38243824
void *priv)
38253825
{
3826-
union xfs_btree_irec low_brec;
3827-
union xfs_btree_irec high_brec;
3828-
struct xfs_alloc_query_range_info query;
3826+
union xfs_btree_irec low_brec = { .a = *low_rec };
3827+
union xfs_btree_irec high_brec = { .a = *high_rec };
3828+
struct xfs_alloc_query_range_info query = { .priv = priv, .fn = fn };
38293829

38303830
ASSERT(cur->bc_btnum == XFS_BTNUM_BNO);
3831-
low_brec.a = *low_rec;
3832-
high_brec.a = *high_rec;
3833-
query.priv = priv;
3834-
query.fn = fn;
38353831
return xfs_btree_query_range(cur, &low_brec, &high_brec,
38363832
xfs_alloc_query_range_helper, &query);
38373833
}

fs/xfs/libxfs/xfs_refcount.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,8 +1921,13 @@ xfs_refcount_recover_cow_leftovers(
19211921
struct xfs_buf *agbp;
19221922
struct xfs_refcount_recovery *rr, *n;
19231923
struct list_head debris;
1924-
union xfs_btree_irec low;
1925-
union xfs_btree_irec high;
1924+
union xfs_btree_irec low = {
1925+
.rc.rc_domain = XFS_REFC_DOMAIN_COW,
1926+
};
1927+
union xfs_btree_irec high = {
1928+
.rc.rc_domain = XFS_REFC_DOMAIN_COW,
1929+
.rc.rc_startblock = -1U,
1930+
};
19261931
xfs_fsblock_t fsb;
19271932
int error;
19281933

@@ -1953,10 +1958,6 @@ xfs_refcount_recover_cow_leftovers(
19531958
cur = xfs_refcountbt_init_cursor(mp, tp, agbp, pag);
19541959

19551960
/* Find all the leftover CoW staging extents. */
1956-
memset(&low, 0, sizeof(low));
1957-
memset(&high, 0, sizeof(high));
1958-
low.rc.rc_domain = high.rc.rc_domain = XFS_REFC_DOMAIN_COW;
1959-
high.rc.rc_startblock = -1U;
19601961
error = xfs_btree_query_range(cur, &low, &high,
19611962
xfs_refcount_recover_extent, &debris);
19621963
xfs_btree_del_cursor(cur, error);

fs/xfs/libxfs/xfs_rmap.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,14 +2389,10 @@ xfs_rmap_query_range(
23892389
xfs_rmap_query_range_fn fn,
23902390
void *priv)
23912391
{
2392-
union xfs_btree_irec low_brec;
2393-
union xfs_btree_irec high_brec;
2394-
struct xfs_rmap_query_range_info query;
2392+
union xfs_btree_irec low_brec = { .r = *low_rec };
2393+
union xfs_btree_irec high_brec = { .r = *high_rec };
2394+
struct xfs_rmap_query_range_info query = { .priv = priv, .fn = fn };
23952395

2396-
low_brec.r = *low_rec;
2397-
high_brec.r = *high_rec;
2398-
query.priv = priv;
2399-
query.fn = fn;
24002396
return xfs_btree_query_range(cur, &low_brec, &high_brec,
24012397
xfs_rmap_query_range_helper, &query);
24022398
}

0 commit comments

Comments
 (0)