From 8b75f7b1be0b520a96d49d2d54c7d3a4565360db Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 29 Jul 2021 10:01:21 -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. Signed-off-by: Mark Johnston --- 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 6ac37da1c58a..4ffa21495e74 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);