• Jens Axboe's avatar
    brd: check for REQ_NOWAIT and set correct page allocation mask · 6ded703c
    Jens Axboe authored
    If REQ_NOWAIT is set, then do a non-blocking allocation if the operation
    is a write and we need to insert a new page. Currently REQ_NOWAIT cannot
    be set as the queue isn't marked as supporting nowait, this change is in
    preparation for allowing that.
    
    radix_tree_preload() warns on attempting to call it with an allocation
    mask that doesn't allow blocking. While that warning could arguably
    be removed, we need to handle radix insertion failures anyway as they
    are more likely if we cannot block to get memory.
    
    Remove legacy BUG_ON()'s and turn them into proper errors instead, one
    for the allocation failure and one for finding a page that doesn't
    match the correct index.
    
    Cc: stable@vger.kernel.org # 5.10+
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    6ded703c
brd.c 12.3 KB