<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/btrfs/extent_map.c, branch linux-4.8.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.8.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.8.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2016-07-26T11:52:25Z</updated>
<entry>
<title>btrfs: Fix slab accounting flags</title>
<updated>2016-07-26T11:52:25Z</updated>
<author>
<name>Nikolay Borisov</name>
</author>
<published>2016-06-23T18:17:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fba4b697710eb2a4bee456b9d39e9239c66f8bee'/>
<id>urn:sha1:fba4b697710eb2a4bee456b9d39e9239c66f8bee</id>
<content type='text'>
BTRFS is using a variety of slab caches to satisfy internal needs.
Those slab caches are always allocated with the SLAB_RECLAIM_ACCOUNT,
meaning allocations from the caches are going to be accounted as
SReclaimable. At the same time btrfs is not registering any shrinkers
whatsoever, thus preventing memory from the slabs to be shrunk. This
means those caches are not in fact reclaimable.

To fix this remove the SLAB_RECLAIM_ACCOUNT on all caches apart from the
inode cache, since this one is being freed by the generic VFS super_block
shrinker. Also set the transaction related caches as SLAB_TEMPORARY,
to better document the lifetime of the objects (it just translates
to SLAB_RECLAIM_ACCOUNT).

Signed-off-by: Nikolay Borisov &lt;n.borisov.lkml@gmail.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: fix string and comment grammatical issues and typos</title>
<updated>2016-05-25T20:35:14Z</updated>
<author>
<name>Nicholas D Steeves</name>
</author>
<published>2016-05-20T01:18:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0132761017e012ab4dc8584d679503f2ba26ca86'/>
<id>urn:sha1:0132761017e012ab4dc8584d679503f2ba26ca86</id>
<content type='text'>
Signed-off-by: Nicholas D Steeves &lt;nsteeves@gmail.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: Fix misspellings in comments.</title>
<updated>2016-03-14T14:05:02Z</updated>
<author>
<name>Adam Buchbinder</name>
</author>
<published>2016-03-04T19:23:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bb7ab3b92e46da06b580c6f83abe7894dc449cca'/>
<id>urn:sha1:bb7ab3b92e46da06b580c6f83abe7894dc449cca</id>
<content type='text'>
Signed-off-by: Adam Buchbinder &lt;adam.buchbinder@gmail.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: move btrfs_compression_type to compression.h</title>
<updated>2016-03-11T16:12:46Z</updated>
<author>
<name>Anand Jain</name>
</author>
<published>2016-03-10T09:26:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ebb8765b2ded869b75bf5154b048119eb52571f7'/>
<id>urn:sha1:ebb8765b2ded869b75bf5154b048119eb52571f7</id>
<content type='text'>
So that its better organized.

Signed-off-by: Anand Jain &lt;anand.jain@oracle.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: drop null testing before destroy functions</title>
<updated>2016-02-18T10:46:03Z</updated>
<author>
<name>Kinglong Mee</name>
</author>
<published>2016-01-29T13:36:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5598e9005a4076d6700bbd89d0cdbe5b2922a846'/>
<id>urn:sha1:5598e9005a4076d6700bbd89d0cdbe5b2922a846</id>
<content type='text'>
Cleanup.

kmem_cache_destroy has support NULL argument checking,
so drop the double null testing before calling it.

Signed-off-by: Kinglong Mee &lt;kinglongmee@gmail.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>btrfs: cleanup, stop casting for extent_map-&gt;lookup everywhere</title>
<updated>2016-01-15T18:22:28Z</updated>
<author>
<name>Jeff Mahoney</name>
</author>
<published>2015-06-03T14:55:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=95617d69326ce386c95e33db7aeb832b45ee9f8f'/>
<id>urn:sha1:95617d69326ce386c95e33db7aeb832b45ee9f8f</id>
<content type='text'>
Overloading extent_map-&gt;bdev to struct map_lookup * might have started out
as a means to an end, but it's a pattern that's used all over the place
now. Let's get rid of the casting and just add a union instead.

