mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 11:18:52 +03:00
Vdev Properties Feature
Add properties, similar to pool properties, to each vdev. This makes use of the existing per-vdev ZAP that was added as part of device evacuation/removal. A large number of read-only properties are exposed, many of the members of struct vdev_t, that provide useful statistics. Adds support for read-only "removing" vdev property. Adds the "allocating" property that defaults to "on" and can be set to "off" to prevent future allocations from that top-level vdev. Supports user-defined vdev properties. Includes support for properties.vdev in SYSFS. Co-authored-by: Allan Jude <allan@klarasystems.com> Co-authored-by: Mark Maybee <mark.maybee@delphix.com> Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Mark Maybee <mark.maybee@delphix.com> Signed-off-by: Allan Jude <allan@klarasystems.com> Closes #11711
This commit is contained in:
+15
-23
@@ -1833,36 +1833,27 @@ spa_update_dspace(spa_t *spa)
|
||||
{
|
||||
spa->spa_dspace = metaslab_class_get_dspace(spa_normal_class(spa)) +
|
||||
ddt_get_dedup_dspace(spa);
|
||||
if (spa->spa_vdev_removal != NULL) {
|
||||
if (spa->spa_nonallocating_dspace > 0) {
|
||||
/*
|
||||
* We can't allocate from the removing device, so subtract
|
||||
* its size if it was included in dspace (i.e. if this is a
|
||||
* normal-class vdev, not special/dedup). This prevents the
|
||||
* DMU/DSL from filling up the (now smaller) pool while we
|
||||
* are in the middle of removing the device.
|
||||
* Subtract the space provided by all non-allocating vdevs that
|
||||
* contribute to dspace. If a file is overwritten, its old
|
||||
* blocks are freed and new blocks are allocated. If there are
|
||||
* no snapshots of the file, the available space should remain
|
||||
* the same. The old blocks could be freed from the
|
||||
* non-allocating vdev, but the new blocks must be allocated on
|
||||
* other (allocating) vdevs. By reserving the entire size of
|
||||
* the non-allocating vdevs (including allocated space), we
|
||||
* ensure that there will be enough space on the allocating
|
||||
* vdevs for this file overwrite to succeed.
|
||||
*
|
||||
* Note that the DMU/DSL doesn't actually know or care
|
||||
* how much space is allocated (it does its own tracking
|
||||
* of how much space has been logically used). So it
|
||||
* doesn't matter that the data we are moving may be
|
||||
* allocated twice (on the old device and the new
|
||||
* device).
|
||||
* allocated twice (on the old device and the new device).
|
||||
*/
|
||||
spa_config_enter(spa, SCL_VDEV, FTAG, RW_READER);
|
||||
vdev_t *vd =
|
||||
vdev_lookup_top(spa, spa->spa_vdev_removal->svr_vdev_id);
|
||||
/*
|
||||
* If the stars align, we can wind up here after
|
||||
* vdev_remove_complete() has cleared vd->vdev_mg but before
|
||||
* spa->spa_vdev_removal gets cleared, so we must check before
|
||||
* we dereference.
|
||||
*/
|
||||
if (vd->vdev_mg &&
|
||||
vd->vdev_mg->mg_class == spa_normal_class(spa)) {
|
||||
spa->spa_dspace -= spa_deflate(spa) ?
|
||||
vd->vdev_stat.vs_dspace : vd->vdev_stat.vs_space;
|
||||
}
|
||||
spa_config_exit(spa, SCL_VDEV, FTAG);
|
||||
ASSERT3U(spa->spa_dspace, >=, spa->spa_nonallocating_dspace);
|
||||
spa->spa_dspace -= spa->spa_nonallocating_dspace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2429,6 +2420,7 @@ spa_init(spa_mode_t mode)
|
||||
zpool_prop_init();
|
||||
zpool_feature_init();
|
||||
spa_config_load();
|
||||
vdev_prop_init();
|
||||
l2arc_start();
|
||||
scan_init();
|
||||
qat_init();
|
||||
|
||||
Reference in New Issue
Block a user