1. When testing out installing a VM with virtual manager on Linux and a
dataset with direct=always, there an ASSERT failure in
abd_alloc_from_pages(). Originally zfs_setup_direct() did an
alignment check of the UIO using SPA_MINBLOCKSIZE with
zfs_uio_aligned(). The idea behind this was maybe the page alignment
restriction could be changed to use ashift as the alignment check in
the future. Howver, this diea never came to be. The alignment
restrictions for Direct I/O are based on PAGE_SIZE. Updating the
check zfs_setup_direct() for the UIO to use PAGE_SIZE fixed the
issue.
2. Updated other alignment check in dmu_read_impl() to also use
PAGE_SIZE.
3. As a consequence of updating the UIO alignment checks the ZTS test
case dio_unaligned_filesize began to fail. This is because there was
no way to detect reading past the end of the file before issue EINVAL
in the ZPL and VOPs layers in FreeBSD. This was resolved by moving
zfs_setup_direct() into zfs_write() and zfs_read(). This allows for
other error checking to take place before checking any Direct I/O
limitations. Updating the call site of zfs_setup_direct() did require
a bit of changes to the logic in that function. In particular Direct
I/O can just be avoid altogether depending on the checks in
zfs_setup_direct() and there is no reason to return EAGAIN at all.
4. After moving zfs_setup_direct() into zfs_write() and zfs_read(),
there was no reason to call zfs_check_direct_enabled() in the ZPL
layer in Linux or in the VNOPS layer of FreeBSD. This function was
completely removed. This allowed for much of the code in both those
layers to return to their original code.
5. Upated the checksum verify module parameter for Direct I/O writes to
only be a boolean and return EIO in the event a checksum verify
failure occurs. By default, this module parameter is set to 1 for
Linux and 0 for FreeBSD. The module parameter has been changed to
zfs_vdev_direct_write_verify. There are still counters on the
top-level VDEV for checksum verify failures, but this could be
removed. It would still be good to to leave the ZED event dio_verify
for checksum failures as a notification that an application was
manipulating the contents of a buffer after issuing that buffer with
for I/O using Direct I/O. As part of this cahnge, man pages were
updated, the ZTS test case dio_writy_verify was updated, and all
comments relating to the module parameter were udpated as well.
6. Updated comments in dio_property ZTS test to properly reflect that
stride_dd is being called with check_write and check_read.
Signed-off-by: Brian Atkinson <batkinson@lanl.gov>