1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>blk_attempt_plug_merge</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 14. Block Devices"><link rel="prev" href="API-get-request.html" title="get_request"><link rel="next" href="API-blk-end-bidi-request.html" title="blk_end_bidi_request"></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_attempt_plug_merge</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-get-request.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-end-bidi-request.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-blk-attempt-plug-merge"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>blk_attempt_plug_merge — 2 try to merge with <code class="constant">current</code>'s plugged list 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">bool <b class="fsfunc">blk_attempt_plug_merge </b>(</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>unsigned int * <var class="pdparam">request_count</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1128252676"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>q</code></em></span></dt><dd><p> 4 request_queue new bio is being queued at 5 </p></dd><dt><span class="term"><em class="parameter"><code>bio</code></em></span></dt><dd><p> 6 new bio being queued 7 </p></dd><dt><span class="term"><em class="parameter"><code>request_count</code></em></span></dt><dd><p> 8 out parameter for number of traversed plugged requests 9 </p></dd></dl></div></div><div class="refsect1"><a name="idp1128256364"></a><h2>Description</h2><p> 10 Determine whether <em class="parameter"><code>bio</code></em> being queued on <em class="parameter"><code>q</code></em> can be merged with a request 11 on <code class="constant">current</code>'s plugged list. Returns <code class="constant">true</code> if merge was successful, 12 otherwise <code class="constant">false</code>. 13 </p><p> 14 15 Plugging coalesces IOs from the same issuer for the same purpose without 16 going through <em class="parameter"><code>q</code></em>->queue_lock. As such it's more of an issuing mechanism 17 than scheduling, and the request, while may have elvpriv data, is not 18 added on the elevator at this point. In addition, we don't have 19 reliable access to the elevator outside queue lock. Only check basic 20 merging parameters without querying the elevator. 21 </p><p> 22 23 Caller must ensure !blk_queue_nomerges(q) beforehand. 24</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-get-request.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-end-bidi-request.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">get_request</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">blk_end_bidi_request</span></td></tr></table></div></body></html> 25