diff options
author | Filipe Manana <fdmanana@suse.com> | 2017-04-04 20:31:00 +0100 |
---|---|---|
committer | Filipe Manana <fdmanana@suse.com> | 2017-04-26 16:27:25 +0100 |
commit | e1cbfd7bf6dabdac561c75d08357571f44040a45 (patch) | |
tree | 82b74cd579e2fb39362aa4cc86112ca6e8f43544 /fs/btrfs/btrfs_inode.h | |
parent | be2d253cc98244765323a7c94cc1ac5cd5a17072 (diff) |
Btrfs: send, fix file hole not being preserved due to inline extent
Normally we don't have inline extents followed by regular extents, but
there's currently at least one harmless case where this happens. For
example, when the page size is 4Kb and compression is enabled:
$ mkfs.btrfs -f /dev/sdb
$ mount -o compress /dev/sdb /mnt
$ xfs_io -f -c "pwrite -S 0xaa 0 4K" -c "fsync" /mnt/foobar
$ xfs_io -c "pwrite -S 0xbb 8K 4K" -c "fsync" /mnt/foobar
In this case we get a compressed inline extent, representing 4Kb of
data, followed by a hole extent and then a regular data extent. The
inline extent was not expanded/converted to a regular extent exactly
because it represents 4Kb of data. This does not cause any apparent
problem (such as the issue solved by commit e1699d2d7bf6
("btrfs: add missing memset while reading compressed inline extents"))
except trigger an unexpected case in the incremental send code path
that makes us issue an operation to write a hole when it's not needed,
resulting in more writes at the receiver and wasting space at the
receiver.
So teach the incremental send code to deal with this particular case.
The issue can be currently triggered by running fstests btrfs/137 with
compression enabled (MOUNT_OPTIONS="-o compress" ./check btrfs/137).
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Diffstat (limited to 'fs/btrfs/btrfs_inode.h')
0 files changed, 0 insertions, 0 deletions