zdb.c (317856) | zdb.c (321529) |
---|---|
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 --- 2571 unchanged lines hidden (view full) --- 2580 2581static void 2582zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) 2583{ 2584 zcb->zcb_spa = spa; 2585 2586 if (!dump_opt['L']) { 2587 vdev_t *rvd = spa->spa_root_vdev; | 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 --- 2571 unchanged lines hidden (view full) --- 2580 2581static void 2582zdb_leak_init(spa_t *spa, zdb_cb_t *zcb) 2583{ 2584 zcb->zcb_spa = spa; 2585 2586 if (!dump_opt['L']) { 2587 vdev_t *rvd = spa->spa_root_vdev; |
2588 2589 /* 2590 * We are going to be changing the meaning of the metaslab's 2591 * ms_tree. Ensure that the allocator doesn't try to 2592 * use the tree. 2593 */ 2594 spa->spa_normal_class->mc_ops = &zdb_metaslab_ops; 2595 spa->spa_log_class->mc_ops = &zdb_metaslab_ops; 2596 |
|
2588 for (uint64_t c = 0; c < rvd->vdev_children; c++) { 2589 vdev_t *vd = rvd->vdev_child[c]; | 2597 for (uint64_t c = 0; c < rvd->vdev_children; c++) { 2598 vdev_t *vd = rvd->vdev_child[c]; |
2599 metaslab_group_t *mg = vd->vdev_mg; |
|
2590 for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { 2591 metaslab_t *msp = vd->vdev_ms[m]; | 2600 for (uint64_t m = 0; m < vd->vdev_ms_count; m++) { 2601 metaslab_t *msp = vd->vdev_ms[m]; |
2602 ASSERT3P(msp->ms_group, ==, mg); |
|
2592 mutex_enter(&msp->ms_lock); 2593 metaslab_unload(msp); 2594 2595 /* 2596 * For leak detection, we overload the metaslab 2597 * ms_tree to contain allocated segments 2598 * instead of free segments. As a result, 2599 * we can't use the normal metaslab_load/unload --- 4 unchanged lines hidden (view full) --- 2604 "\rloading space map for " 2605 "vdev %llu of %llu, " 2606 "metaslab %llu of %llu ...", 2607 (longlong_t)c, 2608 (longlong_t)rvd->vdev_children, 2609 (longlong_t)m, 2610 (longlong_t)vd->vdev_ms_count); 2611 | 2603 mutex_enter(&msp->ms_lock); 2604 metaslab_unload(msp); 2605 2606 /* 2607 * For leak detection, we overload the metaslab 2608 * ms_tree to contain allocated segments 2609 * instead of free segments. As a result, 2610 * we can't use the normal metaslab_load/unload --- 4 unchanged lines hidden (view full) --- 2615 "\rloading space map for " 2616 "vdev %llu of %llu, " 2617 "metaslab %llu of %llu ...", 2618 (longlong_t)c, 2619 (longlong_t)rvd->vdev_children, 2620 (longlong_t)m, 2621 (longlong_t)vd->vdev_ms_count); 2622 |
2612 msp->ms_ops = &zdb_metaslab_ops; 2613 | |
2614 /* 2615 * We don't want to spend the CPU 2616 * manipulating the size-ordered 2617 * tree, so clear the range_tree 2618 * ops. 2619 */ 2620 msp->ms_tree->rt_ops = NULL; 2621 VERIFY0(space_map_load(msp->ms_sm, 2622 msp->ms_tree, SM_ALLOC)); | 2623 /* 2624 * We don't want to spend the CPU 2625 * manipulating the size-ordered 2626 * tree, so clear the range_tree 2627 * ops. 2628 */ 2629 msp->ms_tree->rt_ops = NULL; 2630 VERIFY0(space_map_load(msp->ms_sm, 2631 msp->ms_tree, SM_ALLOC)); |
2623 msp->ms_loaded = B_TRUE; | 2632 2633 if (!msp->ms_loaded) { 2634 msp->ms_loaded = B_TRUE; 2635 } |
2624 } 2625 mutex_exit(&msp->ms_lock); 2626 } 2627 } 2628 (void) fprintf(stderr, "\n"); 2629 } 2630 2631 spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); --- 5 unchanged lines hidden (view full) --- 2637 2638static void 2639zdb_leak_fini(spa_t *spa) 2640{ 2641 if (!dump_opt['L']) { 2642 vdev_t *rvd = spa->spa_root_vdev; 2643 for (int c = 0; c < rvd->vdev_children; c++) { 2644 vdev_t *vd = rvd->vdev_child[c]; | 2636 } 2637 mutex_exit(&msp->ms_lock); 2638 } 2639 } 2640 (void) fprintf(stderr, "\n"); 2641 } 2642 2643 spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); --- 5 unchanged lines hidden (view full) --- 2649 2650static void 2651zdb_leak_fini(spa_t *spa) 2652{ 2653 if (!dump_opt['L']) { 2654 vdev_t *rvd = spa->spa_root_vdev; 2655 for (int c = 0; c < rvd->vdev_children; c++) { 2656 vdev_t *vd = rvd->vdev_child[c]; |
2657 metaslab_group_t *mg = vd->vdev_mg; |
|
2645 for (int m = 0; m < vd->vdev_ms_count; m++) { 2646 metaslab_t *msp = vd->vdev_ms[m]; | 2658 for (int m = 0; m < vd->vdev_ms_count; m++) { 2659 metaslab_t *msp = vd->vdev_ms[m]; |
2660 ASSERT3P(mg, ==, msp->ms_group); |
|
2647 mutex_enter(&msp->ms_lock); 2648 2649 /* 2650 * The ms_tree has been overloaded to 2651 * contain allocated segments. Now that we 2652 * finished traversing all blocks, any 2653 * block that remains in the ms_tree 2654 * represents an allocated block that we 2655 * did not claim during the traversal. 2656 * Claimed blocks would have been removed 2657 * from the ms_tree. 2658 */ 2659 range_tree_vacate(msp->ms_tree, zdb_leak, vd); | 2661 mutex_enter(&msp->ms_lock); 2662 2663 /* 2664 * The ms_tree has been overloaded to 2665 * contain allocated segments. Now that we 2666 * finished traversing all blocks, any 2667 * block that remains in the ms_tree 2668 * represents an allocated block that we 2669 * did not claim during the traversal. 2670 * Claimed blocks would have been removed 2671 * from the ms_tree. 2672 */ 2673 range_tree_vacate(msp->ms_tree, zdb_leak, vd); |
2660 msp->ms_loaded = B_FALSE; | |
2661 | 2674 |
2675 if (msp->ms_loaded) { 2676 msp->ms_loaded = B_FALSE; 2677 } 2678 |
|
2662 mutex_exit(&msp->ms_lock); 2663 } 2664 } 2665 } 2666} 2667 2668/* ARGSUSED */ 2669static int --- 1178 unchanged lines hidden --- | 2679 mutex_exit(&msp->ms_lock); 2680 } 2681 } 2682 } 2683} 2684 2685/* ARGSUSED */ 2686static int --- 1178 unchanged lines hidden --- |