vdev_removal.c (339106) | vdev_removal.c (339111) |
---|---|
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 --- 30 unchanged lines hidden (view full) --- 39#include <sys/dsl_pool.h> 40#include <sys/dsl_synctask.h> 41#include <sys/dsl_dir.h> 42#include <sys/arc.h> 43#include <sys/zfeature.h> 44#include <sys/vdev_indirect_births.h> 45#include <sys/vdev_indirect_mapping.h> 46#include <sys/abd.h> | 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 --- 30 unchanged lines hidden (view full) --- 39#include <sys/dsl_pool.h> 40#include <sys/dsl_synctask.h> 41#include <sys/dsl_dir.h> 42#include <sys/arc.h> 43#include <sys/zfeature.h> 44#include <sys/vdev_indirect_births.h> 45#include <sys/vdev_indirect_mapping.h> 46#include <sys/abd.h> |
47#include <sys/vdev_initialize.h> |
|
47 48/* 49 * This file contains the necessary logic to remove vdevs from a 50 * storage pool. Currently, the only devices that can be removed 51 * are log, cache, and spare devices; and top level vdevs from a pool 52 * w/o raidz. (Note that members of a mirror can also be removed 53 * by the detach operation.) 54 * --- 962 unchanged lines hidden (view full) --- 1017 1018 /* 1019 * Wait for any deferred frees to be synced before we call 1020 * vdev_metaslab_fini() 1021 */ 1022 txg_wait_synced(spa->spa_dsl_pool, 0); 1023 txg = spa_vdev_enter(spa); 1024 vdev_t *vd = vdev_lookup_top(spa, spa->spa_vdev_removal->svr_vdev_id); | 48 49/* 50 * This file contains the necessary logic to remove vdevs from a 51 * storage pool. Currently, the only devices that can be removed 52 * are log, cache, and spare devices; and top level vdevs from a pool 53 * w/o raidz. (Note that members of a mirror can also be removed 54 * by the detach operation.) 55 * --- 962 unchanged lines hidden (view full) --- 1018 1019 /* 1020 * Wait for any deferred frees to be synced before we call 1021 * vdev_metaslab_fini() 1022 */ 1023 txg_wait_synced(spa->spa_dsl_pool, 0); 1024 txg = spa_vdev_enter(spa); 1025 vdev_t *vd = vdev_lookup_top(spa, spa->spa_vdev_removal->svr_vdev_id); |
1026 ASSERT3P(vd->vdev_initialize_thread, ==, NULL); |
|
1025 1026 sysevent_t *ev = spa_event_create(spa, vd, NULL, 1027 ESC_ZFS_VDEV_REMOVE_DEV); 1028 1029 zfs_dbgmsg("finishing device removal for vdev %llu in txg %llu", 1030 vd->vdev_id, txg); 1031 1032 /* --- 623 unchanged lines hidden (view full) --- 1656 1657 spa_history_log_internal(spa, "vdev remove", NULL, 1658 "%s vdev %llu (log) %s", spa_name(spa), vd->vdev_id, 1659 (vd->vdev_path != NULL) ? vd->vdev_path : "-"); 1660 1661 /* Make sure these changes are sync'ed */ 1662 spa_vdev_config_exit(spa, NULL, *txg, 0, FTAG); 1663 | 1027 1028 sysevent_t *ev = spa_event_create(spa, vd, NULL, 1029 ESC_ZFS_VDEV_REMOVE_DEV); 1030 1031 zfs_dbgmsg("finishing device removal for vdev %llu in txg %llu", 1032 vd->vdev_id, txg); 1033 1034 /* --- 623 unchanged lines hidden (view full) --- 1658 1659 spa_history_log_internal(spa, "vdev remove", NULL, 1660 "%s vdev %llu (log) %s", spa_name(spa), vd->vdev_id, 1661 (vd->vdev_path != NULL) ? vd->vdev_path : "-"); 1662 1663 /* Make sure these changes are sync'ed */ 1664 spa_vdev_config_exit(spa, NULL, *txg, 0, FTAG); 1665 |
1666 /* Stop initializing */ 1667 (void) vdev_initialize_stop_all(vd, VDEV_INITIALIZE_CANCELED); 1668 |
|
1664 *txg = spa_vdev_config_enter(spa); 1665 1666 sysevent_t *ev = spa_event_create(spa, vd, NULL, 1667 ESC_ZFS_VDEV_REMOVE_DEV); 1668 ASSERT(MUTEX_HELD(&spa_namespace_lock)); 1669 ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL); 1670 1671 /* The top ZAP should have been destroyed by vdev_remove_empty. */ --- 144 unchanged lines hidden (view full) --- 1816 /* 1817 * We must ensure that no "stubby" log blocks are allocated 1818 * on the device to be removed. These blocks could be 1819 * written at any time, including while we are in the middle 1820 * of copying them. 1821 */ 1822 error = spa_reset_logs(spa); 1823 | 1669 *txg = spa_vdev_config_enter(spa); 1670 1671 sysevent_t *ev = spa_event_create(spa, vd, NULL, 1672 ESC_ZFS_VDEV_REMOVE_DEV); 1673 ASSERT(MUTEX_HELD(&spa_namespace_lock)); 1674 ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL); 1675 1676 /* The top ZAP should have been destroyed by vdev_remove_empty. */ --- 144 unchanged lines hidden (view full) --- 1821 /* 1822 * We must ensure that no "stubby" log blocks are allocated 1823 * on the device to be removed. These blocks could be 1824 * written at any time, including while we are in the middle 1825 * of copying them. 1826 */ 1827 error = spa_reset_logs(spa); 1828 |
1829 /* 1830 * We stop any initializing that is currently in progress but leave 1831 * the state as "active". This will allow the initializing to resume 1832 * if the removal is canceled sometime later. 1833 */ 1834 vdev_initialize_stop_all(vd, VDEV_INITIALIZE_ACTIVE); 1835 |
|
1824 *txg = spa_vdev_config_enter(spa); 1825 1826 /* 1827 * Things might have changed while the config lock was dropped 1828 * (e.g. space usage). Check for errors again. 1829 */ 1830 if (error == 0) 1831 error = spa_vdev_remove_top_check(vd); 1832 1833 if (error != 0) { 1834 metaslab_group_activate(mg); | 1836 *txg = spa_vdev_config_enter(spa); 1837 1838 /* 1839 * Things might have changed while the config lock was dropped 1840 * (e.g. space usage). Check for errors again. 1841 */ 1842 if (error == 0) 1843 error = spa_vdev_remove_top_check(vd); 1844 1845 if (error != 0) { 1846 metaslab_group_activate(mg); |
1847 spa_async_request(spa, SPA_ASYNC_INITIALIZE_RESTART); |
|
1835 return (error); 1836 } 1837 1838 vd->vdev_removing = B_TRUE; 1839 1840 vdev_dirty_leaves(vd, VDD_DTL, *txg); 1841 vdev_config_dirty(vd); 1842 dmu_tx_t *tx = dmu_tx_create_assigned(spa->spa_dsl_pool, *txg); --- 150 unchanged lines hidden --- | 1848 return (error); 1849 } 1850 1851 vd->vdev_removing = B_TRUE; 1852 1853 vdev_dirty_leaves(vd, VDD_DTL, *txg); 1854 vdev_config_dirty(vd); 1855 dmu_tx_t *tx = dmu_tx_create_assigned(spa->spa_dsl_pool, *txg); --- 150 unchanged lines hidden --- |