freebsd-nq/sys
John Baldwin f3215338ef Refactor the AIO subsystem to permit file-type-specific handling and
improve cancellation robustness.

Introduce a new file operation, fo_aio_queue, which is responsible for
queueing and completing an asynchronous I/O request for a given file.
The AIO subystem now exports library of routines to manipulate AIO
requests as well as the ability to run a handler function in the
"default" pool of AIO daemons to service a request.

A default implementation for file types which do not include an
fo_aio_queue method queues requests to the "default" pool invoking the
fo_read or fo_write methods as before.

The AIO subsystem permits file types to install a private "cancel"
routine when a request is queued to permit safe dequeueing and cleanup
of cancelled requests.

Sockets now use their own pool of AIO daemons and service per-socket
requests in FIFO order.  Socket requests will not block indefinitely
permitting timely cancellation of all requests.

Due to the now-tight coupling of the AIO subsystem with file types,
the AIO subsystem is now a standard part of all kernels.  The VFS_AIO
kernel option and aio.ko module are gone.

Many file types may block indefinitely in their fo_read or fo_write
callbacks resulting in a hung AIO daemon.  This can result in hung
user processes (when processes attempt to cancel all outstanding
requests during exit) or a hung system.  To protect against this, AIO
requests are only permitted for known "safe" files by default.  AIO
requests for all file types can be enabled by setting the new
vfs.aio.enable_usafe sysctl to a non-zero value.  The AIO tests have
been updated to skip operations on unsafe file types if the sysctl is
zero.

Currently, AIO requests on sockets and raw disks are considered safe
and are enabled by default.  aio_mlock() is also enabled by default.

Reviewed by:	cem, jilles
Discussed with:	kib (earlier version)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D5289
2016-03-01 18:12:14 +00:00
..
amd64 Bump VM_MAX_MEMSEGS from 2 to 3 to match the number of VM segment 2016-02-26 16:18:47 +00:00
arm Remove taskqueue_enqueue_fast(). 2016-03-01 17:47:32 +00:00
arm64 Get memory ranges from FDT if no EFI API is available on ARM64 2016-03-01 12:50:24 +00:00
boot userboot: use MK_CTF=no to disable CTF 2016-02-29 17:54:55 +00:00
bsm Merge from contrib/openbsm to bring the kernel audit bits up to date with OpenBSM 1.2 alpha 4: 2015-12-20 23:22:04 +00:00
cam Remove a stray else. It isn't needed (due to the return at the end of 2016-02-18 15:12:52 +00:00
cddl Removed unused label and fix mutex_exit order 2016-02-25 03:01:24 +00:00
compat Improve error handling for posix_fallocate(2) and posix_fadvise(2). 2016-02-25 19:58:23 +00:00
conf Refactor the AIO subsystem to permit file-type-specific handling and 2016-03-01 18:12:14 +00:00
contrib Add support for the Freescale dTSEC DPAA-based ethernet controller. 2016-02-29 03:38:00 +00:00
crypto Break up opencrypto/xform.c so it can be reused piecemeal 2015-12-30 22:43:07 +00:00
ddb Add helper to catch single step debug event and distinguish it from bkpt 2015-11-27 19:03:59 +00:00
dev Remove taskqueue_enqueue_fast(). 2016-03-01 17:47:32 +00:00
fs Ext2: cleanup setting of ctime/mtime/birthtime. 2016-02-19 15:53:08 +00:00
gdb
geom Fixes to make it compile under gcc-4.2. 2016-02-24 02:52:49 +00:00
gnu Update our copy of the Linux dts files to be in sync with Linux 4.5-rc1. We 2016-02-09 16:42:32 +00:00
i386 Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere(). 2016-02-27 03:38:01 +00:00
isa Replace several bus_alloc_resource() calls using default arguments with bus_alloc_resource_any() 2016-02-19 03:37:56 +00:00
kern Refactor the AIO subsystem to permit file-type-specific handling and 2016-03-01 18:12:14 +00:00
kgssapi kcrypto_aes: Use separate sessions for AES and SHA1 2016-02-02 00:14:51 +00:00
libkern
mips Make the memory size returned from fdt_get_mem_regions a 64-bit type. This 2016-03-01 11:39:07 +00:00
modules Refactor the AIO subsystem to permit file-type-specific handling and 2016-03-01 18:12:14 +00:00
net buf_ring/drbr: Add buf_ring_peek_clear_sc and use it in drbr_peek 2016-02-29 03:54:51 +00:00
net80211 net80211: eliminate copy-paste nearby ieee80211_check_rxseq() 2016-03-01 06:47:21 +00:00
netgraph Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere(). 2016-02-27 03:38:01 +00:00
netinet Fix build after r29592. 2016-02-23 21:21:47 +00:00
netinet6 New way to manage reference counting of mbuf external storage. 2016-03-01 00:17:14 +00:00
netipsec Fix useless check. m_pkthdr.len should be equal to orglen. 2016-02-24 12:28:49 +00:00
netnatm
netpfil Remove taskqueue_enqueue_fast(). 2016-03-01 17:47:32 +00:00
netsmb The problem report was for a crash that happened when smbfs was 2015-11-18 23:04:01 +00:00
nfs MFP r287070,r287073: split radix implementation and route table structure. 2016-01-25 06:33:15 +00:00
nfsclient
nfsserver
nlm
ofed LinuxKPI list updates: 2016-01-26 15:12:31 +00:00
opencrypto Break up opencrypto/xform.c so it can be reused piecemeal 2015-12-30 22:43:07 +00:00
pc98 Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere(). 2016-02-27 03:38:01 +00:00
powerpc Add another compatibility check for QorIQ GPIO driver. 2016-03-01 03:41:48 +00:00
riscv Make the fdt_get_mem_regions memsize argument optional. It's only used in 2016-03-01 09:45:27 +00:00
rpc These files were getting sys/malloc.h and vm/uma.h with header pollution 2016-02-01 17:41:21 +00:00
security Busy the mount point which is the owner of the audit vnode, around 2016-01-16 10:06:33 +00:00
sparc64 Correct the memory rman ranges to be to BUS_SPACE_MAXADDR 2016-03-01 02:59:06 +00:00
sys Refactor the AIO subsystem to permit file-type-specific handling and 2016-03-01 18:12:14 +00:00
teken
tests
tools Fix MFS builds when both MD_ROOT_SIZE and MFS_IMAGE are specified 2016-02-02 07:02:51 +00:00
ufs The UFS filesystem requires that the last block of a file always be 2016-02-24 01:58:40 +00:00
vm Remove UMA_ZONE_REFCNT feature, now unused. 2016-03-01 00:33:32 +00:00
x86 Remove taskqueue_enqueue_fast(). 2016-03-01 17:47:32 +00:00
xdr
xen xenbus: add a comment with the names of the generated accessors 2016-01-15 14:34:31 +00:00
Makefile Add riscv to the list of architectures for cscope. 2016-02-29 16:39:27 +00:00