From 46b2623586df3de6a350a2a95a97312628ad89e9 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Mon, 2 Aug 2021 15:18:24 -0400 Subject: [PATCH] Allow disabling of unmapped I/O on FreeBSD We have a tunable which permits one to disable the use of unmapped I/O for the buffer cache. Respect it in ZFS as well. This is useful for KMSAN, which cannot easily maintain shadow state for unmapped pages. No functional change intended, as unmapped I/O is permitted by default and there's no real reason to disable it in practice except for debugging. Reviewed-by: Alexander Motin Reviewed-by: Tony Nguyen Reviewed-by: Ryan Moeller Signed-off-by: Mark Johnston Closes #12446 --- module/os/freebsd/zfs/vdev_geom.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/os/freebsd/zfs/vdev_geom.c b/module/os/freebsd/zfs/vdev_geom.c index 6ac37da1c..4ffa21495 100644 --- a/module/os/freebsd/zfs/vdev_geom.c +++ b/module/os/freebsd/zfs/vdev_geom.c @@ -1100,6 +1100,10 @@ vdev_geom_check_unmapped(zio_t *zio, struct g_consumer *cp) { struct vdev_geom_check_unmapped_cb_state s; + /* If unmapped I/O is administratively disabled, respect that. */ + if (!unmapped_buf_allowed) + return (0); + /* If the buffer is already linear, then nothing to do here. */ if (abd_is_linear(zio->io_abd)) return (0);