special device removal space accounting fixes

The space in special devices is not included in spa_dspace (or
dsl_pool_adjustedsize(), or the zfs `available` property).  Therefore
there is always at least as much free space in the normal class, as
there is allocated in the special class(es).  And therefore, there is
always enough free space to remove a special device.

However, the checks for free space when removing special devices did not
take this into account.  This commit corrects that.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Don Brady <don.brady@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Closes #11329
This commit is contained in:
Matthew Ahrens
2020-12-17 12:11:56 -08:00
committed by Brian Behlendorf
parent 2ab24dfded
commit a103ae446e
4 changed files with 43 additions and 35 deletions
-2
View File
@@ -187,8 +187,6 @@ elif sys.platform.startswith('linux'):
# reasons listed above can be used.
#
maybe = {
'alloc_class/alloc_class_012_pos': ['FAIL', '9142'],
'alloc_class/alloc_class_013_pos': ['FAIL', '9142'],
'chattr/setup': ['SKIP', exec_reason],
'cli_root/zdb/zdb_006_pos': ['FAIL', known_reason],
'cli_root/zfs_get/zfs_get_004_pos': ['FAIL', known_reason],
@@ -33,8 +33,9 @@ function file_in_special_vdev # <dataset> <inode>
{
typeset dataset="$1"
typeset inum="$2"
typeset num_normal=$(echo $ZPOOL_DISKS | wc -w | xargs)
zdb -dddddd $dataset $inum | awk '{
zdb -dddddd $dataset $inum | awk -v d=$num_normal '{
# find DVAs from string "offset level dva" only for L0 (data) blocks
if (match($0,"L0 [0-9]+")) {
dvas[0]=$3
@@ -49,7 +50,7 @@ if (match($0,"L0 [0-9]+")) {
exit 1;
}
# verify vdev is "special"
if (arr[1] < 3) {
if (arr[1] < d) {
exit 1;
}
}