linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wang Shilong <wangshilong1991@gmail.com>
To: Josef Bacik <jbacik@fb.com>
Cc: <linux-btrfs@vger.kernel.org>, Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Subject: Re: [PATCH] Btrfs: convert to add transaction protection for btrfs send
Date: Sat, 8 Feb 2014 11:06:56 +0800	[thread overview]
Message-ID: <E2D932EC-EEEA-46DA-92D8-CEA762893951@gmail.com> (raw)
In-Reply-To: <52F2A370.2080509@fb.com>

Hi Josef,

[..SNIP..]

>> Yeah, very reasonable, if you don't mind, i would give a patch for this issue.
> Go for it, you'll be faster than I will be, all I do is run xfstests and
> try to reproduce things that will never reproduce for me.

So Finally, i've figured everything out.

Previous send is almostly safe is because we deal every item by transaction protection, 
and we will search next item from root again next time (see btrfs_search_slot_for_read())
And we will check root's @ctransid to make sure root did not change during send. (For readonly root,
usually it should not except snapshot-aware defrag, ok we should fix it!!)

Since we kicked off transaction from send, life will become a little complex,we should take care of
everything can change readonly snapshot, from i can say now:

1. snapshot @send_root will cow everything
2. snapshot-aware defrag also work for readonly root.
3. balance, device resize, add,remove, scrub(repair mode)

So there are two ideas in my mind:

#Approach 1
convert to previous ways that means add transaction protection for send. and Filipe's optimizations
for send search should be reverted, this way is simple and make codes less complex, but we will involve
transaction protection.

#Approach 2.
Add a local flag to root structure to sync snapshot with send.
Add a global flag to sync balance's etc options with send
don't defray readonly snapshot for snapshot-aware defrag.

Approach 2 will make it safe to avoid transaction from send, but it add complexity to codes.Personally,
i do not like approach 2 very much because it make btrfs codes more *ugly*  and make it *harder* to maintain.

Anyway, I am ok to implement  both ways, Tell me if you have any better ideas or which approach is your
appreciated way to fix the issue^_^

Thanks,
Wang
> 
> Josef


      reply	other threads:[~2014-02-08  3:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-29 15:32 [PATCH] Btrfs: convert to add transaction protection for btrfs send Wang Shilong
2014-01-29 15:32 ` Wang Shilong
2014-01-29 19:00 ` Josef Bacik
2014-01-30  9:42   ` Wang Shilong
2014-01-30 16:08     ` Josef Bacik
2014-01-30 16:20       ` Wang Shilong
2014-01-30 16:23         ` Josef Bacik
2014-01-30 16:42           ` Wang Shilong
2014-01-31 16:37             ` Wang Shilong
2014-01-31 23:40               ` Josef Bacik
2014-02-03 21:31               ` Josef Bacik
2014-02-05  8:59                 ` Wang Shilong
2014-02-05 14:04                   ` Josef Bacik
2014-02-05 17:23                     ` Wang Shilong
2014-02-05 20:47                       ` Josef Bacik
2014-02-08  3:06                         ` Wang Shilong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E2D932EC-EEEA-46DA-92D8-CEA762893951@gmail.com \
    --to=wangshilong1991@gmail.com \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wangsl.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).