btrfs-progs: convert: Introduce function to check if convert image is able to be...
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Thu, 23 Feb 2017 07:46:46 +0000 (15:46 +0800)
committerDavid Sterba <dsterba@suse.com>
Thu, 16 Mar 2017 16:02:44 +0000 (17:02 +0100)
commit1170ac3079005a99098e48777513e5ab09b64d55
treea87c237da8abecba30181bcdd49996db72fbc612
parentb82b12265b976bdb044a752bfd27b2494edfffbd
btrfs-progs: convert: Introduce function to check if convert image is able to be rolled back

Introduce a function, check_convert_image() to check if that image is
rollback-able.

This means all file extents except one of the btrfs reserved ranges, must
be mapped 1:1 on disk.

1:1 mapped file extents must match the following conditions:

1) Their file_offset(key.offset) matches its disk_bytenr
2) The corresponding chunk must be mapped 1:1 on disk
   That's to say, it's a SINGLE chunk, and chunk logical matches with
   stripe physical.

Above 2 conditions ensured that file extent lies the exactly the same
position as in the old filesystem.

For data in reserved ranges of btrfs, they are relocated to new places,
and in that case, we use btrfs_read_file() to read out the content for
later rollback use.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
convert/main.c