summaryrefslogtreecommitdiff
path: root/convert/main.c
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2016-12-19 14:56:37 +0800
committerDavid Sterba <dsterba@suse.com>2016-12-21 16:29:06 +0100
commit95ecaf0d61ae0bd5f70d6ddf79de3a36a24f816d (patch)
treec642263f9dd0bc841f361db9d1f5e1e6e4c82f42 /convert/main.c
parente0485281ed319d99bdae13acdd5c9aed014083d9 (diff)
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>
Diffstat (limited to 'convert/main.c')
-rw-r--r--convert/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/convert/main.c b/convert/main.c
index fd6f77b2..15f14af2 100644
--- a/convert/main.c
+++ b/convert/main.c
@@ -336,7 +336,7 @@ static int record_file_blocks(struct blk_iterate_data *data,
key.offset > cur_off);
fi = btrfs_item_ptr(node, slot, struct btrfs_file_extent_item);
extent_disk_bytenr = btrfs_file_extent_disk_bytenr(node, fi);
- extent_num_bytes = btrfs_file_extent_disk_num_bytes(node, fi);
+ extent_num_bytes = btrfs_file_extent_num_bytes(node, fi);
BUG_ON(cur_off - key.offset >= extent_num_bytes);
btrfs_release_path(&path);