<?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>get_request</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-attempt-plug-merge.html" title="attempt_plug_merge" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">get_request</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-attempt-plug-merge.html">Next</a></td></tr></table><hr /></div><div class="refentry"><a id="API-get-request"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>get_request — get a free request </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">struct request * <strong class="fsfunc">get_request </strong>(</code></td><td>struct request_queue * <var class="pdparam">q</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">rw_flags</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"><a id="idm139749891996400"></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> request_queue to allocate request from </p></dd><dt><span class="term"><em class="parameter"><code>rw_flags</code></em></span></dt><dd><p> RW and SYNC flags </p></dd><dt><span class="term"><em class="parameter"><code>bio</code></em></span></dt><dd><p> bio to allocate request for (can be <code class="constant">NULL</code>) </p></dd><dt><span class="term"><em class="parameter"><code>gfp_mask</code></em></span></dt><dd><p> allocation mask </p></dd></dl></div></div><div class="refsect1"><a id="idm139749891986736"></a><h2>Description</h2><p> Get a free request from <em class="parameter"><code>q</code></em>. If <code class="constant">__GFP_WAIT</code> is set in <em class="parameter"><code>gfp_mask</code></em>, this function keeps retrying under memory pressure and fails iff <em class="parameter"><code>q</code></em> is dead. </p><p> Must be callled with <em class="parameter"><code>q</code></em>->queue_lock held and, Returns <code class="constant">NULL</code> on failure, with <em class="parameter"><code>q</code></em>->queue_lock held. Returns !<code class="constant">NULL</code> on success, with <em class="parameter"><code>q</code></em>->queue_lock *not held*. </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-attempt-plug-merge.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">attempt_plug_merge</span></td></tr></table></div></body></html>