From bae78505198b3ec8208c6fb26797e623b613d970 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Wed, 1 Sep 2021 11:18:07 -0700 Subject: xfs: widen xfs_refcount_irec fields to handle realtime refcountbt Change the startblock and blockcount fields of xfs_refcount_irec to be 64 bits wide. This enables us to use the same high level refcount code for either tree. We'll also collect all the resulting breakage fixes here. Signed-off-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_format.h | 4 +- fs/xfs/libxfs/xfs_refcount.c | 306 +++++++++++++++++++++---------------------- fs/xfs/libxfs/xfs_refcount.h | 20 +-- fs/xfs/scrub/rmap.c | 4 +- fs/xfs/xfs_fsmap.c | 4 +- fs/xfs/xfs_reflink.c | 8 +- fs/xfs/xfs_trace.h | 158 ++++++++++++---------- 7 files changed, 260 insertions(+), 244 deletions(-) (limited to 'fs/xfs') diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h index 1cc59b197162..9ba2295570d9 100644 --- a/fs/xfs/libxfs/xfs_format.h +++ b/fs/xfs/libxfs/xfs_format.h @@ -1647,8 +1647,8 @@ struct xfs_refcount_key { }; struct xfs_refcount_irec { - xfs_agblock_t rc_startblock; /* starting block number */ - xfs_extlen_t rc_blockcount; /* count of free blocks */ + xfs_fsblock_t rc_startblock; /* starting block number */ + xfs_filblks_t rc_blockcount; /* count of free blocks */ xfs_nlink_t rc_refcount; /* number of inodes linked here */ }; diff --git a/fs/xfs/libxfs/xfs_refcount.c b/fs/xfs/libxfs/xfs_refcount.c index bf5c4f00a329..9c82573a6de2 100644 --- a/fs/xfs/libxfs/xfs_refcount.c +++ b/fs/xfs/libxfs/xfs_refcount.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2016 Oracle. All Rights Reserved. * Author: Darrick J. Wong @@ -34,9 +34,9 @@ enum xfs_refc_adjust_op { }; STATIC int __xfs_refcount_cow_alloc(struct xfs_btree_cur *rcur, - xfs_agblock_t agbno, xfs_extlen_t aglen); + xfs_fsblock_t bno, xfs_filblks_t len); STATIC int __xfs_refcount_cow_free(struct xfs_btree_cur *rcur, - xfs_agblock_t agbno, xfs_extlen_t aglen); + xfs_fsblock_t bno, xfs_filblks_t len); /* * Look up the first record less than or equal to [bno, len] in the btree @@ -45,7 +45,7 @@ STATIC int __xfs_refcount_cow_free(struct xfs_btree_cur *rcur, int xfs_refcount_lookup_le( struct xfs_btree_cur *cur, - xfs_agblock_t bno, + xfs_fsblock_t bno, int *stat) { trace_xfs_refcount_lookup(cur, bno, XFS_LOOKUP_LE); @@ -61,7 +61,7 @@ xfs_refcount_lookup_le( int xfs_refcount_lookup_ge( struct xfs_btree_cur *cur, - xfs_agblock_t bno, + xfs_fsblock_t bno, int *stat) { trace_xfs_refcount_lookup(cur, bno, XFS_LOOKUP_GE); @@ -77,7 +77,7 @@ xfs_refcount_lookup_ge( int xfs_refcount_lookup_eq( struct xfs_btree_cur *cur, - xfs_agblock_t bno, + xfs_fsblock_t bno, int *stat) { trace_xfs_refcount_lookup(cur, bno, XFS_LOOKUP_LE); @@ -110,7 +110,7 @@ xfs_refcount_get_rec( xfs_agnumber_t agno = cur->bc_ag.pag->pag_agno; union xfs_btree_rec *rec; int error; - xfs_agblock_t realstart; + xfs_fsblock_t realstart; error = xfs_btree_get_rec(cur, &rec, stat); if (error || !*stat) @@ -150,7 +150,7 @@ out_bad_rec: xfs_warn(mp, "Refcount BTree record corruption in AG %d detected!", agno); xfs_warn(mp, - "Start block 0x%x, block count 0x%x, references 0x%x", + "Start block 0x%llx, block count 0x%llx, references 0x%x", irec->rc_startblock, irec->rc_blockcount, irec->rc_refcount); xfs_btree_mark_sick(cur); return -EFSCORRUPTED; @@ -328,7 +328,7 @@ out_error: */ /* Next block after this extent. */ -static inline xfs_agblock_t +static inline xfs_fsblock_t xfs_refc_next( struct xfs_refcount_irec *rc) { @@ -336,12 +336,12 @@ xfs_refc_next( } /* - * Split a refcount extent that crosses agbno. + * Split a refcount extent that crosses bno. */ STATIC int xfs_refcount_split_extent( struct xfs_btree_cur *cur, - xfs_agblock_t agbno, + xfs_fsblock_t bno, bool *shape_changed) { struct xfs_refcount_irec rcext, tmp; @@ -349,7 +349,7 @@ xfs_refcount_split_extent( int error; *shape_changed = false; - error = xfs_refcount_lookup_le(cur, agbno, &found_rec); + error = xfs_refcount_lookup_le(cur, bno, &found_rec); if (error) goto out_error; if (!found_rec) @@ -363,23 +363,23 @@ xfs_refcount_split_extent( error = -EFSCORRUPTED; goto out_error; } - if (rcext.rc_startblock == agbno || xfs_refc_next(&rcext) <= agbno) + if (rcext.rc_startblock == bno || xfs_refc_next(&rcext) <= bno) return 0; *shape_changed = true; - trace_xfs_refcount_split_extent(cur, &rcext, agbno); + trace_xfs_refcount_split_extent(cur, &rcext, bno); /* Establish the right extent. */ tmp = rcext; - tmp.rc_startblock = agbno; - tmp.rc_blockcount -= (agbno - rcext.rc_startblock); + tmp.rc_startblock = bno; + tmp.rc_blockcount -= (bno - rcext.rc_startblock); error = xfs_refcount_update(cur, &tmp); if (error) goto out_error; /* Insert the left extent. */ tmp = rcext; - tmp.rc_blockcount = agbno - rcext.rc_startblock; + tmp.rc_blockcount = bno - rcext.rc_startblock; error = xfs_refcount_insert(cur, &tmp, &found_rec); if (error) goto out_error; @@ -405,7 +405,7 @@ xfs_refcount_merge_center_extents( struct xfs_refcount_irec *center, struct xfs_refcount_irec *right, unsigned long long extlen, - xfs_extlen_t *aglen) + xfs_filblks_t *len) { int error; int found_rec; @@ -466,7 +466,7 @@ xfs_refcount_merge_center_extents( if (error) goto out_error; - *aglen = 0; + *len = 0; return error; out_error: @@ -482,15 +482,15 @@ xfs_refcount_merge_left_extent( struct xfs_btree_cur *cur, struct xfs_refcount_irec *left, struct xfs_refcount_irec *cleft, - xfs_agblock_t *agbno, - xfs_extlen_t *aglen) + xfs_fsblock_t *bno, + xfs_filblks_t *len) { int error; int found_rec; trace_xfs_refcount_merge_left_extent(cur, left, cleft); - /* If the extent at agbno (cleft) wasn't synthesized, remove it. */ + /* If the extent at bno (cleft) wasn't synthesized, remove it. */ if (cleft->rc_refcount > 1) { error = xfs_refcount_lookup_le(cur, cleft->rc_startblock, &found_rec); @@ -528,8 +528,8 @@ xfs_refcount_merge_left_extent( if (error) goto out_error; - *agbno += cleft->rc_blockcount; - *aglen -= cleft->rc_blockcount; + *bno += cleft->rc_blockcount; + *len -= cleft->rc_blockcount; return error; out_error: @@ -545,7 +545,7 @@ xfs_refcount_merge_right_extent( struct xfs_btree_cur *cur, struct xfs_refcount_irec *right, struct xfs_refcount_irec *cright, - xfs_extlen_t *aglen) + xfs_filblks_t *len) { int error; int found_rec; @@ -553,7 +553,7 @@ xfs_refcount_merge_right_extent( trace_xfs_refcount_merge_right_extent(cur, cright, right); /* - * If the extent ending at agbno+aglen (cright) wasn't synthesized, + * If the extent ending at bno+len (cright) wasn't synthesized, * remove it. */ if (cright->rc_refcount > 1) { @@ -594,7 +594,7 @@ xfs_refcount_merge_right_extent( if (error) goto out_error; - *aglen -= cright->rc_blockcount; + *len -= cright->rc_blockcount; return error; out_error: @@ -606,23 +606,23 @@ out_error: #define XFS_FIND_RCEXT_COW 2 /* * Find the left extent and the one after it (cleft). This function assumes - * that we've already split any extent crossing agbno. + * that we've already split any extent crossing bno. */ STATIC int xfs_refcount_find_left_extents( struct xfs_btree_cur *cur, struct xfs_refcount_irec *left, struct xfs_refcount_irec *cleft, - xfs_agblock_t agbno, - xfs_extlen_t aglen, + xfs_fsblock_t bno, + xfs_filblks_t len, int flags) { struct xfs_refcount_irec tmp; int error; int found_rec; - left->rc_startblock = cleft->rc_startblock = NULLAGBLOCK; - error = xfs_refcount_lookup_le(cur, agbno - 1, &found_rec); + left->rc_startblock = cleft->rc_startblock = NULLFSBLOCK; + error = xfs_refcount_lookup_le(cur, bno - 1, &found_rec); if (error) goto out_error; if (!found_rec) @@ -637,7 +637,7 @@ xfs_refcount_find_left_extents( goto out_error; } - if (xfs_refc_next(&tmp) != agbno) + if (xfs_refc_next(&tmp) != bno) return 0; if ((flags & XFS_FIND_RCEXT_SHARED) && tmp.rc_refcount < 2) return 0; @@ -660,20 +660,20 @@ xfs_refcount_find_left_extents( } /* if tmp starts at the end of our range, just use that */ - if (tmp.rc_startblock == agbno) + if (tmp.rc_startblock == bno) *cleft = tmp; else { /* * There's a gap in the refcntbt at the start of the * range we're interested in (refcount == 1) so * synthesize the implied extent and pass it back. - * We assume here that the agbno/aglen range was + * We assume here that the bno/len range was * passed in from a data fork extent mapping and * therefore is allocated to exactly one owner. */ - cleft->rc_startblock = agbno; - cleft->rc_blockcount = min(aglen, - tmp.rc_startblock - agbno); + cleft->rc_startblock = bno; + cleft->rc_blockcount = min(len, + tmp.rc_startblock - bno); cleft->rc_refcount = 1; } } else { @@ -681,11 +681,11 @@ xfs_refcount_find_left_extents( * No extents, so pretend that there's one covering the whole * range. */ - cleft->rc_startblock = agbno; - cleft->rc_blockcount = aglen; + cleft->rc_startblock = bno; + cleft->rc_blockcount = len; cleft->rc_refcount = 1; } - trace_xfs_refcount_find_left_extent(cur, left, cleft, agbno); + trace_xfs_refcount_find_left_extent(cur, left, cleft, bno); return error; out_error: @@ -695,23 +695,23 @@ out_error: /* * Find the right extent and the one before it (cright). This function - * assumes that we've already split any extents crossing agbno + aglen. + * assumes that we've already split any extents crossing bno + len. */ STATIC int xfs_refcount_find_right_extents( struct xfs_btree_cur *cur, struct xfs_refcount_irec *right, struct xfs_refcount_irec *cright, - xfs_agblock_t agbno, - xfs_extlen_t aglen, + xfs_fsblock_t bno, + xfs_filblks_t len, int flags) { struct xfs_refcount_irec tmp; int error; int found_rec; - right->rc_startblock = cright->rc_startblock = NULLAGBLOCK; - error = xfs_refcount_lookup_ge(cur, agbno + aglen, &found_rec); + right->rc_startblock = cright->rc_startblock = NULLFSBLOCK; + error = xfs_refcount_lookup_ge(cur, bno + len, &found_rec); if (error) goto out_error; if (!found_rec) @@ -726,7 +726,7 @@ xfs_refcount_find_right_extents( goto out_error; } - if (tmp.rc_startblock != agbno + aglen) + if (tmp.rc_startblock != bno + len) return 0; if ((flags & XFS_FIND_RCEXT_SHARED) && tmp.rc_refcount < 2) return 0; @@ -749,18 +749,18 @@ xfs_refcount_find_right_extents( } /* if tmp ends at the end of our range, just use that */ - if (xfs_refc_next(&tmp) == agbno + aglen) + if (xfs_refc_next(&tmp) == bno + len) *cright = tmp; else { /* * There's a gap in the refcntbt at the end of the * range we're interested in (refcount == 1) so * create the implied extent and pass it back. - * We assume here that the agbno/aglen range was + * We assume here that the bno/len range was * passed in from a data fork extent mapping and * therefore is allocated to exactly one owner. */ - cright->rc_startblock = max(agbno, xfs_refc_next(&tmp)); + cright->rc_startblock = max(bno, xfs_refc_next(&tmp)); cright->rc_blockcount = right->rc_startblock - cright->rc_startblock; cright->rc_refcount = 1; @@ -770,12 +770,12 @@ xfs_refcount_find_right_extents( * No extents, so pretend that there's one covering the whole * range. */ - cright->rc_startblock = agbno; - cright->rc_blockcount = aglen; + cright->rc_startblock = bno; + cright->rc_blockcount = len; cright->rc_refcount = 1; } trace_xfs_refcount_find_right_extent(cur, cright, right, - agbno + aglen); + bno + len); return error; out_error: @@ -788,7 +788,7 @@ static inline bool xfs_refc_valid( struct xfs_refcount_irec *rc) { - return rc->rc_startblock != NULLAGBLOCK; + return rc->rc_startblock != NULLFSBLOCK; } /* @@ -797,8 +797,8 @@ xfs_refc_valid( STATIC int xfs_refcount_merge_extents( struct xfs_btree_cur *cur, - xfs_agblock_t *agbno, - xfs_extlen_t *aglen, + xfs_fsblock_t *bno, + xfs_filblks_t *len, enum xfs_refc_adjust_op adjust, int flags, bool *shape_changed) @@ -811,16 +811,16 @@ xfs_refcount_merge_extents( *shape_changed = false; /* - * Find the extent just below agbno [left], just above agbno [cleft], - * just below (agbno + aglen) [cright], and just above (agbno + aglen) + * Find the extent just below bno [left], just above bno [cleft], + * just below (bno + len) [cright], and just above (bno + len) * [right]. */ - error = xfs_refcount_find_left_extents(cur, &left, &cleft, *agbno, - *aglen, flags); + error = xfs_refcount_find_left_extents(cur, &left, &cleft, *bno, + *len, flags); if (error) return error; - error = xfs_refcount_find_right_extents(cur, &right, &cright, *agbno, - *aglen, flags); + error = xfs_refcount_find_right_extents(cur, &right, &cright, *bno, + *len, flags); if (error) return error; @@ -841,7 +841,7 @@ xfs_refcount_merge_extents( ulen < MAXREFCEXTLEN) { *shape_changed = true; return xfs_refcount_merge_center_extents(cur, &left, &cleft, - &right, ulen, aglen); + &right, ulen, len); } /* Try to merge left and cleft. */ @@ -851,7 +851,7 @@ xfs_refcount_merge_extents( ulen < MAXREFCEXTLEN) { *shape_changed = true; error = xfs_refcount_merge_left_extent(cur, &left, &cleft, - agbno, aglen); + bno, len); if (error) return error; @@ -870,7 +870,7 @@ xfs_refcount_merge_extents( ulen < MAXREFCEXTLEN) { *shape_changed = true; return xfs_refcount_merge_right_extent(cur, &right, &cright, - aglen); + len); } return error; @@ -917,14 +917,14 @@ xfs_refcount_still_have_space( /* * Adjust the refcounts of middle extents. At this point we should have * split extents that crossed the adjustment range; merged with adjacent - * extents; and updated agbno/aglen to reflect the merges. Therefore, - * all we have to do is update the extents inside [agbno, agbno + aglen]. + * extents; and updated bno/len to reflect the merges. Therefore, + * all we have to do is update the extents inside [bno, bno + len]. */ STATIC int xfs_refcount_adjust_extents( struct xfs_btree_cur *cur, - xfs_agblock_t *agbno, - xfs_extlen_t *aglen, + xfs_fsblock_t *bno, + xfs_filblks_t *len, enum xfs_refc_adjust_op adj) { struct xfs_refcount_irec ext, tmp; @@ -933,14 +933,14 @@ xfs_refcount_adjust_extents( xfs_fsblock_t fsbno; /* Merging did all the work already. */ - if (*aglen == 0) + if (*len == 0) return 0; - error = xfs_refcount_lookup_ge(cur, *agbno, &found_rec); + error = xfs_refcount_lookup_ge(cur, *bno, &found_rec); if (error) goto out_error; - while (*aglen > 0 && xfs_refcount_still_have_space(cur)) { + while (*len > 0 && xfs_refcount_still_have_space(cur)) { error = xfs_refcount_get_rec(cur, &ext, &found_rec); if (error) goto out_error; @@ -955,10 +955,10 @@ xfs_refcount_adjust_extents( * these blocks and there's no refcountbt record, pretend that * there is one with refcount == 1. */ - if (ext.rc_startblock != *agbno) { - tmp.rc_startblock = *agbno; - tmp.rc_blockcount = min(*aglen, - ext.rc_startblock - *agbno); + if (ext.rc_startblock != *bno) { + tmp.rc_startblock = *bno; + tmp.rc_blockcount = min(*len, + ext.rc_startblock - *bno); tmp.rc_refcount = 1 + adj; trace_xfs_refcount_modify_extent(cur, &tmp); @@ -986,17 +986,17 @@ xfs_refcount_adjust_extents( tmp.rc_blockcount, NULL, 0); } - (*agbno) += tmp.rc_blockcount; - (*aglen) -= tmp.rc_blockcount; + (*bno) += tmp.rc_blockcount; + (*len) -= tmp.rc_blockcount; - error = xfs_refcount_lookup_ge(cur, *agbno, + error = xfs_refcount_lookup_ge(cur, *bno, &found_rec); if (error) goto out_error; } /* Stop if there's nothing left to modify */ - if (*aglen == 0 || !xfs_refcount_still_have_space(cur)) + if (*len == 0 || !xfs_refcount_still_have_space(cur)) break; /* @@ -1036,8 +1036,8 @@ skip: goto out_error; advloop: - (*agbno) += ext.rc_blockcount; - (*aglen) -= ext.rc_blockcount; + (*bno) += ext.rc_blockcount; + (*len) -= ext.rc_blockcount; } return error; @@ -1050,33 +1050,33 @@ out_error: STATIC int xfs_refcount_adjust( struct xfs_btree_cur *cur, - xfs_agblock_t agbno, - xfs_extlen_t aglen, - xfs_agblock_t *new_agbno, - xfs_extlen_t *new_aglen, + xfs_fsblock_t bno, + xfs_filblks_t len, + xfs_fsblock_t *new_bno, + xfs_filblks_t *new_len, enum xfs_refc_adjust_op adj) { bool shape_changed; int shape_changes = 0; int error; - *new_agbno = agbno; - *new_aglen = aglen; + *new_bno = bno; + *new_len = len; if (adj == XFS_REFCOUNT_ADJUST_INCREASE) - trace_xfs_refcount_increase(cur, agbno, aglen); + trace_xfs_refcount_increase(cur, bno, len); else - trace_xfs_refcount_decrease(cur, agbno, aglen); + trace_xfs_refcount_decrease(cur, bno, len); /* * Ensure that no rcextents cross the boundary of the adjustment range. */ - error = xfs_refcount_split_extent(cur, agbno, &shape_changed); + error = xfs_refcount_split_extent(cur, bno, &shape_changed); if (error) goto out_error; if (shape_changed) shape_changes++; - error = xfs_refcount_split_extent(cur, agbno + aglen, &shape_changed); + error = xfs_refcount_split_extent(cur, bno + len, &shape_changed); if (error) goto out_error; if (shape_changed) @@ -1085,7 +1085,7 @@ xfs_refcount_adjust( /* * Try to merge with the left or right extents of the range. */ - error = xfs_refcount_merge_extents(cur, new_agbno, new_aglen, adj, + error = xfs_refcount_merge_extents(cur, new_bno, new_len, adj, XFS_FIND_RCEXT_SHARED, &shape_changed); if (error) goto out_error; @@ -1095,7 +1095,7 @@ xfs_refcount_adjust( 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, adj); + error = xfs_refcount_adjust_extents(cur, new_bno, new_len, adj); if (error) goto out_error; @@ -1139,13 +1139,13 @@ xfs_refcount_finish_one( struct xfs_mount *mp = tp->t_mountp; struct xfs_btree_cur *rcur; struct xfs_buf *agbp = NULL; - int error = 0; - xfs_agblock_t bno; - xfs_agblock_t new_agbno; - xfs_extlen_t new_len; + struct xfs_perag *pag; + xfs_fsblock_t bno; + xfs_fsblock_t new_bno; + xfs_filblks_t new_len; unsigned long nr_ops = 0; int shape_changes = 0; - struct xfs_perag *pag; + int error = 0; pag = xfs_perag_get(mp, XFS_FSB_TO_AGNO(mp, ri->ri_startblock)); bno = XFS_FSB_TO_AGBNO(mp, ri->ri_startblock); @@ -1184,18 +1184,18 @@ xfs_refcount_finish_one( switch (ri->ri_type) { case XFS_REFCOUNT_INCREASE: error = xfs_refcount_adjust(rcur, bno, ri->ri_blockcount, - &new_agbno, &new_len, + &new_bno, &new_len, XFS_REFCOUNT_ADJUST_INCREASE); ri->ri_startblock = XFS_AGB_TO_FSB(mp, pag->pag_agno, - new_agbno); + new_bno); ri->ri_blockcount = new_len; break; case XFS_REFCOUNT_DECREASE: error = xfs_refcount_adjust(rcur, bno, ri->ri_blockcount, - &new_agbno, &new_len, + &new_bno, &new_len, XFS_REFCOUNT_ADJUST_DECREASE); ri->ri_startblock = XFS_AGB_TO_FSB(mp, pag->pag_agno, - new_agbno); + new_bno); ri->ri_blockcount = new_len; break; case XFS_REFCOUNT_ALLOC_COW: @@ -1227,7 +1227,7 @@ __xfs_refcount_add( struct xfs_trans *tp, enum xfs_refcount_intent_type type, xfs_fsblock_t startblock, - xfs_extlen_t blockcount) + xfs_filblks_t blockcount) { struct xfs_refcount_intent *ri; @@ -1277,16 +1277,16 @@ xfs_refcount_decrease_extent( * within that range and return the range in fbno/flen. If * find_end_of_shared is set, return the longest contiguous extent of * shared blocks; if not, just return the first extent we find. If no - * shared blocks are found, fbno and flen will be set to NULLAGBLOCK + * shared blocks are found, fbno and flen will be set to NULLFSBLOCK * and 0, respectively. */ int xfs_refcount_find_shared( struct xfs_btree_cur *cur, - xfs_agblock_t agbno, - xfs_extlen_t aglen, - xfs_agblock_t *fbno, - xfs_extlen_t *flen, + xfs_fsblock_t bno, + xfs_filblks_t len, + xfs_fsblock_t *fbno, + xfs_filblks_t *flen, bool find_end_of_shared) { struct xfs_refcount_irec tmp; @@ -1294,14 +1294,14 @@ xfs_refcount_find_shared( int have; int error; - trace_xfs_refcount_find_shared(cur, agbno, aglen); + trace_xfs_refcount_find_shared(cur, bno, len); /* By default, skip the whole range */ - *fbno = NULLAGBLOCK; + *fbno = NULLFSBLOCK; *flen = 0; /* Try to find a refcount extent that crosses the start */ - error = xfs_refcount_lookup_le(cur, agbno, &have); + error = xfs_refcount_lookup_le(cur, bno, &have); if (error) goto out_error; if (!have) { @@ -1322,7 +1322,7 @@ xfs_refcount_find_shared( } /* If the extent ends before the start, look at the next one */ - if (tmp.rc_startblock + tmp.rc_blockcount <= agbno) { + if (tmp.rc_startblock + tmp.rc_blockcount <= bno) { error = xfs_btree_increment(cur, 0, &have); if (error) goto out_error; @@ -1339,22 +1339,22 @@ xfs_refcount_find_shared( } /* If the extent starts after the range we want, bail out */ - if (tmp.rc_startblock >= agbno + aglen) + if (tmp.rc_startblock >= bno + len) goto done; /* We found the start of a shared extent! */ - if (tmp.rc_startblock < agbno) { - tmp.rc_blockcount -= (agbno - tmp.rc_startblock); - tmp.rc_startblock = agbno; + if (tmp.rc_startblock < bno) { + tmp.rc_blockcount -= (bno - tmp.rc_startblock); + tmp.rc_startblock = bno; } *fbno = tmp.rc_startblock; - *flen = min(tmp.rc_blockcount, agbno + aglen - *fbno); + *flen = min(tmp.rc_blockcount, bno + len - *fbno); if (!find_end_of_shared) goto done; /* Otherwise, find the end of this shared extent */ - while (*fbno + *flen < agbno + aglen) { + while (*fbno + *flen < bno + len) { error = xfs_btree_increment(cur, 0, &have); if (error) goto out_error; @@ -1368,10 +1368,10 @@ xfs_refcount_find_shared( error = -EFSCORRUPTED; goto out_error; } - if (tmp.rc_startblock >= agbno + aglen || + if (tmp.rc_startblock >= bno + len || tmp.rc_startblock != *fbno + *flen) break; - *flen = min(*flen + tmp.rc_blockcount, agbno + aglen - *fbno); + *flen = min(*flen + tmp.rc_blockcount, bno + len - *fbno); } done: @@ -1438,19 +1438,19 @@ out_error: STATIC int xfs_refcount_adjust_cow_extents( struct xfs_btree_cur *cur, - xfs_agblock_t agbno, - xfs_extlen_t aglen, + xfs_fsblock_t bno, + xfs_filblks_t len, enum xfs_refc_adjust_op adj) { struct xfs_refcount_irec ext, tmp; int error; int found_rec, found_tmp; - if (aglen == 0) + if (len == 0) return 0; /* Find any overlapping refcount records */ - error = xfs_refcount_lookup_ge(cur, agbno, &found_rec); + error = xfs_refcount_lookup_ge(cur, bno, &found_rec); if (error) goto out_error; error = xfs_refcount_get_rec(cur, &ext, &found_rec); @@ -1467,14 +1467,14 @@ xfs_refcount_adjust_cow_extents( case XFS_REFCOUNT_ADJUST_COW_ALLOC: /* Adding a CoW reservation, there should be nothing here. */ if (XFS_IS_CORRUPT(cur->bc_mp, - agbno + aglen > ext.rc_startblock)) { + bno + len > ext.rc_startblock)) { xfs_btree_mark_sick(cur); error = -EFSCORRUPTED; goto out_error; } - tmp.rc_startblock = agbno; - tmp.rc_blockcount = aglen; + tmp.rc_startblock = bno; + tmp.rc_blockcount = len; tmp.rc_refcount = 1; trace_xfs_refcount_modify_extent(cur, &tmp); @@ -1490,12 +1490,12 @@ xfs_refcount_adjust_cow_extents( break; case XFS_REFCOUNT_ADJUST_COW_FREE: /* Removing a CoW reservation, there should be one extent. */ - if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_startblock != agbno)) { + if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_startblock != bno)) { xfs_btree_mark_sick(cur); error = -EFSCORRUPTED; goto out_error; } - if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount != aglen)) { + if (XFS_IS_CORRUPT(cur->bc_mp, ext.rc_blockcount != len)) { xfs_btree_mark_sick(cur); error = -EFSCORRUPTED; goto out_error; @@ -1533,36 +1533,36 @@ out_error: STATIC int xfs_refcount_adjust_cow( struct xfs_btree_cur *cur, - xfs_agblock_t agbno, - xfs_extlen_t aglen, + xfs_fsblock_t bno, + xfs_filblks_t len, enum xfs_refc_adjust_op adj) { bool shape_changed; int error; - agbno += XFS_REFC_COW_START; + bno += XFS_REFC_COW_START; /* * Ensure that no rcextents cross the boundary of the adjustment range. */ - error = xfs_refcount_split_extent(cur, agbno, &shape_changed); + error = xfs_refcount_split_extent(cur, bno, &shape_changed); if (error) goto out_error; - error = xfs_refcount_split_extent(cur, agbno + aglen, &shape_changed); + error = xfs_refcount_split_extent(cur, bno + len, &shape_changed); if (error) goto out_error; /* * Try to merge with the left or right extents of the range. */ - error = xfs_refcount_merge_extents(cur, &agbno, &aglen, adj, + error = xfs_refcount_merge_extents(cur, &bno, &len, adj, XFS_FIND_RCEXT_COW, &shape_changed); if (error) goto out_error; /* Now that we've taken care of the ends, adjust the middle extents */ - error = xfs_refcount_adjust_cow_extents(cur, agbno, aglen, adj); + error = xfs_refcount_adjust_cow_extents(cur, bno, len, adj); if (error) goto out_error; @@ -1579,13 +1579,13 @@ out_error: STATIC int __xfs_refcount_cow_alloc( struct xfs_btree_cur *rcur, - xfs_agblock_t agbno, - xfs_extlen_t aglen) + xfs_fsblock_t bno, + xfs_filblks_t len) { - trace_xfs_refcount_cow_increase(rcur, agbno, aglen); + trace_xfs_refcount_cow_increase(rcur, bno, len); /* Add refcount btree reservation */ - return xfs_refcount_adjust_cow(rcur, agbno, aglen, + return xfs_refcount_adjust_cow(rcur, bno, len, XFS_REFCOUNT_ADJUST_COW_ALLOC); } @@ -1595,13 +1595,13 @@ __xfs_refcount_cow_alloc( STATIC int __xfs_refcount_cow_free( struct xfs_btree_cur *rcur, - xfs_agblock_t agbno, - xfs_extlen_t aglen) + xfs_fsblock_t bno, + xfs_filblks_t len) { - trace_xfs_refcount_cow_decrease(rcur, agbno, aglen); + trace_xfs_refcount_cow_decrease(rcur, bno, len); /* Remove refcount btree reservation */ - return xfs_refcount_adjust_cow(rcur, agbno, aglen, + return xfs_refcount_adjust_cow(rcur, bno, len, XFS_REFCOUNT_ADJUST_COW_FREE); } @@ -1610,7 +1610,7 @@ void xfs_refcount_alloc_cow_extent( struct xfs_trans *tp, xfs_fsblock_t fsb, - xfs_extlen_t len) + xfs_filblks_t len) { struct xfs_mount *mp = tp->t_mountp; @@ -1628,7 +1628,7 @@ void xfs_refcount_free_cow_extent( struct xfs_trans *tp, xfs_fsblock_t fsb, - xfs_extlen_t len) + xfs_filblks_t len) { struct xfs_mount *mp = tp->t_mountp; @@ -1682,7 +1682,7 @@ xfs_refcount_recover_cow_leftovers( union xfs_btree_irec low; union xfs_btree_irec high; xfs_fsblock_t fsb; - xfs_agblock_t agbno; + xfs_fsblock_t bno; int error; if (mp->m_sb.sb_agblocks >= XFS_REFC_COW_START) @@ -1730,8 +1730,8 @@ xfs_refcount_recover_cow_leftovers( goto out_free; /* Free the orphan record */ - agbno = rr->rr_rrec.rc_startblock - XFS_REFC_COW_START; - fsb = XFS_AGB_TO_FSB(mp, pag->pag_agno, agbno); + bno = rr->rr_rrec.rc_startblock - XFS_REFC_COW_START; + fsb = XFS_AGB_TO_FSB(mp, pag->pag_agno, bno); xfs_refcount_free_cow_extent(tp, fsb, rr->rr_rrec.rc_blockcount); @@ -1765,7 +1765,7 @@ xfs_refcount_has_key_gap( const union xfs_btree_key *key1, const union xfs_btree_key *key2) { - xfs_agblock_t next; + xfs_fsblock_t next; next = be32_to_cpu(key1->refc.rc_startblock) + 1; return next != be32_to_cpu(key2->refc.rc_startblock); @@ -1775,8 +1775,8 @@ xfs_refcount_has_key_gap( int xfs_refcount_has_record( struct xfs_btree_cur *cur, - xfs_agblock_t bno, - xfs_extlen_t len, + xfs_fsblock_t bno, + xfs_filblks_t len, bool *exists) { union xfs_btree_irec low; diff --git a/fs/xfs/libxfs/xfs_refcount.h b/fs/xfs/libxfs/xfs_refcount.h index bd92e810c537..2d6aa6afe933 100644 --- a/fs/xfs/libxfs/xfs_refcount.h +++ b/fs/xfs/libxfs/xfs_refcount.h @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2.0+ +// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (C) 2016 Oracle. All Rights Reserved. * Author: Darrick J. Wong @@ -14,11 +14,11 @@ struct xfs_bmbt_irec; struct xfs_refcount_irec; extern int xfs_refcount_lookup_le(struct xfs_btree_cur *cur, - xfs_agblock_t bno, int *stat); + xfs_fsblock_t bno, int *stat); extern int xfs_refcount_lookup_ge(struct xfs_btree_cur *cur, - xfs_agblock_t bno, int *stat); + xfs_fsblock_t bno, int *stat); extern int xfs_refcount_lookup_eq(struct xfs_btree_cur *cur, - xfs_agblock_t bno, int *stat); + xfs_fsblock_t bno, int *stat); extern int xfs_refcount_get_rec(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec, int *stat); @@ -39,7 +39,7 @@ struct xfs_refcount_intent { struct list_head ri_list; enum xfs_refcount_intent_type ri_type; xfs_fsblock_t ri_startblock; - xfs_extlen_t ri_blockcount; + xfs_filblks_t ri_blockcount; }; void xfs_refcount_increase_extent(struct xfs_trans *tp, @@ -53,13 +53,13 @@ extern int xfs_refcount_finish_one(struct xfs_trans *tp, struct xfs_refcount_intent *refc, struct xfs_btree_cur **pcur); extern int xfs_refcount_find_shared(struct xfs_btree_cur *cur, - xfs_agblock_t agbno, xfs_extlen_t aglen, xfs_agblock_t *fbno, - xfs_extlen_t *flen, bool find_end_of_shared); + xfs_fsblock_t bno, xfs_filblks_t aglen, xfs_fsblock_t *fbno, + xfs_filblks_t *flen, bool find_end_of_shared); void xfs_refcount_alloc_cow_extent(struct xfs_trans *tp, xfs_fsblock_t fsb, - xfs_extlen_t len); + xfs_filblks_t len); void xfs_refcount_free_cow_extent(struct xfs_trans *tp, xfs_fsblock_t fsb, - xfs_extlen_t len); + xfs_filblks_t len); extern int xfs_refcount_recover_cow_leftovers(struct xfs_mount *mp, struct xfs_perag *pag); @@ -76,7 +76,7 @@ extern int xfs_refcount_recover_cow_leftovers(struct xfs_mount *mp, #define XFS_REFCOUNT_ITEM_OVERHEAD 32 extern int xfs_refcount_has_record(struct xfs_btree_cur *cur, - xfs_agblock_t bno, xfs_extlen_t len, bool *exists); + xfs_fsblock_t bno, xfs_filblks_t len, bool *exists); union xfs_btree_rec; extern void xfs_refcount_btrec_to_irec(const union xfs_btree_rec *rec, struct xfs_refcount_irec *irec); diff --git a/fs/xfs/scrub/rmap.c b/fs/xfs/scrub/rmap.c index 96880c0c95c5..7b72ba5a3900 100644 --- a/fs/xfs/scrub/rmap.c +++ b/fs/xfs/scrub/rmap.c @@ -39,8 +39,8 @@ xchk_rmapbt_xref_refc( struct xfs_scrub *sc, struct xfs_rmap_irec *irec) { - xfs_agblock_t fbno; - xfs_extlen_t flen; + xfs_fsblock_t fbno; + xfs_filblks_t flen; bool non_inode; bool is_bmbt; bool is_attr; diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c index f4c0c57f78b3..dbd296e885ed 100644 --- a/fs/xfs/xfs_fsmap.c +++ b/fs/xfs/xfs_fsmap.c @@ -198,8 +198,8 @@ xfs_getfsmap_is_shared( { struct xfs_mount *mp = tp->t_mountp; struct xfs_btree_cur *cur; - xfs_agblock_t fbno; - xfs_extlen_t flen; + xfs_fsblock_t fbno; + xfs_filblks_t flen; int error; *stat = false; diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index deba87f68baf..6bc13079d489 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -138,9 +138,9 @@ xfs_reflink_find_shared( struct xfs_buf *agbp; struct xfs_btree_cur *cur; xfs_agnumber_t agno; - xfs_agblock_t agbno; - xfs_agblock_t shared_bno; - xfs_extlen_t shared_len; + xfs_fsblock_t agbno; + xfs_fsblock_t shared_bno; + xfs_filblks_t shared_len; int error; agno = XFS_FSB_TO_AGNO(mp, irec->br_startblock); @@ -159,7 +159,7 @@ xfs_reflink_find_shared( xfs_trans_brelse(tp, agbp); - if (shared_bno == NULLAGBLOCK) + if (shared_bno == NULLFSBLOCK) *fbno = NULLFSBLOCK; else *fbno = XFS_AGB_TO_FSB(mp, agno, shared_bno); diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h index dad720c56f2b..75c03e9bafc0 100644 --- a/fs/xfs/xfs_trace.h +++ b/fs/xfs/xfs_trace.h @@ -21,6 +21,8 @@ * * rmapbno: physical block number for a reverse mapping. This is an agbno for * per-AG rmap btrees or a rtbno for realtime rmap btrees. + * refcbno: physical block number for a refcount record. This is an agbno for + * per-AG refcount btrees or a rtbno for realtime refcount btrees. * * daddr: physical block number in 512b blocks * bbcount: number of blocks in a physical extent, in 512b blocks @@ -3111,56 +3113,60 @@ DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error); /* refcount tracepoint classes */ DECLARE_EVENT_CLASS(xfs_refcount_class, - TP_PROTO(struct xfs_btree_cur *cur, xfs_agblock_t agbno, - xfs_extlen_t len), - TP_ARGS(cur, agbno, len), + TP_PROTO(struct xfs_btree_cur *cur, xfs_fsblock_t bno, + xfs_filblks_t len), + TP_ARGS(cur, bno, len), TP_STRUCT__entry( __field(dev_t, dev) + __field(dev_t, opdev) __field(xfs_agnumber_t, agno) - __field(xfs_agblock_t, agbno) - __field(xfs_extlen_t, len) + __field(xfs_fsblock_t, bno) + __field(xfs_filblks_t, len) ), TP_fast_assign( __entry->dev = cur->bc_mp->m_super->s_dev; - __entry->agno = cur->bc_ag.pag->pag_agno; - __entry->agbno = agbno; + xfs_btree_crack_agno_opdev(cur, &__entry->agno, &__entry->opdev); + __entry->bno = bno; __entry->len = len; ), - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x", + TP_printk("dev %d:%d opdev %d:%d agno 0x%x refcbno 0x%llx fsbcount 0x%llx", MAJOR(__entry->dev), MINOR(__entry->dev), + MAJOR(__entry->opdev), MINOR(__entry->opdev), __entry->agno, - __entry->agbno, + __entry->bno, __entry->len) ); #define DEFINE_REFCOUNT_EVENT(name) \ DEFINE_EVENT(xfs_refcount_class, name, \ - TP_PROTO(struct xfs_btree_cur *cur, xfs_agblock_t agbno, \ - xfs_extlen_t len), \ - TP_ARGS(cur, agbno, len)) + TP_PROTO(struct xfs_btree_cur *cur, xfs_fsblock_t bno, \ + xfs_filblks_t len), \ + TP_ARGS(cur, bno, len)) TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi); TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi); TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi); TRACE_EVENT(xfs_refcount_lookup, - TP_PROTO(struct xfs_btree_cur *cur, xfs_agblock_t agbno, + TP_PROTO(struct xfs_btree_cur *cur, xfs_fsblock_t bno, xfs_lookup_t dir), - TP_ARGS(cur, agbno, dir), + TP_ARGS(cur, bno, dir), TP_STRUCT__entry( __field(dev_t, dev) + __field(dev_t, opdev) __field(xfs_agnumber_t, agno) - __field(xfs_agblock_t, agbno) + __field(xfs_fsblock_t, bno) __field(xfs_lookup_t, dir) ), TP_fast_assign( __entry->dev = cur->bc_mp->m_super->s_dev; - __entry->agno = cur->bc_ag.pag->pag_agno; - __entry->agbno = agbno; + xfs_btree_crack_agno_opdev(cur, &__entry->agno, &__entry->opdev); + __entry->bno = bno; __entry->dir = dir; ), - TP_printk("dev %d:%d agno 0x%x agbno 0x%x cmp %s(%d)", + TP_printk("dev %d:%d opdev %d:%d agno 0x%x refcbno 0x%llx cmp %s(%d)", MAJOR(__entry->dev), MINOR(__entry->dev), + MAJOR(__entry->opdev), MINOR(__entry->opdev), __entry->agno, - __entry->agbno, + __entry->bno, __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR), __entry->dir) ) @@ -3171,20 +3177,22 @@ DECLARE_EVENT_CLASS(xfs_refcount_extent_class, TP_ARGS(cur, irec), TP_STRUCT__entry( __field(dev_t, dev) + __field(dev_t, opdev) __field(xfs_agnumber_t, agno) - __field(xfs_agblock_t, startblock) - __field(xfs_extlen_t, blockcount) + __field(xfs_fsblock_t, startblock) + __field(xfs_filblks_t, blockcount) __field(xfs_nlink_t, refcount) ), TP_fast_assign( __entry->dev = cur->bc_mp->m_super->s_dev; - __entry->agno = cur->bc_ag.pag->pag_agno; + xfs_btree_crack_agno_opdev(cur, &__entry->agno, &__entry->opdev); __entry->startblock = irec->rc_startblock; __entry->blockcount = irec->rc_blockcount; __entry->refcount = irec->rc_refcount; ), - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u", + TP_printk("dev %d:%d opdev %d:%d agno 0x%x refcbno 0x%llx fsbcount 0x%llx refcount %u", MAJOR(__entry->dev), MINOR(__entry->dev), + MAJOR(__entry->opdev), MINOR(__entry->opdev), __entry->agno, __entry->startblock, __entry->blockcount, @@ -3199,57 +3207,60 @@ DEFINE_EVENT(xfs_refcount_extent_class, name, \ /* single-rcext and an agbno tracepoint class */ DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class, TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec, - xfs_agblock_t agbno), - TP_ARGS(cur, irec, agbno), + xfs_fsblock_t bno), + TP_ARGS(cur, irec, bno), TP_STRUCT__entry( __field(dev_t, dev) + __field(dev_t, opdev) __field(xfs_agnumber_t, agno) - __field(xfs_agblock_t, startblock) - __field(xfs_extlen_t, blockcount) + __field(xfs_fsblock_t, startblock) + __field(xfs_filblks_t, blockcount) __field(xfs_nlink_t, refcount) - __field(xfs_agblock_t, agbno) + __field(xfs_fsblock_t, bno) ), TP_fast_assign( __entry->dev = cur->bc_mp->m_super->s_dev; - __entry->agno = cur->bc_ag.pag->pag_agno; + xfs_btree_crack_agno_opdev(cur, &__entry->agno, &__entry->opdev); __entry->startblock = irec->rc_startblock; __entry->blockcount = irec->rc_blockcount; __entry->refcount = irec->rc_refcount; - __entry->agbno = agbno; + __entry->bno = bno; ), - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x", + TP_printk("dev %d:%d opdev %d:%d agno 0x%x refcbno 0x%llx fsbcount 0x%llx refcount %u @ refcbno 0x%llx", MAJOR(__entry->dev), MINOR(__entry->dev), + MAJOR(__entry->opdev), MINOR(__entry->opdev), __entry->agno, __entry->startblock, __entry->blockcount, __entry->refcount, - __entry->agbno) + __entry->bno) ) #define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \ DEFINE_EVENT(xfs_refcount_extent_at_class, name, \ TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *irec, \ - xfs_agblock_t agbno), \ - TP_ARGS(cur, irec, agbno)) + xfs_fsblock_t bno), \ + TP_ARGS(cur, irec, bno)) /* double-rcext tracepoint class */ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class, TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, - struct xfs_refcount_irec *i2), + struct xfs_refcount_irec *i2), TP_ARGS(cur, i1, i2), TP_STRUCT__entry( __field(dev_t, dev) + __field(dev_t, opdev) __field(xfs_agnumber_t, agno) - __field(xfs_agblock_t, i1_startblock) - __field(xfs_extlen_t, i1_blockcount) + __field(xfs_fsblock_t, i1_startblock) + __field(xfs_filblks_t, i1_blockcount) __field(xfs_nlink_t, i1_refcount) - __field(xfs_agblock_t, i2_startblock) - __field(xfs_extlen_t, i2_blockcount) + __field(xfs_fsblock_t, i2_startblock) + __field(xfs_filblks_t, i2_blockcount) __field(xfs_nlink_t, i2_refcount) ), TP_fast_assign( __entry->dev = cur->bc_mp->m_super->s_dev; - __entry->agno = cur->bc_ag.pag->pag_agno; + xfs_btree_crack_agno_opdev(cur, &__entry->agno, &__entry->opdev); __entry->i1_startblock = i1->rc_startblock; __entry->i1_blockcount = i1->rc_blockcount; __entry->i1_refcount = i1->rc_refcount; @@ -3257,9 +3268,10 @@ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class, __entry->i2_blockcount = i2->rc_blockcount; __entry->i2_refcount = i2->rc_refcount; ), - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- " - "agbno 0x%x fsbcount 0x%x refcount %u", + TP_printk("dev %d:%d opdev %d:%d agno 0x%x refcbno 0x%llx fsbcount 0x%llx refcount %u -- " + "refcbno 0x%llx fsbcount 0x%llx refcount %u", MAJOR(__entry->dev), MINOR(__entry->dev), + MAJOR(__entry->opdev), MINOR(__entry->opdev), __entry->agno, __entry->i1_startblock, __entry->i1_blockcount, @@ -3278,33 +3290,35 @@ DEFINE_EVENT(xfs_refcount_double_extent_class, name, \ /* double-rcext and an agbno tracepoint class */ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class, TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, - struct xfs_refcount_irec *i2, xfs_agblock_t agbno), - TP_ARGS(cur, i1, i2, agbno), + struct xfs_refcount_irec *i2, xfs_fsblock_t bno), + TP_ARGS(cur, i1, i2, bno), TP_STRUCT__entry( __field(dev_t, dev) + __field(dev_t, opdev) __field(xfs_agnumber_t, agno) - __field(xfs_agblock_t, i1_startblock) - __field(xfs_extlen_t, i1_blockcount) + __field(xfs_fsblock_t, i1_startblock) + __field(xfs_filblks_t, i1_blockcount) __field(xfs_nlink_t, i1_refcount) - __field(xfs_agblock_t, i2_startblock) - __field(xfs_extlen_t, i2_blockcount) + __field(xfs_fsblock_t, i2_startblock) + __field(xfs_filblks_t, i2_blockcount) __field(xfs_nlink_t, i2_refcount) - __field(xfs_agblock_t, agbno) + __field(xfs_fsblock_t, bno) ), TP_fast_assign( __entry->dev = cur->bc_mp->m_super->s_dev; - __entry->agno = cur->bc_ag.pag->pag_agno; + xfs_btree_crack_agno_opdev(cur, &__entry->agno, &__entry->opdev); __entry->i1_startblock = i1->rc_startblock; __entry->i1_blockcount = i1->rc_blockcount; __entry->i1_refcount = i1->rc_refcount; __entry->i2_startblock = i2->rc_startblock; __entry->i2_blockcount = i2->rc_blockcount; __entry->i2_refcount = i2->rc_refcount; - __entry->agbno = agbno; + __entry->bno = bno; ), - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- " - "agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x", + TP_printk("dev %d:%d opdev %d:%d agno 0x%x refcbno 0x%llx fsbcount 0x%llx refcount %u -- " + "refcbno 0x%llx fsbcount 0x%llx refcount %u @ refcbno 0x%llx", MAJOR(__entry->dev), MINOR(__entry->dev), + MAJOR(__entry->opdev), MINOR(__entry->opdev), __entry->agno, __entry->i1_startblock, __entry->i1_blockcount, @@ -3312,14 +3326,14 @@ DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class, __entry->i2_startblock, __entry->i2_blockcount, __entry->i2_refcount, - __entry->agbno) + __entry->bno) ) #define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \ DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \ TP_PROTO(struct xfs_btree_cur *cur, struct xfs_refcount_irec *i1, \ - struct xfs_refcount_irec *i2, xfs_agblock_t agbno), \ - TP_ARGS(cur, i1, i2, agbno)) + struct xfs_refcount_irec *i2, xfs_fsblock_t bno), \ + TP_ARGS(cur, i1, i2, bno)) /* triple-rcext tracepoint class */ DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class, @@ -3328,20 +3342,21 @@ DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class, TP_ARGS(cur, i1, i2, i3), TP_STRUCT__entry( __field(dev_t, dev) + __field(dev_t, opdev) __field(xfs_agnumber_t, agno) - __field(xfs_agblock_t, i1_startblock) - __field(xfs_extlen_t, i1_blockcount) + __field(xfs_fsblock_t, i1_startblock) + __field(xfs_filblks_t, i1_blockcount) __field(xfs_nlink_t, i1_refcount) - __field(xfs_agblock_t, i2_startblock) - __field(xfs_extlen_t, i2_blockcount) + __field(xfs_fsblock_t, i2_startblock) + __field(xfs_filblks_t, i2_blockcount) __field(xfs_nlink_t, i2_refcount) - __field(xfs_agblock_t, i3_startblock) - __field(xfs_extlen_t, i3_blockcount) + __field(xfs_fsblock_t, i3_startblock) + __field(xfs_filblks_t, i3_blockcount) __field(xfs_nlink_t, i3_refcount) ), TP_fast_assign( __entry->dev = cur->bc_mp->m_super->s_dev; - __entry->agno = cur->bc_ag.pag->pag_agno; + xfs_btree_crack_agno_opdev(cur, &__entry->agno, &__entry->opdev); __entry->i1_startblock = i1->rc_startblock; __entry->i1_blockcount = i1->rc_blockcount; __entry->i1_refcount = i1->rc_refcount; @@ -3352,10 +3367,11 @@ DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class, __entry->i3_blockcount = i3->rc_blockcount; __entry->i3_refcount = i3->rc_refcount; ), - TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- " - "agbno 0x%x fsbcount 0x%x refcount %u -- " - "agbno 0x%x fsbcount 0x%x refcount %u", + TP_printk("dev %d:%d opdev %d:%d agno 0x%x refcbno 0x%llx fsbcount 0x%llx refcount %u -- " + "refcbno 0x%llx fsbcount 0x%llx refcount %u -- " + "refcbno 0x%llx fsbcount 0x%llx refcount %u", MAJOR(__entry->dev), MINOR(__entry->dev), + MAJOR(__entry->opdev), MINOR(__entry->opdev), __entry->agno, __entry->i1_startblock, __entry->i1_blockcount, @@ -3422,21 +3438,21 @@ DECLARE_EVENT_CLASS(xfs_refcount_deferred_class, __field(dev_t, dev) __field(xfs_agnumber_t, agno) __field(int, op) - __field(xfs_agblock_t, agbno) - __field(xfs_extlen_t, len) + __field(xfs_fsblock_t, bno) + __field(xfs_filblks_t, len) ), TP_fast_assign( __entry->dev = mp->m_super->s_dev; __entry->agno = XFS_FSB_TO_AGNO(mp, refc->ri_startblock); __entry->op = refc->ri_type; - __entry->agbno = XFS_FSB_TO_AGBNO(mp, refc->ri_startblock); + __entry->bno = XFS_FSB_TO_AGBNO(mp, refc->ri_startblock); __entry->len = refc->ri_blockcount; ), - TP_printk("dev %d:%d op %s agno 0x%x agbno 0x%x fsbcount 0x%x", + TP_printk("dev %d:%d op %s agno 0x%x refcbno 0x%llx fsbcount 0x%llx", MAJOR(__entry->dev), MINOR(__entry->dev), __print_symbolic(__entry->op, XFS_REFCOUNT_INTENT_STRINGS), __entry->agno, - __entry->agbno, + __entry->bno, __entry->len) ); #define DEFINE_REFCOUNT_DEFERRED_EVENT(name) \ -- cgit v1.2.3