From: Gordan Bobic <gordan@bobich.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: Copy-on-write hard-links
Date: Thu, 10 Jun 2010 21:20:10 +0100 [thread overview]
Message-ID: <4C1148FA.40003@bobich.net> (raw)
In-Reply-To: <20100610200024.GB4366@think.oraclecorp.com>
On 06/10/2010 09:00 PM, Chris Mason wrote:
> On Thu, Jun 10, 2010 at 06:11:40PM +0100, Gordan Bobic wrote:
>> Is there a feature in btrfs to manually/explicitly mark hard-links
>> to be copy-on-write? My understanding is that this is what happens
>> when a snapshot is mounted rw and files modified.
>>
>> Consider this scenario:
>>
>> I have a base template fs. I make two snapshots of it that are
>> identical. The files in the template and both snapshots are
>> hard-links and have the same inode number.
>>
>> I change a file in one of the snapshots, and it gets copied on
>> write. I make the same change in the other snapshot, and that, too,
>> gets copied on write. I now have two identical files that are not
>> hard-links any more.
>>
>> What happens if I remove one of those files and create a hard-link
>> to the file in the other snapshot?
>
> I'm afraid you can't do this. hard linking between subvolumes isn't
> allowed. But, what you can do is use the clone ioctl to make a new
> inode that references all of the data extents of an existing file, which
> would be a kind of COW hard link.
>
> Checkout bcp from btrfs-progs or cp --reflink from the latest..well
> wherever cp comes from.
Would the inodes on the clone file be the same for purposes of loading a
dynamic library? Specifically, say the file I am cloning is a DLL.
Normally, if a DLL is hard-linked, if two programs dynamically load it
from two different hard-links, it'll still only use one bit of shared
memory. Will this also hold true for the cloned files? My understanding
is that it will not since it's not the same inode. Is that the case?
Thanks.
Gordan
prev parent reply other threads:[~2010-06-10 20:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-10 17:11 Copy-on-write hard-links Gordan Bobic
2010-06-10 20:00 ` Chris Mason
2010-06-10 20:20 ` Gordan Bobic [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=4C1148FA.40003@bobich.net \
--to=gordan@bobich.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;
as well as URLs for NNTP newsgroup(s).