From f0e86b4969a67f7a46157469b981bda6ebae9083 Mon Sep 17 00:00:00 2001 From: Jorgen Lundman Date: Wed, 8 Nov 2023 10:30:32 +0900 Subject: [PATCH] Set zp->z-blksz to ashift if larger This is in interaction with zfs-write-log() which uses z-blksz to determine chunking sizes, which can be heavily penalised when devices have larger blocksizes, using read/copy/write for each IO. Signed-off-by: Jorgen Lundman --- module/os/windows/zfs/zfs_znode.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/module/os/windows/zfs/zfs_znode.c b/module/os/windows/zfs/zfs_znode.c index f501b3ac162d..999574e8452d 100644 --- a/module/os/windows/zfs/zfs_znode.c +++ b/module/os/windows/zfs/zfs_znode.c @@ -69,6 +69,8 @@ #include #include +#include // spa_min_alloc + #include "zfs_prop.h" #include "zfs_comutil.h" @@ -627,6 +629,10 @@ zfs_znode_alloc(zfsvfs_t *zfsvfs, dmu_buf_t *db, int blksz, if (zp->z_blksz == 0) zp->z_blksz = zfs_blksz(zp); + /* This makes a large difference on 4096 block devices */ + if (zfsvfs->z_os->os_spa->spa_min_alloc > zp->z_blksz) + zp->z_blksz = zfsvfs->z_os->os_spa->spa_min_alloc; + return (zp); }