Skip to content

Commit

Permalink
Increase default volblocksize from 8KB to 16KB.
Browse files Browse the repository at this point in the history
Many things has changed since previous default was set many years ago.
Nowadays 8KB does not allow adequate compression or even decent space
efficiency on many of pools due to 4KB disk physical block rounding,
especially on RAIDZ and DRAID.  It effectively limits write throughput
to only 2-3GB/s (250-350K blocks/s) due to sync thread, allocation,
vdev queue and other block rate bottlenecks.  It keeps L2ARC expensive
despite many optimizations and dedup just unrealistic.

In FreeNAS/TrueNAS we for years default to at least 16KB volblocksize
for mirror pools and even bigger (32-64KB) for RAIDZ, and so far we
can find very few scenarios (not synthetic benchmarks) when smaller
blocks would show sufficient benefits.

Signed-off-by: Alexander Motin <mav@FreeBSD.org>
  • Loading branch information
amotin committed Jul 26, 2021
1 parent ab8a8f0 commit 383cedd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/sys/fs/zfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ typedef struct ddt_histogram {
#define ZVOL_DEV_NAME "zd"

#define ZVOL_PROP_NAME "name"
#define ZVOL_DEFAULT_BLOCKSIZE 8192
#define ZVOL_DEFAULT_BLOCKSIZE 16384

typedef enum {
VDEV_INITIALIZE_NONE,
Expand Down
2 changes: 1 addition & 1 deletion man/man7/zfsprops.7
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ cannot be changed once the volume has been written, so it should be set at
volume creation time.
The default
.Sy blocksize
for volumes is 8 Kbytes.
for volumes is 16 Kbytes.
Any power of 2 from 512 bytes to 128 Kbytes is valid.
.Pp
This property can also be referred to by its shortened column name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ set -A size "8k" "8K" "35K" "1m" "1M" "1mb" "1mB" "1Mb" "1MB" "1g" "1G" \
# explicitly check that its size has been rounded up to the nearest multiple
# The volume with the exact size must exist in the "size" array above
set -A explicit_size_check "35K"
set -A expected_rounded_size "40960"
set -A expected_rounded_size "49152"
4 changes: 2 additions & 2 deletions tests/zfs-tests/tests/functional/nopwrite/nopwrite_volume.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ log_assert "nopwrite works on volumes"

log_must zfs set compress=on $origin
log_must zfs set checksum=sha256 $origin
dd if=/dev/urandom of=$vol bs=8192 count=4096 conv=notrunc >/dev/null \
dd if=/dev/urandom of=$vol bs=16384 count=2048 conv=notrunc >/dev/null \
2>&1 || log_fail "dd into $origin failed."
zfs snapshot $origin@a || log_fail "zfs snap failed"
log_must zfs clone $origin@a $clone
log_must zfs set compress=on $clone
log_must zfs set checksum=sha256 $clone
block_device_wait
dd if=$vol of=$volclone bs=8192 count=4096 conv=notrunc >/dev/null 2>&1 || \
dd if=$vol of=$volclone bs=16384 count=2048 conv=notrunc >/dev/null 2>&1 || \
log_fail "dd into $clone failed."
log_must verify_nopwrite $origin $origin@a $clone

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,15 @@ function create_multiple_fs # num_fs base_fs_name base_mnt_name

#
# This function compute the largest volume size which is multiple of volume
# block size (default 8K) and not greater than the largest expected volsize.
# block size (default 16K) and not greater than the largest expected volsize.
#
# $1 The largest expected volume size.
# $2 The volume block size
#
function floor_volsize #<largest_volsize> [volblksize]
{
typeset largest_volsize=$1
typeset volblksize=${2:-8192}
typeset volblksize=${2:-16384}

if ((largest_volsize < volblksize)); then
log_fail "The largest_volsize must be greater than volblksize."
Expand Down Expand Up @@ -157,7 +157,7 @@ function volsize_to_reservation
typeset volblocksize=$(get_prop volblocksize $vol)
else
typeset ncopies=1
typeset volblocksize=8192
typeset volblocksize=16384
fi
typeset nblocks=$((volsize / volblocksize))

Expand Down

0 comments on commit 383cedd

Please sign in to comment.