mirror_zfs/config
Brian Behlendorf a584ef2605
Direct IO support
Direct IO via the O_DIRECT flag was originally introduced in XFS by
IRIX for database workloads. Its purpose was to allow the database
to bypass the page and buffer caches to prevent unnecessary IO
operations (e.g.  readahead) while preventing contention for system
memory between the database and kernel caches.

On Illumos, there is a library function called directio(3C) that
allows user space to provide a hint to the file system that Direct IO
is useful, but the file system is free to ignore it. The semantics
are also entirely a file system decision. Those that do not
implement it return ENOTTY.

Since the semantics were never defined in any standard, O_DIRECT is
implemented such that it conforms to the behavior described in the
Linux open(2) man page as follows.

    1.  Minimize cache effects of the I/O.

    By design the ARC is already scan-resistant which helps mitigate
    the need for special O_DIRECT handling.  Data which is only
    accessed once will be the first to be evicted from the cache.
    This behavior is in consistent with Illumos and FreeBSD.

    Future performance work may wish to investigate the benefits of
    immediately evicting data from the cache which has been read or
    written with the O_DIRECT flag.  Functionally this behavior is
    very similar to applying the 'primarycache=metadata' property
    per open file.

    2. O_DIRECT _MAY_ impose restrictions on IO alignment and length.

    No additional alignment or length restrictions are imposed.

    3. O_DIRECT _MAY_ perform unbuffered IO operations directly
       between user memory and block device.

    No unbuffered IO operations are currently supported.  In order
    to support features such as transparent compression, encryption,
    and checksumming a copy must be made to transform the data.

    4. O_DIRECT _MAY_ imply O_DSYNC (XFS).

    O_DIRECT does not imply O_DSYNC for ZFS.  Callers must provide
    O_DSYNC to request synchronous semantics.

    5. O_DIRECT _MAY_ disable file locking that serializes IO
       operations.  Applications should avoid mixing O_DIRECT
       and normal IO or mmap(2) IO to the same file.  This is
       particularly true for overlapping regions.

    All I/O in ZFS is locked for correctness and this locking is not
    disabled by O_DIRECT.  However, concurrently mixing O_DIRECT,
    mmap(2), and normal I/O on the same file is not recommended.

This change is implemented by layering the aops->direct_IO operations
on the existing AIO operations.  Code already existed in ZFS on Linux
for bypassing the page cache when O_DIRECT is specified.

References:
  * http://xfs.org/docs/xfsdocs-xml-dev/XFS_User_Guide/tmp/en-US/html/ch02s09.html
  * https://blogs.oracle.com/roch/entry/zfs_and_directio
  * https://ext4.wiki.kernel.org/index.php/Clarifying_Direct_IO's_Semantics
  * https://illumos.org/man/3c/directio

