From: Chris Mason <chris.mason@oracle.com>
To: Giuseppe Scrivano <gscrivano@gnu.org>
Cc: "Pádraig Brady" <P@draigBrady.com>,
"Jim Meyering" <jim@meyering.net>,
bug-coreutils@gnu.org, linux-btrfs@vger.kernel.org
Subject: Re: BTRFS file clone support for cp
Date: Wed, 29 Jul 2009 09:01:06 -0400 [thread overview]
Message-ID: <20090729130106.GF13940@think> (raw)
In-Reply-To: <8763dcvagk.fsf@master.homenet>
On Tue, Jul 28, 2009 at 10:06:35PM +0200, Giuseppe Scrivano wrote:
> Hi P=E1draig,
>=20
>=20
> P=E1draig Brady <P@draigBrady.com> writes:
>=20
> > How different exactly?
> > OK I tried this myself on F11 with inconclusive results.
>=20
> I can't replicate it now, all tests I am doing report that blocks use=
d
> before and after the clone are the same. Probably yesterday the
> difference I noticed was in reality the original file flushed to the
> disk.
The clone will use some additional space for the metadata required to
point to the cloned blocks. It isn't exactly O(1) it is O(metadata for
the file).
>=20
>=20
> > The above suggests that the clone does actually allocate space
> > but btrfs isn't reporting it through statvfs correctly?
>=20
> The same message appeared here too some days ago, though I cloned onl=
y
> few Kb files, not much to fill the entire partition.
>=20
>=20
> > If the clone does allocate space, then how can one
> > clone without allocation which could be very useful
> > for snapshotting for example?
>=20
> I don't know if snapshotting is handled in the same way as a "clone",
> but in this case it seems more obvious to me that no additional space
> should be reported.
The COW for snapshotting and a clone are the same, but the way we get
there is a little different. For a snapshot, we have two btree roots
pointing to the same nodes, and we've incremented the reference count o=
n
each of the nodes they both point to. No matter how big the subvolume
is, this will always be O(number of pointers in the root block).
Cloning a file is done by walking the file metadata and taking a
reference on each extent pointed to by the file. The file data is neve=
r
read in, but all of the file metadata is read in.
>=20
>=20
> > Also I tried the above twice and both times got:
> > http://www.kerneloops.org/submitresult.php?number=3D578993
>=20
> I didn't get these errors. I am using the btrfs git version.
These have been fixed.
-chris
--
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:[~2009-07-29 13:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <87d47o3fip.fsf@master.homenet>
[not found] ` <4A6CEA48.5050208@draigBrady.com>
[not found] ` <8763defuvq.fsf@meyering.net>
[not found] ` <87ws5tvrq8.fsf@master.homenet>
2009-07-27 23:40 ` BTRFS file clone support for cp Pádraig Brady
2009-07-28 20:06 ` Giuseppe Scrivano
2009-07-29 13:01 ` Chris Mason [this message]
2009-07-29 14:14 ` Pádraig Brady
2009-07-29 16:10 ` Chris Mason
2009-07-29 16:18 ` Chris Mason
2009-07-29 18:14 ` Pádraig Brady
2009-07-30 0:57 ` Joel Becker
2009-07-30 7:39 ` Jim Meyering
2009-07-30 8:21 ` Joel Becker
2009-07-30 8:40 ` Pádraig Brady
2009-07-30 16:28 ` Ric Wheeler
2009-07-30 16:48 ` Jim Meyering
2009-07-30 9:26 ` Andi Kleen
2009-07-30 10:02 ` Pádraig Brady
2009-07-30 10:16 ` Jim Meyering
2009-07-30 10:21 ` Tomasz Chmielewski
2009-07-30 10:54 ` Andi Kleen
2009-07-30 18:05 ` Joel Becker
2009-07-30 23:28 ` Pádraig Brady
[not found] ` <87k51r9sxh.fsf@master.homenet>
[not found] ` <4A70C4E0.9030104@draigBrady.com>
2009-07-30 17:28 ` Giuseppe Scrivano
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=20090729130106.GF13940@think \
--to=chris.mason@oracle.com \
--cc=P@draigBrady.com \
--cc=bug-coreutils@gnu.org \
--cc=gscrivano@gnu.org \
--cc=jim@meyering.net \
--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