This series aims to streamline the logic in cow_file_range_async which is invoked if extents have to be compressed. The main change is that the logic of the loop in the function is now centered around the idea of chunks (in case compression is enabled). So it's obvious that we will submit as many chunks as necessary. The 2nd improvement is to eliminate the BUG_ON that is dependent on the return value of kmalloc. Now, an array of struct async_cow is allocated, preceded by an atomic_t, shared by all chunks. This allows to bail out before submitting any io whatsoever and mark the page as errored out. Rest of the patches are pure quality-of-live improvements - simplifying function signature, removing unused code/redundant data members. Needless to say this has survived full xfstest run. Nikolay Borisov (4): btrfs: Refactor cow_file_range_async btrfs: Remove fs_info from struct async_cow btrfs: Make compress_file_range only struct async_cow btrfs: Replace clear_extent_bit with unlock_extent fs/btrfs/inode.c | 105 +++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 45 deletions(-) -- 2.17.1
