1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>journal_try_to_free_buffers</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Filesystems API"><link rel="up" href="functions.html#transaction_level" title="Transasction Level"><link rel="prev" href="API-journal-force-commit.html" title="journal_force_commit"><link rel="next" href="API-journal-invalidatepage.html" title="journal_invalidatepage"></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">journal_try_to_free_buffers</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-journal-force-commit.html">Prev</a>&#160;</td><th width="60%" align="center">Transasction Level</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-journal-invalidatepage.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-journal-try-to-free-buffers"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>journal_try_to_free_buffers &#8212; 
2     try to free page buffers.
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">journal_try_to_free_buffers </b>(</code></td><td>journal_t * <var class="pdparam">journal</var>, </td></tr><tr><td>&#160;</td><td>struct page * <var class="pdparam">page</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="idp1103952908"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>journal</code></em></span></dt><dd><p>
4     journal for operation
5    </p></dd><dt><span class="term"><em class="parameter"><code>page</code></em></span></dt><dd><p>
6     to try and free
7    </p></dd><dt><span class="term"><em class="parameter"><code>gfp_mask</code></em></span></dt><dd><p>
8     we use the mask to detect how hard should we try to release
9     buffers. If __GFP_WAIT and __GFP_FS is set, we wait for commit code to
10     release the buffers.
11    </p></dd></dl></div></div><div class="refsect1"><a name="idp1103956708"></a><h2>Description</h2><p>
12   </p><p>
13
14   For all the buffers on this page,
15   if they are fully written out ordered data, move them onto BUF_CLEAN
16   so <code class="function">try_to_free_buffers</code> can reap them.
17   </p><p>
18
19   This function returns non-zero if we wish <code class="function">try_to_free_buffers</code>
20   to be called. We do this if the page is releasable by <code class="function">try_to_free_buffers</code>.
21   We also do it if the page has locked or dirty buffers and the caller wants
22   us to perform sync or async writeout.
23   </p><p>
24
25   This complicates JBD locking somewhat.  We aren't protected by the
26   BKL here.  We wish to remove the buffer from its committing or
27   running transaction's -&gt;t_datalist via __journal_unfile_buffer.
28   </p><p>
29
30   This may *change* the value of transaction_t-&gt;t_datalist, so anyone
31   who looks at t_datalist needs to lock against this function.
32   </p><p>
33
34   Even worse, someone may be doing a journal_dirty_data on this
35   buffer.  So we need to lock against that.  <code class="function">journal_dirty_data</code>
36   will come out of the lock with the buffer dirty, which makes it
37   ineligible for release here.
38   </p><p>
39
40   Who else is affected by this?  hmm...  Really the only contender
41   is <code class="function">do_get_write_access</code> - it could be looking at the buffer while
42   <code class="function">journal_try_to_free_buffer</code> is changing its state.  But that
43   cannot happen because we never reallocate freed data as metadata
44   while the data is part of a transaction.  Yes?
45   </p><p>
46
47   Return 0 on failure, 1 on success
48</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-journal-force-commit.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="functions.html#transaction_level">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-journal-invalidatepage.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">journal_force_commit</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">journal_invalidatepage</span></td></tr></table></div></body></html>
49