Sophie

Sophie

distrib > CentOS > 6 > i386 > by-pkgid > 2c51d8eb79f8810ada971ee8c30ce1e5 > files > 1316

kernel-doc-2.6.32-71.14.1.el6.noarch.rpm

<?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>mpage_readpages</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Linux Filesystems API" /><link rel="up" href="ch01s06.html" title="Other Functions" /><link rel="prev" href="ch01s06.html" title="Other Functions" /><link rel="next" href="re73.html" title="mpage_writepages" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span>mpage_readpages</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch01s06.html">Prev</a>&#160;</td><th width="60%" align="center">Other Functions</th><td width="20%" align="right">&#160;<a accesskey="n" href="re73.html">Next</a></td></tr></table><hr /></div><div class="refentry" title="mpage_readpages"><a id="API-mpage-readpages"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>mpage_readpages &#8212; 
  populate an address space with some pages &amp; start reads against them
 </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">int <b class="fsfunc">mpage_readpages </b>(</code></td><td>struct address_space * <var class="pdparam">mapping</var>, </td></tr><tr><td>&#160;</td><td>struct list_head * <var class="pdparam">pages</var>, </td></tr><tr><td>&#160;</td><td>unsigned <var class="pdparam">nr_pages</var>, </td></tr><tr><td>&#160;</td><td>get_block_t <var class="pdparam">get_block</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1" title="Arguments"><a id="id3107022"></a><h2>Arguments</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>mapping</code></em></span></dt><dd><p>
     the address_space
    </p></dd><dt><span class="term"><em class="parameter"><code>pages</code></em></span></dt><dd><p>
     The address of a list_head which contains the target pages.  These
     pages have their -&gt;index populated and are otherwise uninitialised.
     The page at <em class="parameter"><code>pages</code></em>-&gt;prev has the lowest file offset, and reads should be
     issued in <em class="parameter"><code>pages</code></em>-&gt;prev to <em class="parameter"><code>pages</code></em>-&gt;next order.
    </p></dd><dt><span class="term"><em class="parameter"><code>nr_pages</code></em></span></dt><dd><p>
     The number of pages at *<em class="parameter"><code>pages</code></em>
    </p></dd><dt><span class="term"><em class="parameter"><code>get_block</code></em></span></dt><dd><p>
     The filesystem's block mapper function.
    </p></dd></dl></div></div><div class="refsect1" title="Description"><a id="id3107125"></a><h2>Description</h2><p>
   This function walks the pages and the blocks within each page, building and
   emitting large BIOs.
   </p><p>

   If anything unusual happens, such as:
   </p><p>

   - encountering a page which has buffers
   - encountering a page which has a non-hole after a hole
   - encountering a page with non-contiguous blocks
   </p><p>

   then this code just gives up and calls the buffer_head-based read function.
   It does handle a page which has holes at the end - that is a common case:
   the end-of-file on blocksize &lt; PAGE_CACHE_SIZE setups.
</p></div><div class="refsect1" title="BH_Boundary explanation"><a id="id3107153"></a><h2>BH_Boundary explanation</h2><p>
   </p><p>

   There is a problem.  The mpage read code assembles several pages, gets all
   their disk mappings, and then submits them all.  That's fine, but obtaining
   the disk mappings may require I/O.  Reads of indirect blocks, for example.
   </p><p>

   So an mpage read of the first 16 blocks of an ext2 file will cause I/O to be
</p></div><div class="refsect1" title="submitted in the following order"><a id="id3107173"></a><h2>submitted in the following order</h2><p>
   12 0 1 2 3 4 5 6 7 8 9 10 11 13 14 15 16
   </p><p>

   because the indirect block has to be read to get the mappings of blocks
   13,14,15,16.  Obviously, this impacts performance.
   </p><p>

   So what we do it to allow the filesystem's <code class="function">get_block</code> function to set
   BH_Boundary when it maps block 11.  BH_Boundary says: mapping of the block
   after this one will require I/O against a block which is probably close to
   this one.  So you should push what I/O you have currently accumulated.
   </p><p>

   This all causes the disk requests to be issued in the correct order.
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch01s06.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch01s06.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="re73.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Other Functions&#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>mpage_writepages</span></td></tr></table></div></body></html>