<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>blk_make_request</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="The Linux Kernel API" /><link rel="up" href="blkdev.html" title="Chapter 14. Block Devices" /><link rel="prev" href="API-blk-init-queue.html" title="blk_init_queue" /><link rel="next" href="API-blk-requeue-request.html" title="blk_requeue_request" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>blk_make_request</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-blk-init-queue.html">Prev</a> </td><th width="60%" align="center">Chapter 14. Block Devices</th><td width="20%" align="right"> <a accesskey="n" href="API-blk-requeue-request.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="blk_make_request"><a id="API-blk-make-request"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>blk_make_request — given a bio, allocate a corresponding struct request. </p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" class="funcprototype-table"><tr><td><code class="funcdef">struct request * <strong>fsfuncblk_make_request </strong>(</code></td><td>struct request_queue * <var class="pdparam">q</var>, </td></tr><tr><td> </td><td>struct bio * <var class="pdparam">bio</var>, </td></tr><tr><td> </td><td>gfp_t <var class="pdparam">gfp_mask</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1" title="Arguments"><a id="id2656353"></a><h2>Arguments</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>q</code></em></span></dt><dd><p> target request queue </p></dd><dt><span class="term"><em class="parameter"><code>bio</code></em></span></dt><dd><p> The bio describing the memory mappings that will be submitted for IO. It may be a chained-bio properly constructed by block/bio layer. </p></dd><dt><span class="term"><em class="parameter"><code>gfp_mask</code></em></span></dt><dd><p> gfp flags to be used for memory allocation </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id2656416"></a><h2>Description</h2><p> 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 <span class="structname">struct bio</span>, which describes the memory info of the I/O transfer. </p><p> The caller of blk_make_request must make sure that bi_io_vec are set to describe the memory buffers. That <code class="function">bio_data_dir</code> will return the needed direction of the request. (And all bio's in the passed bio-chain are properly set accordingly) </p><p> 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. </p></div><div class="refsect1" title="WARNING"><a id="id2656452"></a><h2>WARNING</h2><p> 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't been submitted yet, thus resulting in a deadlock. Alternatively bios should be allocated using <code class="function">bio_kmalloc</code> instead of <code class="function">bio_alloc</code>, 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. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-blk-init-queue.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="blkdev.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-blk-requeue-request.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>blk_init_queue</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span>blk_requeue_request</span></td></tr></table></div></body></html>