<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/btrfs/transaction.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>2014-04-30T15:23:23Z</updated>
<entry>
<title>Btrfs: fix deadlock with nested trans handles</title>
<updated>2014-04-30T15:23:23Z</updated>
<author>
<name>Josef Bacik</name>
</author>
<published>2014-03-07T00:01:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d57813e995c66cb298e745f3ba7e4ceb7a47c248'/>
<id>urn:sha1:d57813e995c66cb298e745f3ba7e4ceb7a47c248</id>
<content type='text'>
commit 3bbb24b20a8800158c33eca8564f432dd14d0bf3 upstream.

Zach found this deadlock that would happen like this

btrfs_end_transaction &lt;- reduce trans-&gt;use_count to 0
  btrfs_run_delayed_refs
    btrfs_cow_block
      find_free_extent
	btrfs_start_transaction &lt;- increase trans-&gt;use_count to 1
          allocate chunk
	btrfs_end_transaction &lt;- decrease trans-&gt;use_count to 0
	  btrfs_run_delayed_refs
	    lock tree block we are cowing above ^^

We need to only decrease trans-&gt;use_count if it is above 1, otherwise leave it
alone.  This will make nested trans be the only ones who decrease their added
ref, and will let us get rid of the trans-&gt;use_count++ hack if we have to commit
the transaction.  Thanks,

Reported-by: Zach Brown &lt;zab@redhat.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fb.com&gt;
Tested-by: Zach Brown &lt;zab@redhat.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings &lt;ben@decadent.org.uk&gt;
</content>
</entry>
<entry>
<title>Btrfs: fix tree corruption after multi-thread snapshots and inode_cache flush</title>
<updated>2011-11-15T14:53:28Z</updated>
<author>
<name>Liu Bo</name>
</author>
<published>2011-11-15T01:48:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f1ebcc74d5b2159f44c96b479b6eb8afc7829095'/>
<id>urn:sha1:f1ebcc74d5b2159f44c96b479b6eb8afc7829095</id>
<content type='text'>
The btrfs snapshotting code requires that once a root has been
snapshotted, we don't change it during a commit.

But there are two cases to lead to tree corruptions:

1) multi-thread snapshots can commit serveral snapshots in a transaction,
   and this may change the src root when processing the following pending
   snapshots, which lead to the former snapshots corruptions;

2) the free inode cache was changing the roots when it root the cache,
   which lead to corruptions.

This fixes things by making sure we force COW the block after we create a
snapshot during commiting a transaction, then any changes to the roots
will result in COW, and we get all the fs roots and snapshot roots to be
consistent.

Signed-off-by: Liu Bo &lt;liubo2009@cn.fujitsu.com&gt;
Signed-off-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@oracle.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: fix deadlock caused by the race between relocation</title>
<updated>2011-11-11T01:45:05Z</updated>
<author>
<name>Miao Xie</name>
</author>
<published>2011-11-11T01:45:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=62f30c5462374b991e7e3f42d49ce2265c1b82f1'/>
<id>urn:sha1:62f30c5462374b991e7e3f42d49ce2265c1b82f1</id>
<content type='text'>
We can not do flushable reservation for the relocation when we create snapshot,
because it may make the transaction commit task and the flush task wait for
each other and the deadlock happens.

Signed-off-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@oracle.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: fix race during transaction joins</title>
<updated>2011-11-06T08:26:19Z</updated>
<author>
<name>Chris Mason</name>
</author>
<published>2011-11-06T08:26:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d43317dcd074818d4bd12ddd4184a29aff98907b'/>
<id>urn:sha1:d43317dcd074818d4bd12ddd4184a29aff98907b</id>
<content type='text'>
While we're allocating ram for a new transaction, we drop our spinlock.
When we get the lock back, we do check to see if a transaction started
while we slept, but we don't check to make sure it isn't blocked
because a commit has already started.

Signed-off-by: Chris Mason &lt;chris.mason@oracle.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: ClearPageError during writepage and clean_tree_block</title>
<updated>2011-11-06T08:04:20Z</updated>
<author>
<name>Chris Mason</name>
</author>
<published>2011-11-04T16:29:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bf0da8c183a15656eee63c54f334c3794320872a'/>
<id>urn:sha1:bf0da8c183a15656eee63c54f334c3794320872a</id>
<content type='text'>
Failure testing was tripping up over stale PageError bits in
metadata pages.  If we have an io error on a block, and later on
end up reusing it, nobody ever clears PageError on those pages.

During commit, we'll find PageError and think we had trouble writing
the block, which will lead to aborts and other problems.

This changes clean_tree_block and the btrfs writepage code to
clear the PageError bit.  In both cases we're either completely
done with the page or the page has good stuff and the error bit
is no longer valid.

Signed-off-by: Chris Mason &lt;chris.mason@oracle.com&gt;
</content>
</entry>
<entry>
<title>btrfs: separate superblock items out of fs_info</title>
<updated>2011-11-06T08:04:01Z</updated>
<author>
<name>David Sterba</name>
</author>
<published>2011-04-13T13:41:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6c41761fc6efe1503103a1afe03a6635c0b5d4ec'/>
<id>urn:sha1:6c41761fc6efe1503103a1afe03a6635c0b5d4ec</id>
<content type='text'>
fs_info has now ~9kb, more than fits into one page. This will cause
mount failure when memory is too fragmented. Top space consumers are
super block structures super_copy and super_for_commit, ~2.8kb each.
Allocate them dynamically. fs_info will be ~3.5kb. (measured on x86_64)

