mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Improve too large physical ashift handling
When iterating through children physical ashifts for vdev, prefer ones above the maximum logical ashift, that we can actually use, but within the administrator defined maximum. When selecting top-level vdev ashift, do not set it to the defined maximum in case physical ashift is even higher, but just ignore one. Using the maximum does not prevent misaligned writes, but reduces space efficiency. Since ZFS tries to write data sequentially and aggregates the writes, in many cases large misanigned writes may be not as bad as the space penalty otherwise. Allow internal physical ashifts for vdevs higher than SHIFT_MAX. May be one day allocator or aggregation could benefit from that. Reduce zfs_vdev_max_auto_ashift default from 16 (64KB) to 14 (16KB), so that ZFS may still use bigger ashifts up to SHIFT_MAX (64KB), but only if it really has to or explicitly told to, but not as an "optimization". There are some read-intensive NVMe SSDs that report Preferred Write Alignment of 64KB, and attempt to build RAIDZ2 of those leads to a space inefficiency that can't be justified. Instead these changes make ZFS fall back to logical ashift of 12 (4KB) by default and only warn user that it may be suboptimal for performance. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #13798
This commit is contained in:
@@ -81,7 +81,9 @@ TRIM_TXG_BATCH trim.txg_batch zfs_trim_txg_batch
|
||||
TXG_HISTORY txg.history zfs_txg_history
|
||||
TXG_TIMEOUT txg.timeout zfs_txg_timeout
|
||||
UNLINK_SUSPEND_PROGRESS UNSUPPORTED zfs_unlink_suspend_progress
|
||||
VDEV_FILE_LOGICAL_ASHIFT vdev.file.logical_ashift vdev_file_logical_ashift
|
||||
VDEV_FILE_PHYSICAL_ASHIFT vdev.file.physical_ashift vdev_file_physical_ashift
|
||||
VDEV_MAX_AUTO_ASHIFT vdev.max_auto_ashift zfs_vdev_max_auto_ashift
|
||||
VDEV_MIN_MS_COUNT vdev.min_ms_count zfs_vdev_min_ms_count
|
||||
VDEV_VALIDATE_SKIP vdev.validate_skip vdev_validate_skip
|
||||
VOL_INHIBIT_DEV UNSUPPORTED zvol_inhibit_dev
|
||||
|
||||
@@ -57,7 +57,9 @@ disk2=$TEST_BASE_DIR/disk2
|
||||
log_must mkfile $SIZE $disk1
|
||||
log_must mkfile $SIZE $disk2
|
||||
|
||||
logical_ashift=$(get_tunable VDEV_FILE_LOGICAL_ASHIFT)
|
||||
orig_ashift=$(get_tunable VDEV_FILE_PHYSICAL_ASHIFT)
|
||||
max_auto_ashift=$(get_tunable VDEV_MAX_AUTO_ASHIFT)
|
||||
|
||||
typeset ashifts=("9" "10" "11" "12" "13" "14" "15" "16")
|
||||
for ashift in ${ashifts[@]}
|
||||
@@ -77,7 +79,8 @@ do
|
||||
log_must zpool create $TESTPOOL $disk1
|
||||
log_must set_tunable64 VDEV_FILE_PHYSICAL_ASHIFT $ashift
|
||||
log_must zpool add $TESTPOOL $disk2
|
||||
log_must verify_ashift $disk2 $ashift
|
||||
exp=$(( (ashift <= max_auto_ashift) ? ashift : logical_ashift ))
|
||||
log_must verify_ashift $disk2 $exp
|
||||
|
||||
# clean things for the next run
|
||||
log_must set_tunable64 VDEV_FILE_PHYSICAL_ASHIFT $orig_ashift
|
||||
|
||||
Reference in New Issue
Block a user