__btrfs_map_block is probably one of the longest functions in btrfs and is responsible for mapping high-level RW requests to a logical address to lower-level bios that are sent to multiple devices (depending on the allocation profile the block group this address belongs to). Additionally, it's also used to calculate the various characteristic of the given (address,len) tuple such as the internal stripe len that remains if the given request is satisfied. This conflation of 2 actions make it a bit hard to follow the function, this patchset aims to rectify this by factoring out the "address calculation mechanics" into a separate function. To reduce the number of variables having to pass also introduce a struct with the same name that holds all the output values. Nikolay Borisov (3): btrfs: Introduce struct btrfs_io_geometry btrfs: Introduce btrfs_io_geometry btrfs: Use btrfs_io_geometry appropriately fs/btrfs/inode.c | 25 +++---- fs/btrfs/volumes.c | 169 +++++++++++++++++++++++++++++---------------- fs/btrfs/volumes.h | 11 +++ 3 files changed, 133 insertions(+), 72 deletions(-) -- 2.17.1
