btrfs-progs: file-item: Fix wrong file extents inserted
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Mon, 19 Dec 2016 06:56:37 +0000 (14:56 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 21 Dec 2016 15:29:06 +0000 (16:29 +0100)
commit95ecaf0d61ae0bd5f70d6ddf79de3a36a24f816d
treec642263f9dd0bc841f361db9d1f5e1e6e4c82f42
parente0485281ed319d99bdae13acdd5c9aed014083d9
btrfs-progs: file-item: Fix wrong file extents inserted

If we specify NO_HOLES incompat feature when converting, the result
image still uses hole file extents.
And further more, the hole is incorrect as its disk_num_bytes is not
zero.

The problem is at btrfs_insert_file_extent() which doesn't check if we
are going to insert hole file extent.

Modify it to skip hole file extents to allow it follow restrict NO_HOLES
flag.

And since no_holes flag can be triggered on half-way, so current fsck
won't report such error, as it consider it as old file holes.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
convert/main.c
file-item.c