Btrfs-progs: fix restore of files with compressed extents
authorFilipe David Borba Manana <fdmanana@gmail.com>
Tue, 25 Feb 2014 18:25:39 +0000 (18:25 +0000)
committerChris Mason <clm@fb.com>
Fri, 21 Mar 2014 13:23:28 +0000 (06:23 -0700)
commit4314116bae30d2e9376b07929e6b0e58cddbd9f7
tree8c6bf5bab7292b7781e5b3bf7f206458f1962cb4
parentfbf186bf87e727ccad5f476b54e240e3bd6d2350
Btrfs-progs: fix restore of files with compressed extents

The code was incorrectly adding the file extent items' data offset to the logical
disk address of the extent (bytenr) when the extent is compressed. The offset is
relative to the uncompressed data and not to what we store on disk (compressed).
Also it attempted to copy ram_bytes to destination, which is incorrect when the
data offset field is non-zero, it must use num_bytes instead.

A test case for xfstests follows.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
cmds-restore.c