btrfs-progs: convert: Introduce function to calculate the available space
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Fri, 29 Jan 2016 05:03:13 +0000 (13:03 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Jun 2016 16:15:19 +0000 (18:15 +0200)
commit522ef705e38fdb9ae952344b454da392e60dc90d
tree2f36fd78399c4743f3db0ff701194e649a2712f1
parent9d615049d223a473f96bfcfc174f05a293cc163f
btrfs-progs: convert: Introduce function to calculate the available space

Introduce a new function, calculate_available_space() to get available
space cache_tree data_chunks cache_tree.

Unlike old implementation, this function will do the new work:

1) batch used ext* data space.
   To ensure data chunks will recovery them all.
   And restore the result into mkfs_cfg->convert_data_chunks for later
   use.

2) avoid SB and reserved space at chunk level
   Both batched data space or free space will not cover reserved space,
   like SB or the first 1M.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
btrfs-convert.c