• Boris Burkov's avatar
    btrfs: preallocate ulist memory for qgroup rsv · 33336c18
    Boris Burkov authored
    When qgroups are enabled, during data reservation, we allocate the
    ulist_nodes that track the exact reserved extents with GFP_ATOMIC
    unconditionally. This is unnecessary, and we can follow the model
    already employed by the struct extent_state we preallocate in the non
    qgroups case, which should reduce the risk of allocation failures with
    GFP_ATOMIC.
    
    Add a prealloc node to struct ulist which ulist_add will grab when it is
    present, and try to allocate it before taking the tree lock while we can
    still take advantage of a less strict gfp mask. The lifetime of that
    node belongs to the new prealloc field, until it is used, at which point
    it belongs to the ulist linked list.
    Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
    Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarBoris Burkov <boris@bur.io>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    33336c18
extent-io-tree.c 49.6 KB