1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>blk_rq_prep_clone</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux Kernel API"><link rel="up" href="blkdev.html" title="Chapter&#160;14.&#160;Block Devices"><link rel="prev" href="API-blk-rq-unprep-clone.html" title="blk_rq_unprep_clone"><link rel="next" href="API-blk-start-plug.html" title="blk_start_plug"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">blk_rq_prep_clone</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-blk-rq-unprep-clone.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;14.&#160;Block Devices</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-blk-start-plug.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-blk-rq-prep-clone"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>blk_rq_prep_clone &#8212; 
2     Helper function to setup clone request
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">blk_rq_prep_clone </b>(</code></td><td>struct request * <var class="pdparam">rq</var>, </td></tr><tr><td>&#160;</td><td>struct request * <var class="pdparam">rq_src</var>, </td></tr><tr><td>&#160;</td><td>struct bio_set * <var class="pdparam">bs</var>, </td></tr><tr><td>&#160;</td><td>gfp_t <var class="pdparam">gfp_mask</var>, </td></tr><tr><td>&#160;</td><td>int (*<var class="pdparam">bio_ctr</var>)
4     <code>(</code>struct bio *, struct bio *, void *<code>)</code>, </td></tr><tr><td>&#160;</td><td>void * <var class="pdparam">data</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1128128852"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>rq</code></em></span></dt><dd><p>
5     the request to be setup
6    </p></dd><dt><span class="term"><em class="parameter"><code>rq_src</code></em></span></dt><dd><p>
7     original request to be cloned
8    </p></dd><dt><span class="term"><em class="parameter"><code>bs</code></em></span></dt><dd><p>
9     bio_set that bios for clone are allocated from
10    </p></dd><dt><span class="term"><em class="parameter"><code>gfp_mask</code></em></span></dt><dd><p>
11     memory allocation mask for bio
12    </p></dd><dt><span class="term"><em class="parameter"><code>bio_ctr</code></em></span></dt><dd><p>
13     setup function to be called for each clone bio.
14     Returns <code class="constant">0</code> for success, non <code class="constant">0</code> for failure.
15    </p></dd><dt><span class="term"><em class="parameter"><code>data</code></em></span></dt><dd><p>
16     private data to be passed to <em class="parameter"><code>bio_ctr</code></em>
17    </p></dd></dl></div></div><div class="refsect1"><a name="idp1128136404"></a><h2>Description</h2><p>
18   Clones bios in <em class="parameter"><code>rq_src</code></em> to <em class="parameter"><code>rq</code></em>, and copies attributes of <em class="parameter"><code>rq_src</code></em> to <em class="parameter"><code>rq</code></em>.
19   The actual data parts of <em class="parameter"><code>rq_src</code></em> (e.g. -&gt;cmd, -&gt;sense)
20   are not copied, and copying such parts is the caller's responsibility.
21   Also, pages which the original bios are pointing to are not copied
22   and the cloned bios just point same pages.
23   So cloned bios must be completed before original bios, which means
24   the caller must complete <em class="parameter"><code>rq</code></em> before <em class="parameter"><code>rq_src</code></em>.
25</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-rq-unprep-clone.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="blkdev.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-blk-start-plug.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">blk_rq_unprep_clone</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">blk_start_plug</span></td></tr></table></div></body></html>
26