• Kent Overstreet's avatar
    block: Convert integrity to bvec_alloc_bs() · 9f060e22
    Kent Overstreet authored
    This adds a pointer to the bvec array to struct bio_integrity_payload,
    instead of the bvecs always being inline; then the bvecs are allocated
    with bvec_alloc_bs().
    
    Changed bvec_alloc_bs() and bvec_free_bs() to take a pointer to a
    mempool instead of the bioset, so that bio integrity can use a different
    mempool for its bvecs, and thus avoid a potential deadlock.
    
    This is eventually for immutable bio vecs - immutable bvecs aren't
    useful if we still have to copy them, hence the need for the pointer.
    Less code is always nice too, though.
    
    Also, bio_integrity_alloc() was using fs_bio_set if no bio_set was
    specified. This was wrong - using the bio_set doesn't protect us from
    memory allocation failures, because we just used kmalloc for the
    bio_integrity_payload. But it does introduce the possibility of
    deadlock, if for some reason we weren't supposed to be using fs_bio_set.
    Signed-off-by: default avatarKent Overstreet <koverstreet@google.com>
    CC: Jens Axboe <axboe@kernel.dk>
    CC: Martin K. Petersen <martin.petersen@oracle.com>
    9f060e22
bio.h 16.7 KB