Here is v2 of the compressed path cleanups. The main objective was to remove the BUG_ON in cow_file_range_async. This has been achieved by pre-allocating an array large enough to hold all async_cow structs for the given range. In case this allocation fail we just unlock the range and error out the pages.
Changes since v1: * Fixed error handling in patch 1 - now properly cleanup on failure. * Fixed subject of patch 3 * Added patches 4/5 as minor cleanups to the code. Nikolay Borisov (6): btrfs: Refactor cow_file_range_async btrfs: Remove fs_info from struct async_cow btrfs: Make compress_file_range take only struct async_cow btrfs: Replace clear_extent_bit with unlock_extent btrfs: Set iotree only once in submit_compressed_extents btrfs: Factor out common extent locking code in submit_compressed_extents fs/btrfs/inode.c | 129 +++++++++++++++++++++++++++-------------------- 1 file changed, 73 insertions(+), 56 deletions(-) -- 2.17.1