• Chris Mason's avatar
    Btrfs: leave btree locks spinning more often · b9473439
    Chris Mason authored
    btrfs_mark_buffer dirty would set dirty bits in the extent_io tree
    for the buffers it was dirtying.  This may require a kmalloc and it
    was not atomic.  So, anyone who called btrfs_mark_buffer_dirty had to
    set any btree locks they were holding to blocking first.
    This commit changes dirty tracking for extent buffers to just use a flag
    in the extent buffer.  Now that we have one and only one extent buffer
    per page, this can be safely done without losing dirty bits along the way.
    This also introduces a path->leave_spinning flag that callers of
    btrfs_search_slot can use to indicate they will properly deal with a
    path returned where all the locks are spinning instead of blocking.
    Many of the btree search callers now expect spinning paths,
    resulting in better btree concurrency overall.
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>