<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/xfs/xfs_buf.c, branch linux-3.2.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.2.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.2.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2012-12-06T11:20:25Z</updated>
<entry>
<title>xfs: drop buffer io reference when a bad bio is built</title>
<updated>2012-12-06T11:20:25Z</updated>
<author>
<name>Dave Chinner</name>
</author>
<published>2012-11-12T11:09:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f72ba897949f861cc95267c215ec4f8b5e9d6599'/>
<id>urn:sha1:f72ba897949f861cc95267c215ec4f8b5e9d6599</id>
<content type='text'>
commit d69043c42d8c6414fa28ad18d99973aa6c1c2e24 upstream.

Error handling in xfs_buf_ioapply_map() does not handle IO reference
counts correctly. We increment the b_io_remaining count before
building the bio, but then fail to decrement it in the failure case.
This leads to the buffer never running IO completion and releasing
the reference that the IO holds, so at unmount we can leak the
buffer. This leak is captured by this assert failure during unmount:

XFS: Assertion failed: atomic_read(&amp;pag-&gt;pag_ref) == 0, file: fs/xfs/xfs_mount.c, line: 273

This is not a new bug - the b_io_remaining accounting has had this
problem for a long, long time - it's just very hard to get a
zero length bio being built by this code...

Further, the buffer IO error can be overwritten on a multi-segment
buffer by subsequent bio completions for partial sections of the
buffer. Hence we should only set the buffer error status if the
buffer is not already carrying an error status. This ensures that a
partial IO error on a multi-segment buffer will not be lost. This
part of the problem is a regression, however.

Signed-off-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Reviewed-by: Mark Tinguely &lt;tinguely@sgi.com&gt;
Signed-off-by: Ben Myers &lt;bpm@sgi.com&gt;
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>xfs: do not flush data workqueues in xfs_flush_buftarg</title>
<updated>2011-10-12T03:34:31Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2011-10-10T16:52:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5a93a064d27b42e4af1772b0599b53e3241191ac'/>
<id>urn:sha1:5a93a064d27b42e4af1772b0599b53e3241191ac</id>
<content type='text'>
When we call xfs_flush_buftarg (generally from sync or umount) it already
is too late to flush the data workqueues, as I/O completion is signalled
for them and we are thus already done with the data we would flush here.

There are places where flushing them might be useful, but the current
sync interface doesn't give us that opportunity.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Alex Elder &lt;aelder@sgi.com&gt;
</content>
</entry>
<entry>
<title>xfs: remove xfs_buf_target_name</title>
<updated>2011-10-12T02:15:11Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2011-10-10T16:52:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=02b102df1502a7ea4167d115510e1e8fe6467f12'/>
<id>urn:sha1:02b102df1502a7ea4167d115510e1e8fe6467f12</id>
<content type='text'>
The calling convention that returns a pointer to a static buffer is
fairly nasty, so just opencode it in the only caller that is left.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Alex Elder &lt;aelder@sgi.com&gt;


</content>
</entry>
<entry>
<title>xfs: clean up xfs_ioerror_alert</title>
<updated>2011-10-12T02:15:10Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2011-10-10T16:52:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=901796afca0d31d97bf6d1bf2ab251a93a4b8c83'/>
<id>urn:sha1:901796afca0d31d97bf6d1bf2ab251a93a4b8c83</id>
<content type='text'>
Instead of passing the block number and mount structure explicitly
get them off the bp and fix make the argument order more natural.

Also move it to xfs_buf.c and stop printing the device name given
that we already get the fs name as part of xfs_alert, and we know
what device is operates on because of the caller that gets printed,
finally rename it to xfs_buf_ioerror_alert and pass __func__ as
argument where it makes sense.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Alex Elder &lt;aelder@sgi.com&gt;


</content>
</entry>
<entry>
<title>xfs: clean up buffer allocation</title>
<updated>2011-10-12T02:15:10Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2011-10-10T16:52:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4347b9d7ad4223474d315c3ab6bc1ce7cce7fa2d'/>
<id>urn:sha1:4347b9d7ad4223474d315c3ab6bc1ce7cce7fa2d</id>
<content type='text'>
Change _xfs_buf_initialize to allocate the buffer directly and rename it to
xfs_buf_alloc now that is the only buffer allocation routine.  Also remove
the xfs_buf_deallocate wrapper around the kmem_zone_free calls for buffers.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Alex Elder &lt;aelder@sgi.com&gt;


</content>
</entry>
<entry>
<title>xfs: remove buffers from the delwri list in xfs_buf_stale</title>
<updated>2011-10-12T02:15:10Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2011-10-10T16:52:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=af5c4bee499eb68bc36ca046030394d82d0e3669'/>
<id>urn:sha1:af5c4bee499eb68bc36ca046030394d82d0e3669</id>
<content type='text'>
For each call to xfs_buf_stale we call xfs_buf_delwri_dequeue either
directly before or after it, or are guaranteed by the surrounding
conditionals that we are never called on delwri buffers.  Simply
this situation by moving the call to xfs_buf_delwri_dequeue into
xfs_buf_stale.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Alex Elder &lt;aelder@sgi.com&gt;


