'\" t .\" Title: blk_make_request .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: May 2018 .\" Manual: Block Devices .\" Source: Kernel Hackers Manual 3.16.56 .\" Language: English .\" .TH "BLK_MAKE_REQUEST" "9" "May 2018" "Kernel Hackers Manual 3\&.16\&" "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_make_request \- given a bio, allocate a corresponding struct request\&. .SH "SYNOPSIS" .HP \w'struct\ request\ *\ blk_make_request('u .BI "struct request * blk_make_request(struct\ request_queue\ *\ " "q" ", struct\ bio\ *\ " "bio" ", gfp_t\ " "gfp_mask" ");" .SH "ARGUMENTS" .PP \fIq\fR .RS 4 target request queue .RE .PP \fIbio\fR .RS 4 The bio describing the memory mappings that will be submitted for IO\&. It may be a chained\-bio properly constructed by block/bio layer\&. .RE .PP \fIgfp_mask\fR .RS 4 gfp flags to be used for memory allocation .RE .SH "DESCRIPTION" .PP blk_make_request is the parallel of generic_make_request for BLOCK_PC type commands\&. Where the struct request needs to be farther initialized by the caller\&. It is passed a struct bio, which describes the memory info of the I/O transfer\&. .PP The caller of blk_make_request must make sure that bi_io_vec are set to describe the memory buffers\&. That \fBbio_data_dir\fR will return the needed direction of the request\&. (And all bio\*(Aqs in the passed bio\-chain are properly set accordingly) .PP If called under none\-sleepable conditions, mapped bio buffers must not need bouncing, by calling the appropriate masked or flagged allocator, suitable for the target device\&. Otherwise the call to blk_queue_bounce will BUG\&. .SH "WARNING" .PP When allocating/cloning a bio\-chain, careful consideration should be given to how you allocate bios\&. In particular, you cannot use __GFP_WAIT for anything but the first bio in the chain\&. Otherwise you risk waiting for IO completion of a bio that hasn\*(Aqt been submitted yet, thus resulting in a deadlock\&. Alternatively bios should be allocated using \fBbio_kmalloc\fR instead of \fBbio_alloc\fR, as that avoids the mempool deadlock\&. If possible a big IO should be split into smaller parts when allocation fails\&. Partial allocation should not be an error, or you risk a live\-lock\&. .SH "COPYRIGHT" .br