Reviewed-by: Richard Elling <Richard.Elling@RichardElling.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #224 
Closes #7823
2018-08-27 10:04:21 -07:00
..
.gitignore Prepare SPL repo to merge with ZFS repo 2018-05-29 14:51:39 -07:00
always-arch.m4 Illumos Crypto Port module added to enable native encryption in zfs 2016-07-20 10:43:30 -07:00
always-compiler-options.m4 Support -fsanitize=address with --enable-asan 2018-01-10 10:49:27 -08:00
always-pyzfs.m4 Fix inverted check for --enable-pyzfs 2018-05-03 11:10:26 -07:00
ax_code_coverage.m4 Fix "--enable-code-coverage" debug build 2017-09-22 22:16:18 -07:00
ax_python_devel.m4 Adopt pyzfs from ClusterHQ 2018-05-01 10:33:35 -07:00
config.awk Prepare SPL repo to merge with ZFS repo 2018-05-29 14:51:39 -07:00
deb.am Prepare SPL repo to merge with ZFS repo 2018-05-29 14:51:39 -07:00
kernel-acl-refcount.m4 Linux 4.16 compat: use correct *_dec_and_test() 2018-02-22 09:02:06 -08:00
kernel-acl.m4 Fix config issues: frame size and headers 2018-02-15 12:58:23 -08:00
kernel-aio-fsync.m4 Kernel 4.9 compat: file_operations->aio_fsync removal 2016-11-15 09:20:46 -08:00
kernel-automount.m4 Fix snapshot automounting with GrSecurity constify plugin. 2012-08-24 08:56:38 -07:00
kernel-bdev-logical-size.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-bdev-physical-size.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-bdi.m4 Fix autoconf detection of super_setup_bdi_name 2017-07-25 10:30:20 -07:00
kernel-bio_set_dev.m4 Linux 3.14 compat: IO acct, global_page_state, etc 2017-09-16 11:00:19 -07:00
kernel-bio-bvec-iter.m4 Linux 3.14 compat: Immutable biovec changes in vdev_disk.c 2014-04-10 14:28:38 -07:00
kernel-bio-end-io-t-args.m4 Linux 4.13 compat: bio->bi_status and blk_status_t 2017-07-23 19:37:12 -07:00
kernel-bio-failfast.m4 Linux 2.6.36 compat, use REQ_FAILFAST_MASK and remove pre-2.6.36 support 2015-05-11 15:07:00 -07:00
kernel-bio-op.m4 Fix RHEL 7.4 bio_set_op_attrs build error 2017-06-27 12:00:27 -07:00
kernel-bio-rw-barrier.m4 zvol processing should use struct bio 2015-09-04 15:30:24 -04:00
kernel-bio-rw-discard.m4 zvol processing should use struct bio 2015-09-04 15:30:24 -04:00
kernel-blk-queue-bdi.m4 Enable Linux read-ahead for a single page on ZVOLs 2017-05-04 18:00:27 -04:00
kernel-blk-queue-flags.m4 Linux compat 4.16: blk_queue_flag_{set,clear} 2018-04-10 10:32:14 -07:00
kernel-blk-queue-flush.m4 Linux 4.7 compat: replace blk_queue_flush with blk_queue_write_cache 2016-05-20 11:08:55 -07:00
kernel-blk-queue-max-hw-sectors.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-blk-queue-max-segments.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-blk-queue-unplug.m4 Explicit block device plugging when submitting multiple BIOs 2016-09-29 13:13:31 -07:00
kernel-blkdev-get-by-path.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-blkdev-reread-part.m4 Add support for autoexpand property 2018-07-23 15:40:15 -07:00
kernel-block-device-operations.m4 Linux compat 4.18: check_disk_size_change() 2018-06-15 15:05:21 -07:00
kernel-clear-inode.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-commit-metadata.m4 Implement .commit_metadata hook for NFS export 2012-10-03 10:49:45 -07:00
kernel-create-nameidata.m4 Fix config issues: frame size and headers 2018-02-15 12:58:23 -08:00
kernel-ctl-table-name.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-current_bio_tail.m4 zvol processing should use struct bio 2015-09-04 15:30:24 -04:00
kernel-current-time.m4 Linux 4.18 compat: inode timespec -> timespec64 2018-06-19 21:51:18 -07:00
kernel-d-make-root.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-d-obtain-alias.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-d-prune-aliases.m4 Add zfs_sb_prune_aliases() function 2015-06-22 10:22:49 -07:00
kernel-declare-event-class.m4 Swap DTRACE_PROBE* with Linux tracepoints 2014-11-17 11:13:55 -08:00
kernel-dentry-operations.m4 Fix config issues: frame size and headers 2018-02-15 12:58:23 -08:00
kernel-dirty-inode.m4 Eliminate runtime function pointer mods in autotools checks 2013-03-04 08:49:17 -08:00
kernel-discard-granularity.m4 Set zvol discard_granularity to the volblocksize. 2012-08-07 14:55:31 -07:00
kernel-elevator-change.m4 Linux 4.14 compat: blk_queue_stackable() 2018-06-19 21:52:45 -07:00
kernel-encode-fh-inode.m4 Linux 3.5 compat, eops->encode_fh() takes inodes 2012-07-23 12:29:23 -07:00
kernel-evict-inode.m4 Fix build failures on PaX/GRSecurity patched kernels 2012-07-17 09:22:43 -07:00
kernel-fallocate-pax.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-fallocate.m4 Prepare SPL repo to merge with ZFS repo 2018-05-29 14:51:39 -07:00
kernel-file-dentry.m4 Use file_dentry and file_inode wrappers 2016-08-11 12:06:37 -07:00
kernel-file-inode.m4 Linux 3.19 compat: file_inode was added 2015-02-10 11:24:51 -08:00
kernel-fmode-t.m4 Fix gcc configure warnings 2011-04-19 10:10:47 -07:00
kernel-follow-down-one.m4 Linux 3.18 compat: Snapshot auto-mounting 2015-08-31 13:54:39 -07:00
kernel-fpu.m4 Support for vectorized algorithms on x86 2016-03-21 09:24:34 -07:00
kernel-fst-mount.m4 Allow mounting datasets more than once 2018-04-13 10:44:05 -07:00
kernel-fsync.m4 Eliminate runtime function pointer mods in autotools checks 2013-03-04 08:49:17 -08:00
kernel-generic_io_acct.m4 Linux 3.14 compat: IO acct, global_page_state, etc 2017-09-16 11:00:19 -07:00
kernel-generic_readlink.m4 4.10 compat - BIO flag changes and others 2016-12-30 16:03:59 -06:00
kernel-get-disk-and-module.m4 Linux 4.16 compat: get_disk_and_module() 2018-03-05 12:44:35 -08:00
kernel-get-disk-ro.m4 Only use gcc -Wunused-but-set-variable when available 2013-01-10 16:09:39 -08:00
kernel-get-link.m4 Fix config issues: frame size and headers 2018-02-15 12:58:23 -08:00
kernel-global_page_state.m4 Fix free memory calculation on v3.14+ 2018-02-23 08:50:06 -08:00
kernel-group-info.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-inode-getattr.m4 Linux 4.11 compat: iops.getattr and friends 2017-03-20 17:51:16 -07:00
kernel-inode-lock.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-inode-set-flags.m4 Use inode_set_flags when available 2016-12-16 13:54:51 -08:00
kernel-inode-set-iversion.m4 Linux 4.16 compat: inode_set_iversion() 2018-02-08 21:25:19 -08:00
kernel-inode-times.m4 Linux 4.18 compat: inode timespec -> timespec64 2018-06-19 21:51:18 -07:00
kernel-insert-inode-locked.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-invalidate-bdev-args.m4 Fix gcc configure warnings 2011-04-19 10:10:47 -07:00
kernel-is_owner_or_cap.m4 Refactor inode_owner_or_capable() autotools check 2014-05-01 10:06:49 -07:00
kernel-kmap-atomic-args.m4 Add compatibility layer for {kmap,kunmap}_atomic 2015-08-24 10:13:25 -07:00
kernel-kmem-cache.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-kmem.m4 Prepare SPL repo to merge with ZFS repo 2018-05-29 14:51:39 -07:00
kernel-kuid-helpers.m4 Check whether the kernel supports i_uid/gid_read/write helpers 2016-07-25 13:21:49 -07:00
kernel-kuidgid.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-lookup-bdev.m4 Fix lookup_bdev() on Ubuntu 2016-10-26 10:30:43 -07:00
kernel-lookup-nameidata.m4 Fix config issues: frame size and headers 2018-02-15 12:58:23 -08:00
kernel-lseek-execute.m4 Add SEEK_DATA/SEEK_HOLE to lseek()/llseek() 2013-07-02 09:24:43 -07:00
kernel-misc-minor.m4 Add kernel module auto-loading 2018-03-13 10:45:55 -07:00
kernel-mk-request-fn.m4 Linux 4.4 compat: make_request_fn returns blk_qc_t 2015-12-01 16:48:08 -08:00
kernel-mkdir-umode-t.m4 Fix spelling 2017-01-03 11:31:18 -06:00
kernel-mod-param.m4 Linux compat: Grsecurity kernel 2016-08-22 10:05:45 -07:00
kernel-objtool.m4 Suppress incorrect objtool warnings 2017-12-07 10:28:50 -08:00
kernel-open-bdev-exclusive.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-pde-data.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-put-link.m4 Linux 4.5 compat: get_link() / put_link() 2016-01-20 11:36:00 -08:00
kernel-rename.m4 Linux 4.9 compat: iops->rename() wants flags 2016-10-20 09:39:09 -07:00
kernel-rw.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-rwsem.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-sched.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-security-inode-init.m4 Use -Werror for all kernel configure tests. 2013-02-24 10:20:28 -08:00
kernel-set-fs-pwd.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-set-nlink.m4 Linux 3.2 compat: set_nlink() 2011-12-16 20:02:52 -08:00
kernel-setattr-prepare.m4 Linux 4.9 compat: inode_change_ok() renamed setattr_prepare() 2016-10-20 09:39:09 -07:00
kernel-sget-args.m4 Linux 3.6 compat, sget() 2012-10-14 13:06:48 -07:00
kernel-show-options.m4 Fix NULL pointer dereference on PaX/GRSecurity patched Linux 3.3 and later kernels 2012-07-20 12:31:45 -07:00
kernel-shrink.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-spinlock.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-submit_bio.m4 Linux 4.8 compat: submit_bio() 2016-07-29 14:48:00 -07:00
kernel-super-userns.m4 Linux 4.8 compat: new s_user_ns member of struct super_block 2016-08-08 10:47:22 -07:00
kernel-timer.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-tmpfile.m4 Add support for O_TMPFILE 2016-11-04 10:46:40 -07:00
kernel-truncate-range.m4 Prepare SPL repo to merge with ZFS repo 2018-05-29 14:51:39 -07:00
kernel-truncate-setsize.m4 When checking for symbol exports, try compiling. 2012-07-26 13:42:57 -07:00
kernel-urange-sleep.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-userns-capabilities.m4 Take user namespaces into account in policy checks 2018-03-07 15:40:42 -08:00
kernel-vfs-direct_IO.m4 Direct IO support 2018-08-27 10:04:21 -07:00
kernel-vfs-fsync.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-vfs-getattr.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-vfs-iterate.m4 RHEL 7.5 compat: FMODE_KABI_ITERATE 2018-05-02 15:01:24 -07:00
kernel-vfs-rw-iterate.m4 Fix incompatibility with Reiser4 patched kernels 2018-01-09 16:18:19 -08:00
kernel-wait.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel-xattr-handler.m4 Fix spelling 2017-01-03 11:31:18 -06:00
kernel-zlib.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
kernel.m4 Direct IO support 2018-08-27 10:04:21 -07:00
mount-helper.m4 The mount helper mount.zfs MUST be in /sbin (not '$sbindir'). 2015-05-18 16:54:36 -07:00
rpm.am Prepare SPL repo to merge with ZFS repo 2018-05-29 14:51:39 -07:00
Rules.am Prepare SPL repo to merge with ZFS repo 2018-05-29 14:51:39 -07:00
suppressed-warnings.txt Suppress packaging warning 2011-11-08 11:32:04 -08:00
tgz.am Prepare SPL repo to merge with ZFS repo 2018-05-29 14:51:39 -07:00
toolchain-simd.m4 Add support for selecting encryption backend 2018-08-02 11:59:24 -07:00
user-dracut.m4 Accept udev and dracut paths specified by ./configure 2014-06-11 16:32:57 -07:00
user-libaio.m4 Fix mmap / libaio deadlock 2018-03-28 10:19:22 -07:00
user-libblkid.m4 Fix config issues: frame size and headers 2018-02-15 12:58:23 -08:00
user-libexec.m4 Tunable directory for zfs runtime scripts 2018-06-07 09:59:59 -07:00
user-libssl.m4 Fix config issues: frame size and headers 2018-02-15 12:58:23 -08:00
user-libtirpc.m4 Add support for libtirpc 2016-04-28 09:27:40 -07:00
user-libudev.m4 Fix WANT_DEVNAME2DEVID configure error 2016-04-01 09:06:54 -07:00
user-libuuid.m4 Cleanup linking 2016-03-18 13:31:11 -07:00
user-makedev.m4 glibc 2.5 compat: use correct header for makedev() et al. 2017-03-31 09:32:00 -07:00
user-runstatedir.m4 Add defs for makefile installation dir vars 2014-03-31 16:11:13 -07:00
user-systemd.m4 systemd mount generator and tracking ZEDLET 2018-04-06 14:11:09 -07:00
user-sysvinit.m4 Add systemd unit files for ZFS startup 2014-02-05 12:25:30 -08:00
user-udev.m4 Accept udev and dracut paths specified by ./configure 2014-06-11 16:32:57 -07:00
user-zlib.m4 Cleanup linking 2016-03-18 13:31:11 -07:00
user.m4 Tunable directory for zfs runtime scripts 2018-06-07 09:59:59 -07:00
zfs-build.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00
zfs-meta.m4 Update build system and packaging 2018-05-29 16:00:33 -07:00