public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: jim owens <jowens@hp.com>
Cc: CSights <csights@fastmail.fm>, linux-btrfs@vger.kernel.org
Subject: Re: metadata copied/data not copied?
Date: Mon, 16 Mar 2009 20:25:45 -0400	[thread overview]
Message-ID: <1237249545.3814.4.camel@think.oraclecorp.com> (raw)
In-Reply-To: <49BE7003.2050404@hp.com>

On Mon, 2009-03-16 at 11:28 -0400, jim owens wrote:
> CSights wrote:
> > Hi everyone,
> > 	I'm curious what would happen in btrfs if the following commands were issued:
> > 
> > # cp file1 file2
> > # chown newuser:newgroup file2
> > 
> > Where file1 was owned by olduser:oldgroup.
> > 
> > 
> > 	If I understand copy-on-write correctly the "cp" would merely create a new 
> > pointer (or whatever it is called :( ) containing the files' metadata but the 
> > file contents would not actually be duplicated.
> 
> NO.  The concept you describe requires "deduplicate".
> 
> What you are forgetting is that "cp" is a user-space program that
> reads data and writes it to a new file.  The kernel does not see
> this as a Copy.
> 

This is true, cp makes a full copy of the file.

The btrfs utilities include a program called bcp that makes a COW copy
of a single file (or directory tree) with a btrfs specific ioctl.

-chris



  reply	other threads:[~2009-03-17  0:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-16 14:35 metadata copied/data not copied? CSights
2009-03-16 15:28 ` jim owens
2009-03-17  0:25   ` Chris Mason [this message]
2009-03-17 15:34     ` CSights
2009-03-17 15:56       ` Chris Mason
2009-03-17 17:08         ` CSights
2009-03-17 17:24           ` Chris Mason
2009-03-16 21:14 ` Dmitri Nikulin
2009-03-16 21:18   ` Dmitri Nikulin

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=1237249545.3814.4.camel@think.oraclecorp.com \
    --to=chris.mason@oracle.com \
    --cc=csights@fastmail.fm \
    --cc=jowens@hp.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