summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/man/man3c/directio.3c5
-rw-r--r--usr/src/uts/common/fs/zfs/zfs_vnops.c42
2 files changed, 44 insertions, 3 deletions
diff --git a/usr/src/man/man3c/directio.3c b/usr/src/man/man3c/directio.3c
index 9ca847bec3..f90bf3dcb7 100644
--- a/usr/src/man/man3c/directio.3c
+++ b/usr/src/man/man3c/directio.3c
@@ -1,9 +1,10 @@
'\" te
.\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright 2020 Joyent, Inc.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH DIRECTIO 3C "Apr 9, 2003"
+.TH DIRECTIO 3C "Feb 28, 2020"
.SH NAME
directio \- provide advice to file system
.SH SYNOPSIS
@@ -130,7 +131,7 @@ when a file is sparse or is being extended and is opened with \fBO_SYNC\fR or
\fBO_DSYNC\fR (see \fBopen\fR(2)).
.sp
.LP
-The \fBdirectio()\fR function is supported for the NFS and UFS file system
+The \fBdirectio()\fR function is supported for the NFS, UFS and ZFS file system
types (see \fBfstyp\fR(1M)).
.SH ATTRIBUTES
.sp
diff --git a/usr/src/uts/common/fs/zfs/zfs_vnops.c b/usr/src/uts/common/fs/zfs/zfs_vnops.c
index 8c84e93240..162c565c45 100644
--- a/usr/src/uts/common/fs/zfs/zfs_vnops.c
+++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c
@@ -23,7 +23,7 @@
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017 by Delphix. All rights reserved.
* Copyright (c) 2014 Integros [integros.com]
- * Copyright 2019 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
* Copyright 2017 Nexenta Systems, Inc.
*/
@@ -377,6 +377,46 @@ zfs_ioctl(vnode_t *vp, int com, intptr_t data, int flag, cred_t *cred,
return (0);
}
+ case _FIODIRECTIO:
+ {
+ /*
+ * ZFS inherently provides the basic semantics for directio.
+ * This is the summary from the ZFS on Linux support for
+ * O_DIRECT, which is the common form of directio, and required
+ * no changes to ZFS.
+ *
+ * 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.
+ *
+ * 2. O_DIRECT _MAY_ impose restrictions on IO alignment and
+ * length.
+ *
+ * No additional alignment or length restrictions are
+ * imposed by ZFS.
+ *
+ * 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 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.
+ *
+ * 5. O_DIRECT _MAY_ disable file locking that serializes IO
+ * operations.
+ *
+ * All I/O in ZFS is locked for correctness and this locking
+ * is not disabled by O_DIRECT.
+ */
+ return (0);
+ }
+
case _FIO_SEEK_DATA:
case _FIO_SEEK_HOLE:
{