'\" t .\" Title: blk_queue_dma_drain .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: January 2017 .\" Manual: Block Devices .\" Source: Kernel Hackers Manual 4.8.15 .\" Language: English .\" .TH "BLK_QUEUE_DMA_DRAIN" "9" "January 2017" "Kernel Hackers Manual 4\&.8\&." "Block Devices" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" blk_queue_dma_drain \- Set up a drain buffer for excess dma\&. .SH "SYNOPSIS" .HP \w'int\ blk_queue_dma_drain('u .BI "int blk_queue_dma_drain(struct\ request_queue\ *\ " "q" ", dma_drain_needed_fn\ *\ " "dma_drain_needed" ", void\ *\ " "buf" ", unsigned\ int\ " "size" ");" .SH "ARGUMENTS" .PP \fIq\fR .RS 4 the request queue for the device .RE .PP \fIdma_drain_needed\fR .RS 4 fn which returns non\-zero if drain is necessary .RE .PP \fIbuf\fR .RS 4 physically contiguous buffer .RE .PP \fIsize\fR .RS 4 size of the buffer in bytes .RE .SH "DESCRIPTION" .PP Some devices have excess DMA problems and can\*(Aqt simply discard (or zero fill) the unwanted piece of the transfer\&. They have to have a real area of memory to transfer it into\&. The use case for this is ATAPI devices in DMA mode\&. If the packet command causes a transfer bigger than the transfer size some HBAs will lock up if there aren\*(Aqt DMA elements to contain the excess transfer\&. What this API does is adjust the queue so that the buf is always appended silently to the scatterlist\&. .SH "NOTE" .PP This routine adjusts max_hw_segments to make room for appending the drain buffer\&. If you call \fBblk_queue_max_segments\fR after calling this routine, you must set the limit to one fewer than your device can support otherwise there won\*(Aqt be room for the drain buffer\&. .SH "COPYRIGHT" .br