• Chris Mason's avatar
    Btrfs: Only prep for btree deletion balances when nodes are mostly empty · 7b78c170
    Chris Mason authored
    Whenever an item deletion is done, we need to balance all the nodes
    in the tree to make sure we don't end up with an empty node if a pointer
    is deleted.  This balance prep happens from the root of the tree down
    so we can drop our locks as we go.
    
    reada_for_balance was triggering read-ahead on neighboring nodes even
    when no balancing was required.  This adds an extra check to avoid
    calling balance_level() and avoid reada_for_balance() when a balance
    won't be required.
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    7b78c170
ctree.c 106 KB