diff options
author | Fedor Uporov <[email protected]> | 2021-11-09 12:50:39 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2021-11-09 12:50:39 -0800 |
commit | e39fe05b69e4d78311c5c25a8dc21b0b1dca2409 (patch) | |
tree | 4390492925ff2e64cefbcd073fe12f4333b95980 /module/zfs/metaslab.c | |
parent | 345196be182ad6efe07ea21372117243ba6d7910 (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/metaslab.c')
-rw-r--r-- | module/zfs/metaslab.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c index df0d83327..d1fee70f0 100644 --- a/module/zfs/metaslab.c +++ b/module/zfs/metaslab.c @@ -2661,7 +2661,8 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint64_t object, /* * We only open space map objects that already exist. All others - * will be opened when we finally allocate an object for it. + * will be opened when we finally allocate an object for it. For + * readonly pools there is no need to open the space map object. * * Note: * When called from vdev_expand(), we can't call into the DMU as @@ -2670,7 +2671,8 @@ metaslab_init(metaslab_group_t *mg, uint64_t id, uint64_t object, * that case, the object parameter is zero though, so we won't * call into the DMU. */ - if (object != 0) { + if (object != 0 && !(spa->spa_mode == SPA_MODE_READ && + !spa->spa_read_spacemaps)) { error = space_map_open(&ms->ms_sm, mos, object, ms->ms_start, ms->ms_size, vd->vdev_ashift); |