diff options
author | Bruce Evans <bde@FreeBSD.org> | 2018-12-21 08:15:31 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 2018-12-21 08:15:31 +0000 |
commit | 9e5ed8593f6bf24929021e092e2de23e8ed9e7b8 (patch) | |
tree | 402402187f33b247002f645cf699e4459e2bf0b8 /sys/sys/mdioctl.h | |
parent | e6f6d8853ccca2130665d74deee83591cc1f5960 (diff) | |
download | src-9e5ed8593f6bf24929021e092e2de23e8ed9e7b8.tar.gz src-9e5ed8593f6bf24929021e092e2de23e8ed9e7b8.zip |
Use VOP_ADVISE() with POSIX_FADV_DONTNEED instead of IO_DIRECT to
implement not double-caching for reads from vnode-backed md devices.
Use VOP_ADVISE() similarly instead of !IO_DIRECT unsimilarly for writes.
Add a "cache" option to mdconfig to allow changing the default of not
caching.
This depends on a recent commit to fix VOP_ADVISE(). A previous version
had optimizations for sequential i/o's (merge the i/o's and only uncache
for discontiguous i/o's and for full blocks), but optimizations and
knowledge of block boundaries belong in VOP_ADVISE(). Read-ahead should
also be handled better, by supporting it in md and discarding it in
VOP_ADVISE().
POSIX_FADV_DONTNEED is ignored by zfs, but so is IO_DIRECT.
POSIX_FADV_DONTNEED works better than IO_DIRECT if it is not ignored,
since it only discards from the buffer cache immediately, while
IO_DIRECT also discards from the page cache immediately.
IO_DIRECT was not used for writes since it was claimed to be too slow,
but most of the slowness for writes is from doing them synchronously by
default. Non-synchronous writes still deadlock in many cases.
IO_DIRECT only has a special implementation for ffs reads with DIRECTIO
configured. Otherwise, if it is not ignored than it uses the buffer and
page caches normally except for discarding everything after each i/o,
and then it has much the same overheads as POSIX_FADV_DONTNEED. The
overheads for reading with ffs and DIRECTIO were similar in tests of md.
Reviewed by: kib
Notes
Notes:
svn path=/head/; revision=342297
Diffstat (limited to 'sys/sys/mdioctl.h')
-rw-r--r-- | sys/sys/mdioctl.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/sys/mdioctl.h b/sys/sys/mdioctl.h index 37a3804fe79e..eac81012bdfd 100644 --- a/sys/sys/mdioctl.h +++ b/sys/sys/mdioctl.h @@ -92,5 +92,6 @@ struct md_ioctl { #define MD_FORCE 0x20 /* Don't try to prevent foot-shooting */ #define MD_ASYNC 0x40 /* Asynchronous mode */ #define MD_VERIFY 0x80 /* Open file with O_VERIFY (vnode only) */ +#define MD_CACHE 0x100 /* Cache vnode data */ #endif /* _SYS_MDIOCTL_H_*/ |