<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/fs/btrfs/relocation.c, branch v3.13</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>Btrfs: make sure we cleanup all reloc roots if error happens</title>
<updated>2013-12-12T15:12:51+00:00</updated>
<author>
<name>Wang Shilong</name>
<email>wangsl.fnst@cn.fujitsu.com</email>
</author>
<published>2013-12-11T11:29:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=467bb1d27c0b783b73e6349304c0d90b5b4f431b'/>
<id>467bb1d27c0b783b73e6349304c0d90b5b4f431b</id>
<content type='text'>
I hit an oops when merging reloc roots fails, the reason is that
new reloc roots may be added and we should make sure we cleanup
all reloc roots.

Signed-off-by: Wang Shilong &lt;wangsl.fnst@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I hit an oops when merging reloc roots fails, the reason is that
new reloc roots may be added and we should make sure we cleanup
all reloc roots.

Signed-off-by: Wang Shilong &lt;wangsl.fnst@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: skip building backref tree for uuid and quota tree when doing balance relocation</title>
<updated>2013-12-12T15:12:36+00:00</updated>
<author>
<name>Wang Shilong</name>
<email>wangsl.fnst@cn.fujitsu.com</email>
</author>
<published>2013-12-09T16:14:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=6646374863508e24da7c7d21527f8dadc8687ff9'/>
<id>6646374863508e24da7c7d21527f8dadc8687ff9</id>
<content type='text'>
Quota tree and UUID Tree is only cowed, they can not be snapshoted.

Signed-off-by: Wang Shilong &lt;wangsl.fnst@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Quota tree and UUID Tree is only cowed, they can not be snapshoted.

Signed-off-by: Wang Shilong &lt;wangsl.fnst@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: fix an oops when doing balance relocation</title>
<updated>2013-12-12T15:12:20+00:00</updated>
<author>
<name>Wang Shilong</name>
<email>wangsl.fnst@cn.fujitsu.com</email>
</author>
<published>2013-12-11T11:29:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=c974c4642fee8c58239c7753d0bf548b23799923'/>
<id>c974c4642fee8c58239c7753d0bf548b23799923</id>
<content type='text'>
I hit an oops when inserting reloc root into @reloc_root_tree(it can be
easily triggered when forcing cow for relocation root)

[  866.494539]  [&lt;ffffffffa0499579&gt;] btrfs_init_reloc_root+0x79/0xb0 [btrfs]
[  866.495321]  [&lt;ffffffffa044c240&gt;] record_root_in_trans+0xb0/0x110 [btrfs]
[  866.496109]  [&lt;ffffffffa044d758&gt;] btrfs_record_root_in_trans+0x48/0x80 [btrfs]
[  866.496908]  [&lt;ffffffffa0494da8&gt;] select_reloc_root+0xa8/0x210 [btrfs]
[  866.497703]  [&lt;ffffffffa0495c8a&gt;] do_relocation+0x16a/0x540 [btrfs]

This is because reloc root inserted into @reloc_root_tree is not within one
transaction,reloc root may be cowed and root block bytenr will be reused then
oops happens.We should update reloc root in @reloc_root_tree when cow reloc
root node, fix it.

Signed-off-by: Wang Shilong &lt;wangsl.fnst@cn.fujitsu.com&gt;
Reviewed-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I hit an oops when inserting reloc root into @reloc_root_tree(it can be
easily triggered when forcing cow for relocation root)

[  866.494539]  [&lt;ffffffffa0499579&gt;] btrfs_init_reloc_root+0x79/0xb0 [btrfs]
[  866.495321]  [&lt;ffffffffa044c240&gt;] record_root_in_trans+0xb0/0x110 [btrfs]
[  866.496109]  [&lt;ffffffffa044d758&gt;] btrfs_record_root_in_trans+0x48/0x80 [btrfs]
[  866.496908]  [&lt;ffffffffa0494da8&gt;] select_reloc_root+0xa8/0x210 [btrfs]
[  866.497703]  [&lt;ffffffffa0495c8a&gt;] do_relocation+0x16a/0x540 [btrfs]

