/* * Find the next block where the refcount changes, given the next rmap we * looked at and the ones we're already tracking.
*/ int
rcbag_next_edge( struct rcbag *bag, struct xfs_trans *tp, conststruct xfs_rmap_irec *next_rmap, bool next_valid,
uint32_t *next_bnop)
{ struct rcbag_rec bagrec; struct xfs_mount *mp = bag->mp; struct xfs_btree_cur *cur;
uint32_t next_bno = NULLAGBLOCK; int has; int error;
if (next_valid)
next_bno = next_rmap->rm_startblock;
cur = rcbagbt_mem_cursor(mp, tp, &bag->xfbtree);
error = xfs_btree_goto_left_edge(cur); if (error) goto out_cur;
while (true) {
error = xfs_btree_increment(cur, 0, &has); if (error) goto out_cur; if (!has) break;
error = rcbagbt_get_rec(cur, &bagrec, &has); if (error) goto out_cur; if (!has) {
error = -EFSCORRUPTED; goto out_cur;
}
/* * We should have found /something/ because either next_rrm is the next * interesting rmap to look at after emitting this refcount extent, or * there are other rmaps in rmap_bag contributing to the current * sharing count. But if something is seriously wrong, bail out.
*/ if (next_bno == NULLAGBLOCK) {
error = -EFSCORRUPTED; goto out_cur;
}
/* Pop all refcount bag records that end at next_bno */ int
rcbag_remove_ending_at( struct rcbag *bag, struct xfs_trans *tp,
uint32_t next_bno)
{ struct rcbag_rec bagrec; struct xfs_mount *mp = bag->mp; struct xfs_btree_cur *cur; int has; int error;
/* go to the right edge of the tree */
cur = rcbagbt_mem_cursor(mp, tp, &bag->xfbtree);
memset(&cur->bc_rec, 0xFF, sizeof(cur->bc_rec));
error = xfs_btree_lookup(cur, XFS_LOOKUP_GE, &has); if (error) goto out_cur;
while (true) {
error = xfs_btree_decrement(cur, 0, &has); if (error) goto out_cur; if (!has) break;
error = rcbagbt_get_rec(cur, &bagrec, &has); if (error) goto out_cur; if (!has) {
error = -EFSCORRUPTED; goto out_cur;
}
if (rcbag_rec_next_bno(&bagrec) != next_bno) continue;
error = xfs_btree_delete(cur, &has); if (error) goto out_cur; if (!has) {
error = -EFSCORRUPTED; goto out_cur;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.