Commit Graph

30 Commits (886a8565e03bfacddc1383fe61439303226a8802)

Author SHA1 Message Date
David Sterba ca92914804 btrfs-progs: convert: improve assert in make_convert_btrfs
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba 52319450e7 btrfs-progs: convert: rename members that clash with other functions
Rename 'free' and also 'used' for consistency.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba e945e27712 btrfs-progs: mkfs: clear whole mkfs_cfg at once
Zero out the structure and set only the requested fields.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba 1f739d73e3 btrfs-progs: convert: move internal bg size definition
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba 39aa42147a btrfs-progs: convert: rename ext2 function to create a symlink
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba f6dfc0263d btrfs-progs: build: add stub makefile to convert
A shortcut to compile btrfs-convert from inside the directory.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba 0c362b9031 btrfs-progs: convert: use bit field for convert flags
Use one flag field instead of several variables. The change cascades
down to the callchain and modifies several functions.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba c45a060f3e btrfs-progs: convert: use helper for special inode number check
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba 9368a77456 btrfs-progs: convert: better error handling in ext2_read_used_space
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba 5bcff79f14 btrfs-progs: convert: remove unused includes
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba 4927a9b268 btrfs-progs: convert: use on-stack buffer for subvol name dir
Get rid of dynamic allocation.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba 6b74f2fbe3 btrfs-progs: convert: use fixed lenght array for source fs name
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba cf83a41a02 btrfs-progs: convert: move struct initialization to the init function
The context is zeroed in convert_open_fs after and overwrites the rbtree
initialization, which accidentally is the same (NULL).

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba f989881ccd btrfs-progs: convert: update some forward declarations
Add missing and reorder so they come next to the structures using them.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba c0acc29c99 btrfs-progs: convert: use wider types types for inode counts for progress reports
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba 0a5d16eca7 btrfs-progs: mkfs: make list of source fs more visible
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:46 +01:00
David Sterba 3a724cbde0 btrfs-progs: convert: move implementation for interal conversion API to own file
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:45 +01:00
David Sterba 03c085861b btrfs-progs: convert: move ext2 conversion out of main.c
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:45 +01:00
David Sterba 27e927e775 btrfs-progs: convert: move ext2 definitions out of main
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:45 +01:00
David Sterba 2798a5df33 btrfs-progs: convert: move definitions for interal conversion API to own file
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:45 +01:00
David Sterba 14f9565c11 btrfs-progs: move fs features declarations to own header from utils
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:45 +01:00
David Sterba 203c52a850 btrfs-progs: convert: move common api implementation to own file
Lots of moved code but no actual changes.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:45 +01:00
David Sterba 5f276edfda btrfs-progs: move convert definitions to own header
Create a header for filesystem conversion API, the config and the main
entry function.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:45 +01:00
David Sterba ad7c469ac3 btrfs-progs: move mkfs definitions to own header
Create a header for filesystem creation API, the config and the main
entry function.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:45 +01:00
David Sterba 1c880f34f1 btrfs-progs: move help defines to own header
Signed-off-by: David Sterba <dsterba@suse.com>
2017-03-08 13:00:45 +01:00
David Sterba c855e60f7e btrfs-progs: mkfs/convert: separate the convert part from make_btrfs
The regulare mkfs_btrfs does not anything special about convert and just
passes the arguments. Make that two functions.

Signed-off-by: David Sterba <dsterba@suse.com>
2017-01-27 12:20:43 +01:00
Qu Wenruo 95ecaf0d61 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>
2016-12-21 16:29:06 +01:00
Chandan Rajendra 71ffdb50ec btrfs-progs: convert: Fix migrate_super_block() to work with 64k sectorsize
migrate_super_block() uses sectorsize to refer to the size of the
superblock. Hence on 64k sectorsize filesystems, it ends up computing
checksum beyond the super block length (i.e.
BTRFS_SUPER_INFO_SIZE). This commit fixes the bug by using
BTRFS_SUPER_INFO_SIZE instead of sectorsize of the underlying
filesystem.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-12-14 15:21:17 +01:00
Chandan Rajendra 8583b61309 btrfs-progs: convert: Prevent accounting blocks beyond end of device
When looping across data block bitmap, __ext2_add_one_block() may add
blocks which do not exist on the underlying disk. This commit prevents
this from happening by checking the block index against the maximum
block count that was present in the ext4 filesystem instance that is
being converted.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-12-14 15:06:36 +01:00
David Sterba dee762489e btrfs-progs: move btrfs-convert to own directory
Signed-off-by: David Sterba <dsterba@suse.com>
2016-12-14 15:06:35 +01:00