Re: Copy-on-write hard-links

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux