btrfs-progs/convert
Qu Wenruo 6d881033e1 btrfs-progs: convert: Rework rollback
Rework rollback to a more easy to understand way.

New convert behavior makes us to have a more flex chunk layout, which
only data chunk containing old fs data will be at the same physical
location, while new chunks (data/meta/sys) can be mapped anywhere else.

This behavior makes old rollback behavior can't handle it.
As old behavior assumes all data/meta is mapped in a large chunk, which is
mapped 1:1 on disk.

So rework rollback to handle new convert behavior, enhance the check by
only checking all file extents of convert image, only to check if these
file extents and therir chunks are mapped 1:1.

This new rollback check behavior can handle both new and old convert
behavior, as the new behavior is a superset of old behavior.

Further more, introduce a simple rollback mechanisim:
1) Read reserved data (offset = file offset) from convert image
2) Write reserved data into disk (offset = physical offset)

Since old fs image is a valid fs, and we only need to rollback
superblocks (btrfs reserved ranges), then we just read out data in
reserved range, and write it back.

Due to the fact that all other file extents of converted image is mapped
1:1 on disk, we put the missing piece back, then the fs is as good as
old one.

Then what we do in btrfs is just another dream.

With this new rollback mechanisim, we can open btrfs read-only, so we
won't cause any damage to current btrfs, until the final piece (0~1M,
containing 1st super block) is put back.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ port to v4.10 ]
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-16 17:02:44 +01:00
..
common.c btrfs-progs: remove unused argument from btrfs_csum_data 2017-03-08 13:00:47 +01:00
common.h btrfs-progs: convert: rename members that clash with other functions 2017-03-08 13:00:46 +01:00
main.c btrfs-progs: convert: Rework rollback 2017-03-16 17:02:44 +01:00
Makefile btrfs-progs: build: add stub makefile to convert 2017-03-08 13:00:46 +01:00
source-ext2.c btrfs-progs: convert: rename members that clash with other functions 2017-03-08 13:00:46 +01:00
source-ext2.h btrfs-progs: convert: move ext2 definitions out of main 2017-03-08 13:00:45 +01:00
source-fs.c btrfs-progs: convert: Introduce simple range structure for convert reserved ranges 2017-03-16 17:02:44 +01:00
source-fs.h btrfs-progs: convert: Introduce simple range structure for convert reserved ranges 2017-03-16 17:02:44 +01:00