1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>pagecache_get_page</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="ch04s03.html" title="More Memory Management Functions"><link rel="prev" href="API-find-lock-entry.html" title="find_lock_entry"><link rel="next" href="API-find-get-pages-contig.html" title="find_get_pages_contig"></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">pagecache_get_page</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-find-lock-entry.html">Prev</a>&#160;</td><th width="60%" align="center">More Memory Management Functions</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-find-get-pages-contig.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-pagecache-get-page"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>pagecache_get_page &#8212; 
2     find and get a page reference
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">struct page * <b class="fsfunc">pagecache_get_page </b>(</code></td><td>struct address_space * <var class="pdparam">mapping</var>, </td></tr><tr><td>&#160;</td><td>pgoff_t <var class="pdparam">offset</var>, </td></tr><tr><td>&#160;</td><td>int <var class="pdparam">fgp_flags</var>, </td></tr><tr><td>&#160;</td><td>gfp_t <var class="pdparam">gfp_mask</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1124152044"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>mapping</code></em></span></dt><dd><p>
4     the address_space to search
5    </p></dd><dt><span class="term"><em class="parameter"><code>offset</code></em></span></dt><dd><p>
6     the page index
7    </p></dd><dt><span class="term"><em class="parameter"><code>fgp_flags</code></em></span></dt><dd><p>
8     PCG flags
9    </p></dd><dt><span class="term"><em class="parameter"><code>gfp_mask</code></em></span></dt><dd><p>
10     gfp mask to use for the page cache data page allocation
11    </p></dd></dl></div></div><div class="refsect1"><a name="idp1124156756"></a><h2>Description</h2><p>
12   Looks up the page cache slot at <em class="parameter"><code>mapping</code></em> &amp; <em class="parameter"><code>offset</code></em>.
13   </p><p>
14
15   PCG flags modify how the page is returned.
16</p></div><div class="refsect1"><a name="idp1124158300"></a><h2>FGP_ACCESSED</h2><p>
17   the page will be marked accessed
18</p></div><div class="refsect1"><a name="idp1124158948"></a><h2>FGP_LOCK</h2><p>
19   Page is return locked
20</p></div><div class="refsect1"><a name="idp1124159572"></a><h2>FGP_CREAT</h2><p>
21   If page is not present then a new page is allocated using
22   <em class="parameter"><code>gfp_mask</code></em> and added to the page cache and the VM's LRU
23   list. The page is returned locked and with an increased
24   refcount. Otherwise, <code class="constant">NULL</code> is returned.
25   </p><p>
26
27   If FGP_LOCK or FGP_CREAT are specified then the function may sleep even
28   if the GFP flags specified for FGP_CREAT are atomic.
29   </p><p>
30
31   If there is a page cache page, it is returned with an increased refcount.
32</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-find-lock-entry.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch04s03.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-find-get-pages-contig.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">find_lock_entry</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">find_get_pages_contig</span></td></tr></table></div></body></html>
33