From: "Yan Zheng" <yanzheng@21cn.com>
To: linux-btrfs@vger.kernel.org
Subject: Algorithm for nodatacow is broken
Date: Wed, 16 Jul 2008 15:41:36 +0800 [thread overview]
Message-ID: <3d0408630807160041h20d2157agfc221b34a836df87@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]
Hello,
Yesterday, I realized the algorithm for nodatacow is broken, it can't
reliably detect whether a given extent is referenced by only one
snapshot.
Let me use the attached picture to describe the issue.
Figure (1) shows the initial tree structure. there is only one fs tree A.
Figure (2) shows the tree structure after we create a snapshot of fs
tree A. The new snapshot's root node is B.
Figure (3) shows the situation after we modified leaf node L. Before
we modified leaf node L, the tree is in the state showed figure (1)
Figure (4) shows the situation after we modified leaf node L when
snapshot B exists.
In the figures, the color of rectangle is used to differentiate
between tree nodes belongs to different owners (owner field in tree
node header). Node A' is the shadow copy of node A, leaf L' is the
shadow copy of L.
When nodatacow option is enable, btrfs_count_snapshots_in_path is used
to detect whether a given extent is referenced by only one snapshot.
It uses backref info for tree blocks in btrfs_path and file extent to
do the complex work. In the example showed in figure (3) or figure
(4), backref info for node A', leaf L' and file extent are used.
We can find that the backref info used in the case showed in figure
(3) and in the case showed in figure (4) are same. But in figure (3),
the file extent is referenced by one snapshot; in figure (4), the file
extent is referenced by two snapshots. In both cases,
btrfs_count_snapshots_in_path return 1.
Regards
YZ
[-- Attachment #2: nocow.jpg --]
[-- Type: image/jpeg, Size: 35678 bytes --]
next reply other threads:[~2008-07-16 7:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-16 7:41 Yan Zheng [this message]
2008-07-16 13:15 ` Algorithm for nodatacow is broken Chris Mason
2008-07-17 12:45 ` Chris Mason
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=3d0408630807160041h20d2157agfc221b34a836df87@mail.gmail.com \
--to=yanzheng@21cn.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox