Skip to content
Permalink
Browse files

Fix dsl_scan, bulk_finish issues

Signed-off-by: Paul Dagnelie <pcd@delphix.com>
  • Loading branch information...
pcd1193182 committed Sep 23, 2019
1 parent f5fdfda commit b2f3759454a46d95d202906ed8decb3ac115ddd1
Showing with 16 additions and 11 deletions.
  1. +9 −7 module/zfs/btree.c
  2. +7 −4 module/zfs/dsl_scan.c
@@ -918,15 +918,15 @@ zfs_btree_bulk_finish(zfs_btree_t *tree)
uint64_t parent_idx = zfs_btree_find_parent_idx(tree, hdr);
ASSERT3U(parent_idx, >, 0);
zfs_btree_core_t *l_neighbor =
(zfs_btree_core_t *)parent->btc_children[ parent_idx - 1];
(zfs_btree_core_t *)parent->btc_children[parent_idx - 1];
uint64_t move_count = (capacity / 2) - hdr->bth_count;
ASSERT3U(l_neighbor->btc_hdr.bth_count - move_count, >=,
capacity / 2);

if (zfs_btree_verify_intensity >= 5) {
for (int i = 0; i < move_count; i++) {
zfs_btree_verify_poison_at(tree, hdr,
leaf->btl_hdr.bth_count + i);
hdr->bth_count + i);
}
}
/* First, shift things in the right node back. */
@@ -1503,11 +1503,7 @@ zfs_btree_remove_from_node(zfs_btree_t *tree, zfs_btree_core_t *node,
bt_transfer_core(tree, rm, 0, new_rm_hdr->bth_count, keep,
keep_hdr->bth_count, BSS_TRAPEZOID);

/* Reparent all our children to point to the left node. */
zfs_btree_hdr_t **new_start = keep->btc_children +
keep_hdr->bth_count;
for (int i = 0; i < new_rm_hdr->bth_count + 1; i++)
new_start[i]->bth_parent = keep;
uint64_t old_count = keep_hdr->bth_count;

/* Update bookkeeping */
keep_hdr->bth_count += new_rm_hdr->bth_count;
@@ -1521,6 +1517,12 @@ zfs_btree_remove_from_node(zfs_btree_t *tree, zfs_btree_core_t *node,
bt_shift_core_left(tree, keep, new_idx, keep_hdr->bth_count - new_idx,
BSS_PARALLELOGRAM);
keep_hdr->bth_count--;

/* Reparent all our children to point to the left node. */
zfs_btree_hdr_t **new_start = keep->btc_children +
old_count - 1;
for (int i = 0; i < new_rm_hdr->bth_count + 1; i++)
new_start[i]->bth_parent = keep;
for (int i = 0; i <= keep_hdr->bth_count; i++) {
ASSERT3P(keep->btc_children[i]->bth_parent, ==, keep);
ASSERT3P(keep->btc_children[i], !=, rm_hdr);
@@ -2927,8 +2927,10 @@ scan_io_queue_fetch_ext(dsl_scan_io_queue_t *queue)
} else if (zfs_scan_issue_strategy == 2) {
range_seg_t *size_rs =
zfs_btree_first(&queue->q_exts_by_size, NULL);
range_seg_t *addr_rs = range_tree_find(rt,
rs_get_start(rt, size_rs), rs_get_end(rt, size_rs));
uint64_t start = rs_get_start(size_rs, rt);
uint64_t size = rs_get_end(size_rs, rt) - start;
range_seg_t *addr_rs = range_tree_find(rt, start,
size);
ASSERT3P(addr_rs, !=, NULL);
return (addr_rs);
}
@@ -2948,8 +2950,9 @@ scan_io_queue_fetch_ext(dsl_scan_io_queue_t *queue)
} else if (scn->scn_clearing) {
range_seg_t *size_rs = zfs_btree_first(&queue->q_exts_by_size,
NULL);
range_seg_t *addr_rs = range_tree_find(rt,
rs_get_start(rt, size_rs), rs_get_end(rt, size_rs));
uint64_t start = rs_get_start(size_rs, rt);
uint64_t size = rs_get_end(size_rs, rt) - start;
range_seg_t *addr_rs = range_tree_find(rt, start, size);
ASSERT3P(addr_rs, !=, NULL);
return (addr_rs);
} else {

0 comments on commit b2f3759

Please sign in to comment.
You can’t perform that action at this time.