Signed-off-by: Jeff Mahoney &lt;jeffm@suse.com&gt;
Signed-off-by: David Sterba &lt;dsterba@suse.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: do not move em to modified list when unpinning</title>
<updated>2014-11-21T19:59:54Z</updated>
<author>
<name>Josef Bacik</name>
</author>
<published>2014-11-14T21:16:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a28046956c71985046474283fa3bcd256915fb72'/>
<id>urn:sha1:a28046956c71985046474283fa3bcd256915fb72</id>
<content type='text'>
We use the modified list to keep track of which extents have been modified so we
know which ones are candidates for logging at fsync() time.  Newly modified
extents are added to the list at modification time, around the same time the
ordered extent is created.  We do this so that we don't have to wait for ordered
extents to complete before we know what we need to log.  The problem is when
something like this happens

log extent 0-4k on inode 1
copy csum for 0-4k from ordered extent into log
sync log
commit transaction
log some other extent on inode 1
ordered extent for 0-4k completes and adds itself onto modified list again
log changed extents
see ordered extent for 0-4k has already been logged
	at this point we assume the csum has been copied
sync log
crash

On replay we will see the extent 0-4k in the log, drop the original 0-4k extent
which is the same one that we are replaying which also drops the csum, and then
we won't find the csum in the log for that bytenr.  This of course causes us to
have errors about not having csums for certain ranges of our inode.  So remove
the modified list manipulation in unpin_extent_cache, any modified extents
should have been added well before now, and we don't want them re-logged.  This
fixes my test that I could reliably reproduce this problem with.  Thanks,

cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik &lt;jbacik@fb.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: fix NULL pointer crash when running balance and scrub concurrently</title>
<updated>2014-06-19T21:20:55Z</updated>
<author>
<name>Wang Shilong</name>
</author>
<published>2014-06-19T02:42:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=298a8f9cf17d2f2e1ffc41e5e247fa3695a8a76f'/>
<id>urn:sha1:298a8f9cf17d2f2e1ffc41e5e247fa3695a8a76f</id>
<content type='text'>
While running balance, scrub, fsstress concurrently we hit the
following kernel crash:

