xxxxx@xxxxx.com 2003-04-23
We should be able to remove top-level vdevs (tl-vdevs) from the pool, reducing
total capacity, if there is enough free space in the pool. Note, this
free space must be free usable space - "hot space" doesn't count because
presumably the administrator wants to maintin their hot space policy.
If they don't want to, they should conver the hot space to regular space
and then reduce the pool's capacity.
We can do this by migrating all the non-stem, non-hot metaslabs off of the
tl-vdev we're trying to remove. These metaslabs should replace stem
(ie. empty) slabs on other tl-vdevs.
That much is easy. However, the pool may have plenty of free space
(ie. unused blocks), but not enough stem slabs (ie. unused slabs),
due to fragmentation of free space. We need to be able to relocate
individual blocks to compact the free space so that entire metaslabs
are free. Then we can "re-stem-ify" the entirely-free metaslabs
so that we'll have enough stem slabs to perform the migration/removal.
Relocating individual blocks is a challenge, especially in conjunction
with snapshots.