This is because reloc root inserted into @reloc_root_tree is not within one
transaction,reloc root may be cowed and root block bytenr will be reused then
oops happens.We should update reloc root in @reloc_root_tree when cow reloc
root node, fix it.

Signed-off-by: Wang Shilong &lt;wangsl.fnst@cn.fujitsu.com&gt;
Reviewed-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Chris Mason &lt;clm@fb.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: rename btrfs_start_all_delalloc_inodes</title>
<updated>2013-11-12T03:13:58+00:00</updated>
<author>
<name>Miao Xie</name>
<email>miaox@cn.fujitsu.com</email>
</author>
<published>2013-11-04T15:13:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=91aef86f3b8ab0685d930a5468254384513d1c97'/>
<id>91aef86f3b8ab0685d930a5468254384513d1c97</id>
<content type='text'>
rename the function -- btrfs_start_all_delalloc_inodes(), and make its
name be compatible to btrfs_wait_ordered_roots(), since they are always
used at the same place.

Signed-off-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
rename the function -- btrfs_start_all_delalloc_inodes(), and make its
name be compatible to btrfs_wait_ordered_roots(), since they are always
used at the same place.

Signed-off-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: don't wait for the completion of all the ordered extents</title>
<updated>2013-11-12T03:13:44+00:00</updated>
<author>
<name>Miao Xie</name>
<email>miaox@cn.fujitsu.com</email>
</author>
<published>2013-11-04T15:13:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=b02441999efcc6152b87cd58e7970bb7843f76cf'/>
<id>b02441999efcc6152b87cd58e7970bb7843f76cf</id>
<content type='text'>
It is very likely that there are lots of ordered extents in the filesytem,
if we wait for the completion of all of them when we want to reclaim some
space for the metadata space reservation, we would be blocked for a long
time. The performance would drop down suddenly for a long time.

Signed-off-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
It is very likely that there are lots of ordered extents in the filesytem,
if we wait for the completion of all of them when we want to reclaim some
space for the metadata space reservation, we would be blocked for a long
time. The performance would drop down suddenly for a long time.

Signed-off-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>btrfs: Use WARN_ON()'s return value in place of WARN_ON(1)</title>
<updated>2013-11-12T03:11:53+00:00</updated>
<author>
<name>Dulshani Gunawardhana</name>
<email>dulshani.gunawardhana89@gmail.com</email>
</author>
<published>2013-10-31T05:00:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=fae7f21cece9a4c181a8d8131870c7247e153f65'/>
<id>fae7f21cece9a4c181a8d8131870c7247e153f65</id>
<content type='text'>
Use WARN_ON()'s return value in place of WARN_ON(1) for cleaner source
code that outputs a more descriptive warnings. Also fix the styling
warning of redundant braces that came up as a result of this fix.

Signed-off-by: Dulshani Gunawardhana &lt;dulshani.gunawardhana89@gmail.com&gt;
Reviewed-by: Zach Brown &lt;zab@redhat.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use WARN_ON()'s return value in place of WARN_ON(1) for cleaner source
code that outputs a more descriptive warnings. Also fix the styling
warning of redundant braces that came up as a result of this fix.

Signed-off-by: Dulshani Gunawardhana &lt;dulshani.gunawardhana89@gmail.com&gt;
Reviewed-by: Zach Brown &lt;zab@redhat.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: use 'u64' rather than 'int' to get extent's generation</title>
<updated>2013-11-12T03:10:06+00:00</updated>
<author>
<name>Wang Shilong</name>
<email>wangsl.fnst@cn.fujitsu.com</email>
</author>
<published>2013-10-25T10:52:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=7fdf4b608dda5eea114cb23623b52e34dd5972f5'/>
<id>7fdf4b608dda5eea114cb23623b52e34dd5972f5</id>
<content type='text'>
We define a 'int' to get extent's generation by mistake,fix it.

Signed-off-by: Wang Shilong &lt;wangsl.fnst@cn.fujitsu.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We define a 'int' to get extent's generation by mistake,fix it.

