From 066532da5146462541674d281daae9134210c422 Mon Sep 17 00:00:00 2001 From: Allan Jude Date: Thu, 25 May 2023 16:35:04 +0000 Subject: [PATCH] Add module parameter to block 0 byte writes Some hardware has issues when issues a write of 0 bytes Add a new module paramter, zio_suppress_zero_writes That when enabled (default) will just complete these I/Os without sending them to the hardware. Signed-off-by: Allan Jude --- module/os/linux/zfs/vdev_disk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/os/linux/zfs/vdev_disk.c b/module/os/linux/zfs/vdev_disk.c index 9fecad7b0c..37963bafde 100644 --- a/module/os/linux/zfs/vdev_disk.c +++ b/module/os/linux/zfs/vdev_disk.c @@ -794,7 +794,10 @@ vdev_disk_io_start(zio_t *zio) return; } - if (zio->io_size == 0) { + if (zio->io_size == 0 && ( + zio->io_type == ZIO_TYPE_WRITE || + zio->io_type == ZIO_TYPE_READ || + zio->io_type == ZIO_TYPE_TRIM)) { cmn_err(CE_WARN, "KLARA: vdev_disk_io_start() " "io_type=%d io_size=%d!", zio->io_type, zio->io_size); if (zio->io_type == ZIO_TYPE_WRITE &&