Add a wrapper for freeing fs_info and all of it's dynamically allocated
members.

Signed-off-by: David Sterba &lt;dsterba@suse.cz&gt;
</content>
</entry>
<entry>
<title>Btrfs: seperate out btrfs_block_rsv_check out into 2 different functions</title>
<updated>2011-10-19T19:12:59Z</updated>
<author>
<name>Josef Bacik</name>
</author>
<published>2011-10-18T16:15:48Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=36ba022ac0b748dd543f43430b03198e899426c9'/>
<id>urn:sha1:36ba022ac0b748dd543f43430b03198e899426c9</id>
<content type='text'>
Currently btrfs_block_rsv_check does 2 things, it will either refill a block
reserve like in the truncate or refill case, or it will check to see if there is
enough space in the global reserve and possibly refill it.  However because of
overcommit we could be well overcommitting ourselves just to try and refill the
global reserve, when really we should just be committing the transaction.  So
breack this out into btrfs_block_rsv_refill and btrfs_block_rsv_check.  Refill
will try to reserve more metadata if it can and btrfs_block_rsv_check will not,
it will only tell you if the factor of the total space is still reserved.
Thanks,

Signed-off-by: Josef Bacik &lt;josef@redhat.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: release trans metadata bytes before flushing delayed refs</title>
<updated>2011-10-19T19:12:58Z</updated>
<author>
<name>Josef Bacik</name>
</author>
<published>2011-10-14T18:40:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b24e03db0df3e9164c9649db12fecc8c2d81b0d1'/>
<id>urn:sha1:b24e03db0df3e9164c9649db12fecc8c2d81b0d1</id>
<content type='text'>
We started setting trans-&gt;block_rsv = NULL to allow the delayed refs flushing
stuff to use the right block_rsv and then just made
btrfs_trans_release_metadata() unconditionally use the trans block rsv.  The
problem with this is we need to reserve some space in the transaction and then
migrate it to the global block rsv, so we need to be able to free that out
properly.  So instead just move btrfs_trans_release_metadata() before the
delayed ref flushing and use trans-&gt;block_rsv for the freeing.  Thanks,

Signed-off-by: Josef Bacik &lt;josef@redhat.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: introduce mount option no_space_cache</title>
<updated>2011-10-19T19:12:51Z</updated>
<author>
<name>Josef Bacik</name>
</author>
<published>2011-10-03T18:07:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=73bc187680f94bed498f8a669103cad290e41180'/>
<id>urn:sha1:73bc187680f94bed498f8a669103cad290e41180</id>
<content type='text'>
Some users have requested this and I've found I needed a way to disable cache
loading without actually clearing the cache, so introduce the no_space_cache
option.  Before we check the super blocks cache generation field and if it was
populated we always turned space caching on.  Now we check this and set the
space cache option on, and then parse the mount options so that if we want it
off it get's turned off.  Then we check the mount option all the places we do
the caching work instead of checking the super's cache generation.  This makes
things more consistent and lets us turn space caching off.  Thanks,

Signed-off-by: Josef Bacik &lt;josef@redhat.com&gt;
</content>
</entry>
<entry>
<title>Btrfs: stop using write_one_page</title>
<updated>2011-10-19T19:12:48Z</updated>
<author>
<name>Josef Bacik</name>
</author>
<published>2011-09-26T17:58:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1728366efa5ebf48bd2ed544afa8700cd07ba822'/>
<id>urn:sha1:1728366efa5ebf48bd2ed544afa8700cd07ba822</id>
<content type='text'>
While looking for a performance regression a user was complaining about, I
noticed that we had a regression with the varmail test of filebench.  This was
introduced by

0d10ee2e6deb5c8409ae65b970846344897d5e4e

which keeps us from calling writepages in writepage.  This is a correct change,
however it happens to help the varmail test because we write out in larger
chunks.  This is largly to do with how we write out dirty pages for each
transaction.  If you run filebench with

load varmail
set $dir=/mnt/btrfs-test
run 60

prior to this patch you would get ~1420 ops/second, but with the patch you get
~1200 ops/second.  This is a 16% decrease.  So since we know the range of dirty
pages we want to write out, don't write out in one page chunks, write out in
ranges.  So to do this we call filemap_fdatawrite_range() on the range of bytes.
Then we convert the DIRTY extents to NEED_WAIT extents.  When we then call
btrfs_wait_marked_extents() we only have to filemap_fdatawait_range() on that
range and clear the NEED_WAIT extents.  This doesn't get us back to our original
speeds, but I've been seeing ~1380 ops/second, which is a &lt;5% regression as
opposed to a &gt;15% regression.  That is acceptable given that the original commit
greatly reduces our latency to begin with.  Thanks,

Signed-off-by: Josef Bacik &lt;josef@redhat.com&gt;
</content>
</entry>
</feed>
