Thread (18 messages) 18 messages, 11 authors, 2012-01-19

Re: [PATCH 0/2] btrfs: allow cross-subvolume BTRFS_IOC_CLONE

From: David Sterba <hidden>
Date: 2012-01-06 17:57:13

On Fri, Jan 06, 2012 at 02:04:12PM +0200, Konstantinos Skarlatos wrote:
Me too wants cp --reflink across subvolumes. Please make this feature 
available to us, as its a "poor man's dedupe" and would give big space 
savings for many use cases.
The simple case of 'cp --reflink' works fine, the only remaining case is
the unimplemented clone of part of a compressed inline extent. And it has
to be:
  * at least 2 blocks uncompressed
  * the cloned range does not span the whole extent

The ioctl needs ranges and length aligned up to blocksize, ie. 4096,
cloning of short inline extents work.

The missing case can be reproduced with this:

---
#!/bin/sh

# assume, that fs is mounted with compression on
src=test-clone-compressed-inline
dd if=/dev/zero of="$src" bs=1K count=3 oflag=sync
sync
filefrag -vbs "$src"
clone_range "$src" 4096 4096 subvol2/"$src"-dest0 0
clone_range "$src" 4096 4096 subvol2/"$src"-dest4096 4096
clone_range "$src" 4096 4096 subvol2/"$src"-dest8192 8192

---

$ ./test-clone-range-inline
3+0 records in
3+0 records out
3072 bytes (3.1 kB) copied, 0.0487466 s, 63.0 kB/s
Filesystem type is: 9123683e
File size of test-clone-compressed-inline is 3072 (3 blocks, blocksize 1024)
 ext logical physical expected length flags
   0       0        0            4096 not_aligned,inline,eof
test-clone-compressed-inline: 1 extent found
clone_range test-clone-compressed-inline 3 4096~4096 to subvol2/test-clone-compressed-inline-dest0 4 0 = -1 Invalid argument
clone_range test-clone-compressed-inline 3 4096~4096 to subvol2/test-clone-compressed-inline-dest4096 4 4096 = -1 Invalid argument
clone_range test-clone-compressed-inline 3 4096~4096 to subvol2/test-clone-compressed-inline-dest8192 4 8192 = -1 Invalid argument

---

This does not work on a single subvolume, so extending clone to span
subvolumes should not break anything that hasn't been broken already.


david
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help