Signed-off-by: Wang Shilong &lt;wangsl.fnst@cn.fujitsu.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: stop committing the transaction so much during relocate</title>
<updated>2013-11-12T03:08:31+00:00</updated>
<author>
<name>Josef Bacik</name>
<email>jbacik@fusionio.com</email>
</author>
<published>2013-10-31T14:07:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=9e6a0c52b74b2d63a6cdb09cec5eaf66038b218f'/>
<id>9e6a0c52b74b2d63a6cdb09cec5eaf66038b218f</id>
<content type='text'>
I noticed with my horrible snapshot excercisor that we were taking forever to
relocate the larger the file system got.  This appeared to be because we were
committing the transaction _constantly_.  There were a few places where we do
braindead things with metadata reservation, like start a transaction and then
try to refill the block rsv, which not only keeps us from committing a
transaction during the enospc stuff, but keeps us from doing some of the harder
flushing work which will make us more likely to need to commit the transaction.
We also were checking the block rsv and committing the transaction if the block
rsv was below a certain threshold, but we were doing this in a place where we
don't actually keep anything in the block rsv so this was always ending up false
so we always committed the transaction in this case.  I tested this to make sure
it didn't break anything, but it takes about 10 hours to get the box to this
state so I don't know how much of an impact it will really make.  Thanks,

Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I noticed with my horrible snapshot excercisor that we were taking forever to
relocate the larger the file system got.  This appeared to be because we were
committing the transaction _constantly_.  There were a few places where we do
braindead things with metadata reservation, like start a transaction and then
try to refill the block rsv, which not only keeps us from committing a
transaction during the enospc stuff, but keeps us from doing some of the harder
flushing work which will make us more likely to need to commit the transaction.
We also were checking the block rsv and committing the transaction if the block
rsv was below a certain threshold, but we were doing this in a place where we
don't actually keep anything in the block rsv so this was always ending up false
so we always committed the transaction in this case.  I tested this to make sure
it didn't break anything, but it takes about 10 hours to get the box to this
state so I don't know how much of an impact it will really make.  Thanks,

Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: return an error from btrfs_wait_ordered_range</title>
<updated>2013-11-12T03:07:35+00:00</updated>
<author>
<name>Josef Bacik</name>
<email>jbacik@fusionio.com</email>
</author>
<published>2013-10-25T20:13:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=0ef8b726075aa6931ddf1c16f5bae043eef184f9'/>
<id>0ef8b726075aa6931ddf1c16f5bae043eef184f9</id>
<content type='text'>
I noticed that if the free space cache has an error writing out it's data it
won't actually error out, it will just carry on.  This is because it doesn't
check the return value of btrfs_wait_ordered_range, which didn't actually return
anything.  So fix this in order to keep us from making free space cache look
valid when it really isnt.  Thanks,

Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I noticed that if the free space cache has an error writing out it's data it
won't actually error out, it will just carry on.  This is because it doesn't
check the return value of btrfs_wait_ordered_range, which didn't actually return
anything.  So fix this in order to keep us from making free space cache look
valid when it really isnt.  Thanks,

Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Btrfs: fix BUG_ON() casued by the reserved space migration</title>
<updated>2013-11-12T02:54:28+00:00</updated>
<author>
<name>Miao Xie</name>
<email>miaox@cn.fujitsu.com</email>
</author>
<published>2013-09-25T13:47:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=20dd2cbf01888a91fdd921403040a710b275a1ff'/>
<id>20dd2cbf01888a91fdd921403040a710b275a1ff</id>
<content type='text'>
When we did space balance and snapshot creation at the same time, we might
meet the following oops:
 kernel BUG at fs/btrfs/inode.c:3038!
 [SNIP]
 Call Trace:
 [&lt;ffffffffa0411ec7&gt;] btrfs_orphan_cleanup+0x293/0x407 [btrfs]
 [&lt;ffffffffa042dc45&gt;] btrfs_mksubvol.isra.28+0x259/0x373 [btrfs]
 [&lt;ffffffffa042de85&gt;] btrfs_ioctl_snap_create_transid+0x126/0x156 [btrfs]
 [&lt;ffffffffa042dff1&gt;] btrfs_ioctl_snap_create_v2+0xd0/0x121 [btrfs]
 [&lt;ffffffffa0430b2c&gt;] btrfs_ioctl+0x414/0x1854 [btrfs]
 [&lt;ffffffff813b60b7&gt;] ? __do_page_fault+0x305/0x379
 [&lt;ffffffff811215a9&gt;] vfs_ioctl+0x1d/0x39
 [&lt;ffffffff81121d7c&gt;] do_vfs_ioctl+0x32d/0x3e2
 [&lt;ffffffff81057fe7&gt;] ? finish_task_switch+0x80/0xb8
 [&lt;ffffffff81121e88&gt;] SyS_ioctl+0x57/0x83
 [&lt;ffffffff813b39ff&gt;] ? do_device_not_available+0x12/0x14
 [&lt;ffffffff813b99c2&gt;] system_call_fastpath+0x16/0x1b
 [SNIP]
 RIP  [&lt;ffffffffa040da40&gt;] btrfs_orphan_add+0xc3/0x126 [btrfs]

