Skip to content

Commit

Permalink
Don't upgrade a metaslab when the pool is not writable
Browse files Browse the repository at this point in the history
Illumos 4982 added code to metaslab_fragmentation() to proactively update
space maps when the spacemap_histogram feature is enabled.  This should
only happen when the pool is writeable.

References:
  https://www.illumos.org/issues/4982
  illumos/illumos-gate@2e4c998

Signed-off-by: Tim Chase <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #2595
  • Loading branch information
dweeezil authored and behlendorf committed Aug 18, 2014
1 parent f3a7f66 commit 8b0a084
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions module/zfs/metaslab.c
Original file line number Diff line number Diff line change
Expand Up @@ -1395,13 +1395,16 @@ metaslab_fragmentation(metaslab_t *msp)
* so that we upgrade next time we encounter it.
*/
if (msp->ms_sm->sm_dbuf->db_size != sizeof (space_map_phys_t)) {
uint64_t txg = spa_syncing_txg(spa);
vdev_t *vd = msp->ms_group->mg_vd;

msp->ms_condense_wanted = B_TRUE;
vdev_dirty(vd, VDD_METASLAB, msp, txg + 1);
spa_dbgmsg(spa, "txg %llu, requesting force condense: "
"msp %p, vd %p", txg, msp, vd);
if (spa_writeable(vd->vdev_spa)) {
uint64_t txg = spa_syncing_txg(spa);

msp->ms_condense_wanted = B_TRUE;
vdev_dirty(vd, VDD_METASLAB, msp, txg + 1);
spa_dbgmsg(spa, "txg %llu, requesting force condense: "
"msp %p, vd %p", txg, msp, vd);
}
return (ZFS_FRAG_INVALID);
}

Expand Down

0 comments on commit 8b0a084

Please sign in to comment.