• David Sterba's avatar
    btrfs: add cancellable chunk relocation support · 907d2710
    David Sterba authored
    Add support code that will allow canceling relocation on the chunk
    granularity. This is different and independent of balance, that also
    uses relocation but is a higher level operation and manages it's own
    state and pause/cancellation requests.
    
    Relocation is used for resize (shrink) and device deletion so this will
    be a common point to implement cancellation for both. The context is
    entirely in btrfs_relocate_block_group and btrfs_recover_relocation,
    enclosing one chunk relocation. The status bit is set and unset between
    the chunks. As relocation can take long, the effects may not be
    immediate and the request and actual action can slightly race.
    
    The fs_info::reloc_cancel_req is only supposed to be increased and does
    not pair with decrement like fs_info::balance_cancel_req.
    Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    907d2710
relocation.c 109 KB