summaryrefslogtreecommitdiff
path: root/btrfs-convert.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2014-11-25 17:35:52 +0800
committerDavid Sterba <dsterba@suse.cz>2014-11-25 19:39:44 +0100
commitad96e8f4d656b6b46253b2122a96d5e9c4a17b18 (patch)
treed15c4f9fcc62480001c4736dd26bb0ed13bbfeea /btrfs-convert.c
parentb5e1ca5a49eade75bd411d0f6b5c6adb2257de31 (diff)
Btrfs-progs: fix a bug of converting sparse ext2/3/4
When converting a sparse ext* filesystem, btrfs-convert adds checksum extents for empty extents, whose disk_bytenr = 0, and this can end up with some weird problems, one of them is the failure of reading free space cache inode on mounting converted btrfs. The fix is simple, just to skip making checksum on empty extents. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'btrfs-convert.c')
-rw-r--r--btrfs-convert.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/btrfs-convert.c b/btrfs-convert.c
index a544fc64..02c5e94c 100644
--- a/btrfs-convert.c
+++ b/btrfs-convert.c
@@ -393,7 +393,7 @@ static int record_file_blocks(struct btrfs_trans_handle *trans,
ret = btrfs_record_file_extent(trans, root, objectid, inode, file_pos,
disk_bytenr, num_bytes);
- if (ret || !checksum)
+ if (ret || !checksum || disk_bytenr == 0)
return ret;
return csum_disk_extent(trans, root, disk_bytenr, num_bytes);