Deleted Added
full compact
zdb.c (339104) zdb.c (339106)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 3019 unchanged lines hidden (view full) ---

3028zdb_claim_removing(spa_t *spa, zdb_cb_t *zcb)
3029{
3030 if (spa->spa_vdev_removal == NULL)
3031 return;
3032
3033 spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
3034
3035 spa_vdev_removal_t *svr = spa->spa_vdev_removal;
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 3019 unchanged lines hidden (view full) ---

3028zdb_claim_removing(spa_t *spa, zdb_cb_t *zcb)
3029{
3030 if (spa->spa_vdev_removal == NULL)
3031 return;
3032
3033 spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
3034
3035 spa_vdev_removal_t *svr = spa->spa_vdev_removal;
3036 vdev_t *vd = svr->svr_vdev;
3036 vdev_t *vd = vdev_lookup_top(spa, svr->svr_vdev_id);
3037 vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping;
3038
3039 for (uint64_t msi = 0; msi < vd->vdev_ms_count; msi++) {
3040 metaslab_t *msp = vd->vdev_ms[msi];
3041
3042 if (msp->ms_start >= vdev_indirect_mapping_max_offset(vim))
3043 break;
3044
3045 ASSERT0(range_tree_space(svr->svr_allocd_segs));
3046
3047 if (msp->ms_sm != NULL) {
3048 VERIFY0(space_map_load(msp->ms_sm,
3049 svr->svr_allocd_segs, SM_ALLOC));
3050
3051 /*
3037 vdev_indirect_mapping_t *vim = vd->vdev_indirect_mapping;
3038
3039 for (uint64_t msi = 0; msi < vd->vdev_ms_count; msi++) {
3040 metaslab_t *msp = vd->vdev_ms[msi];
3041
3042 if (msp->ms_start >= vdev_indirect_mapping_max_offset(vim))
3043 break;
3044
3045 ASSERT0(range_tree_space(svr->svr_allocd_segs));
3046
3047 if (msp->ms_sm != NULL) {
3048 VERIFY0(space_map_load(msp->ms_sm,
3049 svr->svr_allocd_segs, SM_ALLOC));
3050
3051 /*
3052 * Clear everything past what has been synced,
3053 * because we have not allocated mappings for it yet.
3052 * Clear everything past what has been synced unless
3053 * it's past the spacemap, because we have not allocated
3054 * mappings for it yet.
3054 */
3055 */
3055 range_tree_clear(svr->svr_allocd_segs,
3056 vdev_indirect_mapping_max_offset(vim),
3057 msp->ms_sm->sm_start + msp->ms_sm->sm_size -
3058 vdev_indirect_mapping_max_offset(vim));
3056 uint64_t vim_max_offset =
3057 vdev_indirect_mapping_max_offset(vim);
3058 uint64_t sm_end = msp->ms_sm->sm_start +
3059 msp->ms_sm->sm_size;
3060 if (sm_end > vim_max_offset)
3061 range_tree_clear(svr->svr_allocd_segs,
3062 vim_max_offset, sm_end - vim_max_offset);
3059 }
3060
3061 zcb->zcb_removing_size +=
3062 range_tree_space(svr->svr_allocd_segs);
3063 range_tree_vacate(svr->svr_allocd_segs, claim_segment_cb, vd);
3064 }
3065
3066 spa_config_exit(spa, SCL_CONFIG, FTAG);

--- 2339 unchanged lines hidden ---
3063 }
3064
3065 zcb->zcb_removing_size +=
3066 range_tree_space(svr->svr_allocd_segs);
3067 range_tree_vacate(svr->svr_allocd_segs, claim_segment_cb, vd);
3068 }
3069
3070 spa_config_exit(spa, SCL_CONFIG, FTAG);

--- 2339 unchanged lines hidden ---