summaryrefslogtreecommitdiffstats
path: root/lib/ratelimit.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2017-08-10 22:54:51 +0100
committerDavid Sterba <dsterba@suse.com>2017-08-21 17:47:42 +0200
commit72610b1b40005fa19a107ea62b8bcc0ca84ef11b (patch)
tree1cabb69b720df32322b310fa46c966500f27d6ee /lib/ratelimit.c
parentf716abd55d1e141772fd44a99c07c89f4aff1978 (diff)
downloadop-kernel-dev-72610b1b40005fa19a107ea62b8bcc0ca84ef11b.zip
op-kernel-dev-72610b1b40005fa19a107ea62b8bcc0ca84ef11b.tar.gz
Btrfs: incremental send, fix emission of invalid clone operations
When doing an incremental send it's possible that the computed send stream contains clone operations that will fail on the receiver if the receiver has compression enabled and the clone operations target a sector sized extent that starts at a zero file offset, is not compressed on the source filesystem but ends up being compressed and inlined at the destination filesystem. Example scenario: $ mkfs.btrfs -f /dev/sdb $ mount -o compress /dev/sdb /mnt # By doing a direct IO write, the data is not compressed. $ xfs_io -f -d -c "pwrite -S 0xab 0 4K" /mnt/foobar $ btrfs subvolume snapshot -r /mnt /mnt/mysnap1 $ xfs_io -c "reflink /mnt/foobar 0 8K 4K" /mnt/foobar $ btrfs subvolume snapshot -r /mnt /mnt/mysnap2 $ btrfs send -f /tmp/1.snap /mnt/mysnap1 $ btrfs send -f /tmp/2.snap -p /mnt/mysnap1 /mnt/mysnap2 $ umount /mnt $ mkfs.btrfs -f /dev/sdc $ mount -o compress /dev/sdc /mnt $ btrfs receive -f /tmp/1.snap /mnt $ btrfs receive -f /tmp/2.snap /mnt ERROR: failed to clone extents to foobar Operation not supported The same could be achieved by mounting the source filesystem without compression and doing a buffered IO write instead of a direct IO one, and mounting the destination filesystem with compression enabled. So fix this by issuing regular write operations in the send stream instead of clone operations when the source offset is zero and the range has a length matching the sector size. Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Chris Mason <clm@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'lib/ratelimit.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud