]> git.proxmox.com Git - mirror_zfs.git/commitdiff
vdev_disk: add module parameter to select BIO submission method
authorRob Norris <rob.norris@klarasystems.com>
Tue, 9 Jan 2024 02:28:57 +0000 (13:28 +1100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 25 Mar 2024 23:51:30 +0000 (16:51 -0700)
This makes the submission method selectable at module load time via the
`zfs_vdev_disk_classic` parameter, allowing this change to be backported
to 2.2 safely, and disabled in favour of the "classic" submission method
if new problems come up.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Closes #15533
Closes #15588

man/man4/zfs.4
module/os/linux/zfs/vdev_disk.c

index 61f1df9c81d531c5afab62025ef8d8f71af7cda6..cacb214d1dc18112b1661ea29ede4e7626964052 100644 (file)
@@ -1382,6 +1382,22 @@ If this is higher than the maximum allowed by the device queue or the kernel
 itself, it will be clamped.
 Setting it to zero will cause the kernel's ideal size to be used.
 This parameter only applies on Linux.
+This parameter is ignored if
+.Sy zfs_vdev_disk_classic Ns = Ns Sy 1 .
+.
+.It Sy zfs_vdev_disk_classic Ns = Ns Sy 0 Ns | Ns 1 Pq uint
+If set to 1, OpenZFS will submit IO to Linux using the method it used in 2.2
+and earlier.
+This "classic" method has known issues with highly fragmented IO requests and
+is slower on many workloads, but it has been in use for many years and is known
+to be very stable.
+If you set this parameter, please also open a bug report why you did so,
+including the workload involved and any error messages.
+.Pp
+This parameter and the classic submission method will be removed once we have
+total confidence in the new method.
+.Pp
+This parameter only applies on Linux, and can only be set at module load time.
 .
 .It Sy zfs_expire_snapshot Ns = Ns Sy 300 Ns s Pq int
 Time before expiring
index 0ccb9ad96fa5fad386086f059496d8e6cf22c617..a9110623ace066b1cdc8f2c3eeb7381cd9c5a23a 100644 (file)
@@ -1535,6 +1535,29 @@ vdev_disk_rele(vdev_t *vd)
        /* XXX: Implement me as a vnode rele for the device */
 }
 
+/*
+ * BIO submission method. See comment above about vdev_classic.
+ * Set zfs_vdev_disk_classic=0 for new, =1 for classic
+ */
+static uint_t zfs_vdev_disk_classic = 0;       /* default new */
+
+/* Set submission function from module parameter */
+static int
+vdev_disk_param_set_classic(const char *buf, zfs_kernel_param_t *kp)
+{
+       int err = param_set_uint(buf, kp);
+       if (err < 0)
+               return (SET_ERROR(err));
+
+       vdev_disk_io_rw_fn =
+           zfs_vdev_disk_classic ? vdev_classic_physio : vdev_disk_io_rw;
+
+       printk(KERN_INFO "ZFS: forcing %s BIO submission\n",
+           zfs_vdev_disk_classic ? "classic" : "new");
+
+       return (0);
+}
+
 /*
  * At first use vdev use, set the submission function from the default value if
  * it hasn't been set already.
@@ -1547,8 +1570,8 @@ vdev_disk_init(spa_t *spa, nvlist_t *nv, void **tsd)
        (void) tsd;
 
        if (vdev_disk_io_rw_fn == NULL)
-               /* XXX make configurable */
-               vdev_disk_io_rw_fn = 0 ? vdev_classic_physio : vdev_disk_io_rw;
+               vdev_disk_io_rw_fn = zfs_vdev_disk_classic ?
+                   vdev_classic_physio : vdev_disk_io_rw;
 
        return (0);
 }
@@ -1650,3 +1673,7 @@ ZFS_MODULE_PARAM(zfs_vdev, zfs_vdev_, failfast_mask, UINT, ZMOD_RW,
 
 ZFS_MODULE_PARAM(zfs_vdev_disk, zfs_vdev_disk_, max_segs, UINT, ZMOD_RW,
        "Maximum number of data segments to add to an IO request (min 4)");
+
+ZFS_MODULE_PARAM_CALL(zfs_vdev_disk, zfs_vdev_disk_, classic,
+    vdev_disk_param_set_classic, param_get_uint, ZMOD_RD,
+       "Use classic BIO submission method");