aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/spa.c
diff options
context:
space:
mode:
authorFedor Uporov <[email protected]>2021-11-09 12:50:39 -0800
committerGitHub <[email protected]>2021-11-09 12:50:39 -0800
commite39fe05b69e4d78311c5c25a8dc21b0b1dca2409 (patch)
tree4390492925ff2e64cefbcd073fe12f4333b95980 /module/zfs/spa.c
parent345196be182ad6efe07ea21372117243ba6d7910 (diff)
Skip spacemaps reading in case of pool readonly import
The only zdb utility require to read metaslab-related data during read-only pool import because of spacemaps validation. Add global variable which will allow zdb read spacemaps in case of readonly import mode. Reviewed-by: Serapheim Dimitropoulos <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Fedor Uporov <[email protected]> Closes #9095 Closes #12687
Diffstat (limited to 'module/zfs/spa.c')
-rw-r--r--module/zfs/spa.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c
index 1c0856d7f..1083b5a90 100644
--- a/module/zfs/spa.c
+++ b/module/zfs/spa.c
@@ -181,6 +181,12 @@ boolean_t spa_create_process = B_TRUE; /* no process ==> no sysdc */
boolean_t spa_load_verify_dryrun = B_FALSE;
/*
+ * Allow read spacemaps in case of readonly import (spa_mode == SPA_MODE_READ).
+ * This is used by zdb for spacemaps verification.
+ */
+boolean_t spa_mode_readable_spacemaps = B_FALSE;
+
+/*
* This (illegal) pool name is used when temporarily importing a spa_t in order
* to get the vdev stats associated with the imported devices.
*/
@@ -1242,6 +1248,7 @@ spa_activate(spa_t *spa, spa_mode_t mode)
spa->spa_state = POOL_STATE_ACTIVE;
spa->spa_mode = mode;
+ spa->spa_read_spacemaps = spa_mode_readable_spacemaps;
spa->spa_normal_class = metaslab_class_create(spa, zfs_metaslab_ops);
spa->spa_log_class = metaslab_class_create(spa, zfs_metaslab_ops);