diff mbox

[v2] Btrfs: do not use extent commit root for sending

Message ID 1389716803-2415-1-git-send-email-wangshilong1991@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wang Shilong Jan. 14, 2014, 4:26 p.m. UTC
From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>

Now we have kicked off transaction from btrfs send, it is not safe
that we use extent commit root to search.

I happended to catch this problem when running sending and snapshot
in my desktop.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
---
Changelog v1->v2:
	extent_from_logical() also search extent tree, we should also
	take care of that part.
---
 fs/btrfs/send.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Josef Bacik Jan. 28, 2014, 2:37 p.m. UTC | #1
On 01/14/2014 11:26 AM, Wang Shilong wrote:
> From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
>
> Now we have kicked off transaction from btrfs send, it is not safe
> that we use extent commit root to search.
>
> I happended to catch this problem when running sending and snapshot
> in my desktop.

I'm confused about this, we are searching a read only snapshot, why 
isn't looking at the commit root ok?  Thanks,

Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wang Shilong Jan. 28, 2014, 3:04 p.m. UTC | #2
Hello Josef,

> 
> On 01/14/2014 11:26 AM, Wang Shilong wrote:
>> From: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
>> 
>> Now we have kicked off transaction from btrfs send, it is not safe
>> that we use extent commit root to search.
>> 
>> I happended to catch this problem when running sending and snapshot
>> in my desktop.
> 
> I'm confused about this, we are searching a read only snapshot, why isn't looking at the commit root ok?  Thanks,

I sent a patch to remove transaction outsize before.

http://git.kernel.org/cgit/linux/kernel/git/mason/linux-btrfs.git/commit/?h=integration&id=e0cbfccf3d518f1fb6f8e10932a67d75df2a4380

Previously, we can search extent commit root, it is because we are protected by join and end transaction, since this patch, we can not.

A further  question is now we still have to join transaction actually, only the transaction protection range is smaller,  but we may encounter
extent root's lock contention. I don't know which approach is better, the url's patch have been pushed into chris's integration branch before
i realized it would caused other problems.

Maybe a better a approach is to join and end transaction outsize of find_extent_clone(), and then we still can use extent commit
root for sending.^_^

Thanks,
Wang
> 
> Josef

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 591063d..54665d4 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1142,7 +1142,7 @@  static int find_extent_clone(struct send_ctx *sctx,
 	int compressed;
 	u32 i;
 
-	tmp_path = alloc_path_for_send();
+	tmp_path = btrfs_alloc_path();
 	if (!tmp_path)
 		return -ENOMEM;
 
@@ -1225,7 +1225,7 @@  static int find_extent_clone(struct send_ctx *sctx,
 
 	extent_item_pos = logical - found_key.objectid;
 	ret = iterate_extent_inodes(sctx->send_root->fs_info,
-					found_key.objectid, extent_item_pos, 1,
+					found_key.objectid, extent_item_pos, 0,
 					__iterate_backrefs, backref_ctx);
 
 	if (ret < 0)