]> git.baikalelectronics.ru Git - kernel.git/commit
Revert "Btrfs: remove transaction from btrfs send"
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Sat, 8 Feb 2014 15:46:36 +0000 (23:46 +0800)
committerJosef Bacik <jbacik@fb.com>
Mon, 10 Mar 2014 19:16:35 +0000 (15:16 -0400)
commit5a74b9036ce4c90171d004c84ebf1ef275a9dad9
tree9081f9b4d8e21eddf05c7d1bd5f1c121bb99a509
parent85adfc462ce1e51320ce8f8bc530d0248f500693
Revert "Btrfs: remove transaction from btrfs send"

This reverts commit 6a3bfa59c1d007a7e09fb356d1cb25e0beaa003d.
Previously i was thinking we can use readonly root's commit root
safely while it is not true, readonly root may be cowed with the
following cases.

1.snapshot send root will cow source root.
2.balance,device operations will also cow readonly send root
to relocate.

So i have two ideas to make us safe to use commit root.

-->approach 1:
make it protected by transaction and end transaction properly and we research
next item from root node(see btrfs_search_slot_for_read()).

-->approach 2:
add another counter to local root structure to sync snapshot with send.
and add a global counter to sync send with exclusive device operations.

So with approach 2, send can use commit root safely, because we make sure
send root can not be cowed during send. Unfortunately, it make codes *ugly*
and more complex to maintain.

To make snapshot and send exclusively, device operations and send operation
exclusively with each other is a little confusing for common users.

So why not drop into previous way.

Cc: Josef Bacik <jbacik@fb.com>
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
fs/btrfs/send.c