• Qu Wenruo's avatar
    btrfs: relocation: Check cancel request after each data page read · 7f913c7c
    Qu Wenruo authored
    When relocating a data extents with large large data extents, we spend
    most of our time in relocate_file_extent_cluster() at stage "moving data
    extents":
    
     1)               |  btrfs_relocate_block_group [btrfs]() {
     1)               |    relocate_file_extent_cluster [btrfs]() {
     1) $ 6586769 us  |    }
     1) + 18.260 us   |    relocate_file_extent_cluster [btrfs]();
     1) + 15.770 us   |    relocate_file_extent_cluster [btrfs]();
     1) $ 8916340 us  |  }
     1)               |  btrfs_relocate_block_group [btrfs]() {
     1)               |    relocate_file_extent_cluster [btrfs]() {
     1) $ 11611586 us |    }
     1) + 16.930 us   |    relocate_file_extent_cluster [btrfs]();
     1) + 15.870 us   |    relocate_file_extent_cluster [btrfs]();
     1) $ 14986130 us |  }
    
    To make data relocation cancelling quicker, add extra balance cancelling
    check after each page read in relocate_file_extent_cluster().
    
    Cleanup and error handling uses the same mechanism as if the whole
    process finished
    Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    7f913c7c
relocation.c 119 KB