From 451d6da98838a570a9a1b8607c02802462999c28 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 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);