freebsd-skq/sys
ken 281a193b53 Add support to physio(9) for devices that don't want I/O split and
configure sa(4) to request no I/O splitting by default.

For tape devices, the user needs to be able to clearly understand
what blocksize is actually being used when writing to a tape
device.  The previous behavior of physio(9) was that it would split
up any I/O that was too large for the device, or too large to fit
into MAXPHYS.  This means that if, for instance, the user wrote a
1MB block to a tape device, and MAXPHYS was 128KB, the 1MB write
would be split into 8 128K chunks.  This would be done without
informing the user.

This has suboptimal effects, especially when trying to communicate
status to the user.  In the event of an error writing to a tape
(e.g. physical end of tape) in the middle of a 1MB block that has
been split into 8 pieces, the user could have the first two 128K
pieces written successfully, the third returned with an error, and
the last 5 returned with 0 bytes written.  If the user is using
a standard write(2) system call, all he will see is the ENOSPC
error.  He won't have a clue how much actually got written.  (With
a writev(2) system call, he should be able to determine how much
got written in addition to the error.)

The solution is to prevent physio(9) from splitting the I/O.  The
new cdev flag, SI_NOSPLIT, tells physio that the driver does not
want I/O to be split beforehand.

Although the sa(4) driver now enables SI_NOSPLIT by default,
that can be disabled by two loader tunables for now.  It will not
be configurable starting in FreeBSD 11.0.  kern.cam.sa.allow_io_split
allows the user to configure I/O splitting for all sa(4) driver
instances.  kern.cam.sa.%d.allow_io_split allows the user to
configure I/O splitting for a specific sa(4) instance.

There are also now three sa(4) driver sysctl variables that let the
users see some sa(4) driver values.  kern.cam.sa.%d.allow_io_split
shows whether I/O splitting is turned on.  kern.cam.sa.%d.maxio shows
the maximum I/O size allowed by kernel configuration parameters
(e.g. MAXPHYS, DFLTPHYS) and the capabilities of the controller.
kern.cam.sa.%d.cpi_maxio shows the maximum I/O size supported by
the controller.

Note that a better long term solution would be to implement support
for chaining buffers, so that that MAXPHYS is no longer a limiting
factor for I/O size to tape and disk devices.  At that point, the
controller and the tape drive would become the limiting factors.

sys/conf.h:	Add a new cdev flag, SI_NOSPLIT, that allows a
		driver to tell physio not to split up I/O.

sys/param.h:	Bump __FreeBSD_version to 1000049 for the addition
		of the SI_NOSPLIT cdev flag.

kern_physio.c:	If the SI_NOSPLIT flag is set on the cdev, return
		any I/O that is larger than si_iosize_max or
		MAXPHYS, has more than one segment, or would have
		to be split because of misalignment with EFBIG.
		(File too large).

		In the event of an error, print a console message to
		give the user a clue about what happened.

scsi_sa.c:	Set the SI_NOSPLIT cdev flag on the devices created
		for the sa(4) driver by default.

		Add tunables to control whether we allow I/O splitting
		in physio(9).

		Explain in the comments that allowing I/O splitting
		will be deprecated for the sa(4) driver in FreeBSD
		11.0.

		Add sysctl variables to display the maximum I/O
		size we can do (which could be further limited by
		read block limits) and the maximum I/O size that
		the controller can do.

		Limit our maximum I/O size (recorded in the cdev's
		si_iosize_max) by MAXPHYS.  This isn't strictly
		necessary, because physio(9) will limit it to
		MAXPHYS, but it will provide some clarity for the
		application.

		Record the controller's maximum I/O size reported
		in the Path Inquiry CCB.

sa.4:		Document the block size behavior, and explain that
		the option of allowing physio(9) to split the I/O
		will disappear in FreeBSD 11.0.