The reason of the problem is that the relocation root creation stole
the reserved space, which was reserved for orphan item deletion.

There are several ways to fix this problem, one is to increasing
the reserved space size of the space balace, and then we can use
that space to create the relocation tree for each fs/file trees.
But it is hard to calculate the suitable size because we doesn't
know how many fs/file trees we need relocate.

We fixed this problem by reserving the space for relocation root creation
actively since the space it need is very small (one tree block, used for
root node copy), then we use that reserved space to create the
relocation tree. If we don't reserve space for relocation tree creation,
we will use the reserved space of the balance.

Signed-off-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When we did space balance and snapshot creation at the same time, we might
meet the following oops:
 kernel BUG at fs/btrfs/inode.c:3038!
 [SNIP]
 Call Trace:
 [&lt;ffffffffa0411ec7&gt;] btrfs_orphan_cleanup+0x293/0x407 [btrfs]
 [&lt;ffffffffa042dc45&gt;] btrfs_mksubvol.isra.28+0x259/0x373 [btrfs]
 [&lt;ffffffffa042de85&gt;] btrfs_ioctl_snap_create_transid+0x126/0x156 [btrfs]
 [&lt;ffffffffa042dff1&gt;] btrfs_ioctl_snap_create_v2+0xd0/0x121 [btrfs]
 [&lt;ffffffffa0430b2c&gt;] btrfs_ioctl+0x414/0x1854 [btrfs]
 [&lt;ffffffff813b60b7&gt;] ? __do_page_fault+0x305/0x379
 [&lt;ffffffff811215a9&gt;] vfs_ioctl+0x1d/0x39
 [&lt;ffffffff81121d7c&gt;] do_vfs_ioctl+0x32d/0x3e2
 [&lt;ffffffff81057fe7&gt;] ? finish_task_switch+0x80/0xb8
 [&lt;ffffffff81121e88&gt;] SyS_ioctl+0x57/0x83
 [&lt;ffffffff813b39ff&gt;] ? do_device_not_available+0x12/0x14
 [&lt;ffffffff813b99c2&gt;] system_call_fastpath+0x16/0x1b
 [SNIP]
 RIP  [&lt;ffffffffa040da40&gt;] btrfs_orphan_add+0xc3/0x126 [btrfs]

The reason of the problem is that the relocation root creation stole
the reserved space, which was reserved for orphan item deletion.

There are several ways to fix this problem, one is to increasing
the reserved space size of the space balace, and then we can use
that space to create the relocation tree for each fs/file trees.
But it is hard to calculate the suitable size because we doesn't
know how many fs/file trees we need relocate.

We fixed this problem by reserving the space for relocation root creation
actively since the space it need is very small (one tree block, used for
root node copy), then we use that reserved space to create the
relocation tree. If we don't reserve space for relocation tree creation,
we will use the reserved space of the balance.

Signed-off-by: Miao Xie &lt;miaox@cn.fujitsu.com&gt;
Signed-off-by: Josef Bacik &lt;jbacik@fusionio.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@fusionio.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