</content>
</entry>
<entry>
<title>xfs: remove XFS_BUF_STALE and XFS_BUF_SUPER_STALE</title>
<updated>2011-10-12T02:15:10Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2011-10-10T16:52:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c867cb61641751fd3d86350232d64ae2a10137d4'/>
<id>urn:sha1:c867cb61641751fd3d86350232d64ae2a10137d4</id>
<content type='text'>
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Alex Elder &lt;aelder@sgi.com&gt;


</content>
</entry>
<entry>
<title>xfs: remove XFS_BUF_FINISH_IOWAIT</title>
<updated>2011-10-12T02:15:09Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2011-10-10T16:52:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5fde0326ddb1472ef31034c8ed952a19d4679191'/>
<id>urn:sha1:5fde0326ddb1472ef31034c8ed952a19d4679191</id>
<content type='text'>
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Alex Elder &lt;aelder@sgi.com&gt;


</content>
</entry>
<entry>
<title>xfs: remove xfs_get_buftarg_list</title>
<updated>2011-10-12T02:15:09Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2011-10-10T16:52:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b17b833443a3b65907f5ecb36f8af33996f6ec78'/>
<id>urn:sha1:b17b833443a3b65907f5ecb36f8af33996f6ec78</id>
<content type='text'>
The code is unused and under a config option that doesn't exist, remove it.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Signed-off-by: Alex Elder &lt;aelder@sgi.com&gt;


</content>
</entry>
<entry>
<title>xfs: Don't allocate new buffers on every call to _xfs_buf_find</title>
<updated>2011-10-12T02:15:08Z</updated>
<author>
<name>Dave Chinner</name>
</author>
<published>2011-09-30T04:45:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3815832a2aa4df9815d15dac05227e0c8551833f'/>
<id>urn:sha1:3815832a2aa4df9815d15dac05227e0c8551833f</id>
<content type='text'>
Stats show that for an 8-way unlink @ ~80,000 unlinks/s we are doing
~1 million cache hit lookups to ~3000 buffer creates. That's almost
3 orders of magnitude more cahce hits than misses, so optimising for
cache hits is quite important. In the cache hit case, we do not need
to allocate a new buffer in case of a cache miss, so we are
effectively hitting the allocator for no good reason for vast the
majority of calls to _xfs_buf_find. 8-way create workloads are
showing similar cache hit/miss ratios.

The result is profiles that look like this:

     samples  pcnt function                        DSO
     _______ _____ _______________________________ _________________

     1036.00 10.0% _xfs_buf_find                   [kernel.kallsyms]
      582.00  5.6% kmem_cache_alloc                [kernel.kallsyms]
      519.00  5.0% __memcpy                        [kernel.kallsyms]
      468.00  4.5% __ticket_spin_lock              [kernel.kallsyms]
      388.00  3.7% kmem_cache_free                 [kernel.kallsyms]
      331.00  3.2% xfs_log_commit_cil              [kernel.kallsyms]


Further, there is a fair bit of work involved in initialising a new
buffer once a cache miss has occurred and we currently do that under
the rbtree spinlock. That increases spinlock hold time on what are
heavily used trees.

To fix this, remove the initialisation of the buffer from
_xfs_buf_find() and only allocate the new buffer once we've had a
cache miss. Initialise the buffer immediately after allocating it in
xfs_buf_get, too, so that is it ready for insert if we get another
cache miss after allocation. This minimises lock hold time and
avoids unnecessary allocator churn. The resulting profiles look
like:

     samples  pcnt function                    DSO
     _______ _____ ___________________________ _________________

     8111.00  9.1% _xfs_buf_find               [kernel.kallsyms]
     4380.00  4.9% __memcpy                    [kernel.kallsyms]
     4341.00  4.8% __ticket_spin_lock          [kernel.kallsyms]
     3401.00  3.8% kmem_cache_alloc            [kernel.kallsyms]
     2856.00  3.2% xfs_log_commit_cil          [kernel.kallsyms]
     2625.00  2.9% __kmalloc                   [kernel.kallsyms]
     2380.00  2.7% kfree                       [kernel.kallsyms]
     2016.00  2.3% kmem_cache_free             [kernel.kallsyms]

Showing a significant reduction in time spent doing allocation and
freeing from slabs (kmem_cache_alloc and kmem_cache_free).

Signed-off-by: Dave Chinner &lt;dchinner@redhat.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Alex Elder &lt;aelder@sgi.com&gt;

</content>
</entry>
</feed>
