From: Liu Bo <bo.li.liu@oracle.com>
To: David Sterba <dave@jikos.cz>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 2/2] Btrfs: make snapshot-aware defrag as a mount option
Date: Wed, 31 Oct 2012 21:31:50 +0800 [thread overview]
Message-ID: <50912846.6020503@oracle.com> (raw)
In-Reply-To: <20121031004426.GF3102@twin.jikos.cz>
On 10/31/2012 08:44 AM, David Sterba wrote:
> On Wed, Oct 31, 2012 at 08:34:38AM +0800, Liu Bo wrote:
>> Besides 'btrfs fi defrag', mounting with autodefrag may also do the same thing.
>
> Ok, autodefrag, good point. Then I suggest to make the snapshot-aware a
> mode of autodefrag, not a separate option (because it would make no
> sense other than an alias for "autodefrag=snapshotaware")
>
Hmm, you might be right.
But I have to say 'snapshot-aware defrag' is kind of trade-off.
1. The good case:
Say a file is full of fragments and make a snapshot based on file's root
fs root, snapshot
/ | \
/ | \
| - - | ... | - - - | ... | - - - |
p1 p2 p3
then we do a snapshot-aware defrag, it will be
fs root snapshot
\ /
\ /
| - - - - - - - - |
a whole new extent
We achieve the goal!
2. The bad case:
Say we have a file with an whole extent and a snapshot on it at the very first:
fs root snapshot
\ /
\ /
| - - - - - - - - |
then, we write into part of the file, with COW it will be:
| - - || - - - || - - - | ... | - - - |
p1 p2 p3 p2_new
(file in snapshot -> p1 + p2 + p3)
(file in fs root -> p1 + p2_new + p3)
then, we do a snapshot-aware defrag, it will be
| - - || - - - || - - - | ... | - - - |
p1 p2 p3 p2_new
||
VV
| - - | | - - - | ... ... | - - | - - - | - - - |
p1 p3 new extent
(file in snapshot -> p1 + p3 + middle of new extent)
(file in fs root -> new extent)
So we're making file in snapshot worse than before, although we get a good one for file in fs root.
thanks,
liubo
>
> david
> --
> 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
>
next prev parent reply other threads:[~2012-10-31 13:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-27 10:28 [PATCH 1/2 v4] Btrfs: snapshot-aware defrag Liu Bo
2012-10-27 10:28 ` [PATCH 2/2] Btrfs: make snapshot-aware defrag as a mount option Liu Bo
2012-10-30 23:31 ` David Sterba
2012-10-31 0:34 ` Liu Bo
2012-10-31 0:44 ` David Sterba
2012-10-31 13:31 ` Liu Bo [this message]
2012-11-01 14:43 ` Chris Mason
2012-11-01 15:49 ` Liu Bo
2012-10-29 20:06 ` [PATCH 1/2 v4] Btrfs: snapshot-aware defrag Mitch Harder
2012-10-30 1:20 ` Liu Bo
2012-10-30 20:59 ` Mitch Harder
2012-10-31 12:13 ` Itaru Kitayama
2012-10-31 12:55 ` Liu Bo
2012-11-01 11:08 ` Itaru Kitayama
2012-11-01 11:21 ` Liu Bo
2012-11-01 14:05 ` Itaru Kitayama
2012-11-01 16:01 ` Liu Bo
[not found] ` <CANW9uyt9qE9384WnQq5ggZ2hb-DbahZe8KY5-WXRFSKTiedekg@mail.gmail.com>
2012-11-26 10:30 ` Liu Bo
2012-12-12 19:37 ` Mitch Harder
2012-12-13 1:28 ` Liu Bo
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=50912846.6020503@oracle.com \
--to=bo.li.liu@oracle.com \
--cc=dave@jikos.cz \
--cc=linux-btrfs@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.