Sponsored by:	Spectra Logic
2013-08-24 04:52:22 +00:00
..
amd64 Revert r254501. Instead, reuse the type stability of the struct pmap 2013-08-22 18:12:24 +00:00
arm Revert r254501. Instead, reuse the type stability of the struct pmap 2013-08-22 18:12:24 +00:00
boot Set the hint for physical address of RSDP in hexadecimal as before r223262. 2013-08-23 18:52:36 +00:00
bsm Implement chflagsat(2) system call, similar to fchmodat(2), but operates on 2013-03-21 22:59:01 +00:00
cam Add support to physio(9) for devices that don't want I/O split and 2013-08-24 04:52:22 +00:00
cddl MFV r254749: 2013-08-24 00:42:37 +00:00
compat Regenerate after r254491. 2013-08-18 13:38:39 +00:00
conf Add vmx(4), a VMware VMXNET3 ethernet driver ported from OpenBSD 2013-08-23 20:47:16 +00:00
contrib Merge ACPICA 20130823. 2013-08-23 23:25:58 +00:00
crypto Fix const propagation issues to make GCC happy. 2013-07-11 16:27:11 +00:00
ddb
dev Hold mfi_io_lock across calls to xpt_rescan() and xpt_alloc_ccb_nowait(). 2013-08-23 22:55:52 +00:00
fs Allow tmpfs be mounted inside jail. 2013-08-23 22:52:20 +00:00
gdb rename scheduler->swapper and SI_SUB_RUN_SCHEDULER->SI_SUB_LAST 2013-07-24 09:45:31 +00:00
geom Change the way that unmapped I/O capability is advertised. 2013-08-15 22:52:39 +00:00
gnu/fs/reiserfs Garbage collect XFS bits which are now already completely disconnected 2013-03-02 15:33:54 +00:00
i386 Rename definition of HYPERVISOR_VIRT_START to avoid conflict with 2013-08-22 20:07:06 +00:00
ia64 Revert r254501. Instead, reuse the type stability of the struct pmap 2013-08-22 18:12:24 +00:00
isa
kern Add support to physio(9) for devices that don't want I/O split and 2013-08-24 04:52:22 +00:00
kgssapi Add support for host-based (Kerberos 5 service principal) initiator 2013-07-09 01:05:28 +00:00
libkern Fix watchdog pretimeout. 2013-07-27 20:47:01 +00:00
mips Some vendors store the mac addresses of arge(4) as a literal sring in the 2013-08-23 13:14:18 +00:00
modules Add vmx(4), a VMware VMXNET3 ethernet driver ported from OpenBSD 2013-08-23 20:47:16 +00:00
net After r241616 properly export ifi_baudrate_pf in the 32bit compat case. 2013-08-20 14:35:17 +00:00
net80211 Add in some backwards compatability hacks to make -HEAD net80211 compile 2013-08-22 05:53:47 +00:00
netatalk Add const qualifier to the dst parameter of the ifnet if_output method. 2013-04-26 12:50:32 +00:00
netgraph Add constant for PPP-Max-PayLoad tag. 2013-07-23 10:25:34 +00:00
netinet Export the inpcb features as a 64-bit entity. 2013-08-22 20:29:57 +00:00
netinet6 Fix an integer overflow in computing the size of a temporary buffer 2013-08-22 00:51:37 +00:00
netipsec Remove the large part of struct ipsecstat. Only few fields of this 2013-07-23 14:14:24 +00:00
netipx
netnatm
netpfil Add m_clrprotoflags() to clear protocol specific mbuf flags at up and 2013-08-19 13:27:32 +00:00
netsmb Remove a reference to LK_DRAIN now that lockmgr(9) is gone from this 2013-06-28 20:21:13 +00:00
nfs Changes to allow using BOOTP_NFSROOT and mounting an nfs root filesystem 2013-07-31 19:14:00 +00:00
nfsclient A problem with the old NFS client where large writes to large files 2013-07-04 00:54:23 +00:00
nfsserver - Convert the bufobj lock to rwlock. 2013-05-31 00:43:41 +00:00
nlm
ofed Fix implementation of sock_getname. 2013-08-23 18:54:27 +00:00
opencrypto Make sendfile() a method in the struct fileops. Currently only 2013-08-15 07:54:31 +00:00
pc98 MFi386: r254619 2013-08-22 16:39:59 +00:00
pci Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI 2013-08-12 23:30:01 +00:00
powerpc Return EIO iso -1, the kiic_transfer has an signed return. 2013-08-23 20:39:41 +00:00
rpc Add support for host-based (Kerberos 5 service principal) initiator 2013-07-09 01:05:28 +00:00
security Implement read(2)/write(2) and neccessary lseek(2) for posix shmfd. 2013-08-21 17:45:00 +00:00
sparc64 Revert r254501. Instead, reuse the type stability of the struct pmap 2013-08-22 18:12:24 +00:00
sys Add support to physio(9) for devices that don't want I/O split and 2013-08-24 04:52:22 +00:00
teken
tools MFC 2013-02-21 21:59:35 +00:00
ufs Expand the use of stat(2) flags to allow storing some Windows/DOS 2013-08-21 23:04:48 +00:00
vm Addendum to r254141: The call to vm_radix_insert() in vm_page_cache() can 2013-08-23 17:27:12 +00:00
x86 Call set_i8254_freq with MODE_STOP (0) rather than a magic number of 0. 2013-08-15 17:21:06 +00:00
xdr Use m_get() and m_getcl() instead of compat macros. 2013-03-15 10:21:18 +00:00
xen Replace kernel virtual address space allocation with vmem. This provides 2013-08-07 06:21:20 +00:00
Makefile MFC 2013-03-13 01:05:42 +00:00