[56561.448845] BTRFS info (device sde): relocating block group 11005853696 flags 132
[56561.524077] BUG: unable to handle kernel NULL pointer dereference at 0000000000000078
[56561.524237] IP: [&lt;ffffffffa038956d&gt;] scrub_chunk.isra.12+0xdd/0x130 [btrfs]
[56561.524297] PGD 9be28067 PUD 7f3dd067 PMD 0
[56561.524325] Oops: 0000 [#1] SMP
[....]
[56561.527237] Call Trace:
[56561.527309]  [&lt;ffffffffa038980e&gt;] scrub_enumerate_chunks+0x24e/0x490 [btrfs]
[56561.527392]  [&lt;ffffffff810abe00&gt;] ? abort_exclusive_wait+0x50/0xb0
[56561.527476]  [&lt;ffffffffa038add4&gt;] btrfs_scrub_dev+0x1a4/0x530 [btrfs]
[56561.527561]  [&lt;ffffffffa0368107&gt;] btrfs_ioctl+0x13f7/0x2a90 [btrfs]
[56561.527639]  [&lt;ffffffff811c82f0&gt;] do_vfs_ioctl+0x2e0/0x4c0
[56561.527712]  [&lt;ffffffff8109c384&gt;] ? vtime_account_user+0x54/0x60
[56561.527788]  [&lt;ffffffff810f768c&gt;] ? __audit_syscall_entry+0x9c/0xf0
[56561.527870]  [&lt;ffffffff811c8551&gt;] SyS_ioctl+0x81/0xa0
[56561.527941]  [&lt;ffffffff815707f7&gt;] tracesys+0xdd/0xe2
[...]
[56561.528304] RIP  [&lt;ffffffffa038956d&gt;] scrub_chunk.isra.12+0xdd/0x130 [btrfs]
[56561.528395]  RSP &lt;ffff88004c0f5be8&gt;
[56561.528454] CR2: 0000000000000078

This is because in btrfs_relocate_chunk(), we will free @bdev directly while
scrub may still hold extent mapping, and may access freed memory.

Fix this problem by wrapping freeing @bdev work into free_extent_map() which
is based on reference count.

Reported-by: Qu Wenruo &lt;quwenruo@cn.fujitsu.com&gt;
Signed-off-by: Wang Shilong &lt;wangsl.fnst@cn.fujitsu.com&gt;
Signed-off-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: more efficient btrfs_drop_extent_cache</title>
<updated>2014-03-10T19:16:57Z</updated>
<author>
<name>Filipe Manana</name>
</author>
<published>2014-02-25T14:15:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=176840b3aa3cb795ddec4fc665ffbd707abff906'/>
<id>urn:sha1:176840b3aa3cb795ddec4fc665ffbd707abff906</id>
<content type='text'>
While droping extent map structures from the extent cache that cover our
target range, we would remove each extent map structure from the red black
tree and then add either 1 or 2 new extent map structures if the former
extent map covered sections outside our target range.

This change simply attempts to replace the existing extent map structure
with a new one that covers the subsection we're not interested in, instead
of doing a red black remove operation followed by an insertion operation.

The number of elements in an inode's extent map tree can get very high for large
files under random writes. For example, while running the following test:

    sysbench --test=fileio --file-num=1 --file-total-size=10G \
        --file-test-mode=rndrw --num-threads=32 --file-block-size=32768 \
        --max-requests=500000 --file-rw-ratio=2 [prepare|run]

I captured the following histogram capturing the number of extent_map items
in the red black tree while that test was running:

    Count: 122462
    Range:  1.000 - 172231.000; Mean: 96415.831; Median: 101855.000; Stddev: 49700.981
    Percentiles:  90th: 160120.000; 95th: 166335.000; 99th: 171070.000
       1.000 -    5.231:   452 |
       5.231 -  187.392:    87 |
     187.392 -  585.911:   206 |
     585.911 - 1827.438:   623 |
    1827.438 - 5695.245:  1962 #
    5695.245 - 17744.861:  6204 ####
   17744.861 - 55283.764: 21115 ############
   55283.764 - 172231.000: 91813 #####################################################

Benchmark:

    sysbench --test=fileio --file-num=1 --file-total-size=10G --file-test-mode=rndwr \
        --num-threads=64 --file-block-size=32768 --max-requests=0 --max-time=60 \
        --file-io-mode=sync --file-fsync-freq=0 [prepare|run]

Before this change: 122.1Mb/sec
After this change:  125.07Mb/sec
(averages of 5 test runs)

Test machine: quad core intel i5-3570K, 32Gb of ram, SSD

Signed-off-by: Filipe David Borba Manana &lt;fdmanana@gmail.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fb.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: remove unneeded field / smaller extent_map structure</title>
<updated>2014-03-10T19:16:56Z</updated>
<author>
<name>Filipe Manana</name>
</author>
<published>2014-02-25T14:15:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cbc0e9287d710ce7dce5f8daf667729e83316c45'/>
<id>urn:sha1:cbc0e9287d710ce7dce5f8daf667729e83316c45</id>
<content type='text'>
We don't need to have an unsigned int field in the extent_map struct
to tell us whether the extent map is in the inode's extent_map tree or
not. We can use the rb_node struct field and the RB_CLEAR_NODE and
RB_EMPTY_NODE macros to achieve the same task.

This reduces sizeof(struct extent_map) from 152 bytes to 144 bytes (on a
64 bits system).

Signed-off-by: Filipe David Borba Manana &lt;fdmanana@gmail.com&gt;
Reviewed-by: David Sterba &lt;dsterba@suse.cz&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fb.com&gt;
</content>
</entry>
</feed>
