• Chris Mason's avatar
    Btrfs: allow balance to explicitly allocate chunks as it relocates · c87f08ca
    Chris Mason authored
    Btrfs device shrinking and balancing ends up reallocating all the blocks
    in order to allow COW to move them to new destinations.  It is somewhat
    awkward in terms of ENOSPC because most of the enospc code is built
    around the idea that some operation on a reference counted tree triggers
    allocations in the non-reference counted trees.
    
    This commit changes the balancing code to deal with enospc by trying to
    allocate a new chunk.  If that allocation succeeds, we go ahead and
    retry whatever failed due to enospc.
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    c87f08ca
relocation.c 103 KB