bio_alloc(9)

bio_alloc9

Allocate a new bio, memory pool backed

Usage

struct bio * bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs);

Arguments

gfp_mask

allocation mask to use

nr_iovecs

number of iovecs

Overview

bio_alloc will allocate a bio and associated bio_vec array that can hold at least nr_iovecs entries. Allocations will be done from the fs_bio_set. Also see bio_alloc_bioset and bio_kmalloc.

If __GFP_WAIT is set, then bio_alloc will always be able to allocate a bio. This is due to the mempool guarantees. To make this work, callers must never allocate more than 1 bio at a time from this pool. Callers that need to allocate more than 1 bio must always submit the previously allocated bio for IO before attempting to allocate a new one. Failure to do so can cause livelocks under memory pressure.

Returns

Pointer to new bio on success, NULL on failure.

Releases

2 releases since Debian 6.0 (Squeeze); the text changed 1 time.

  1. 6.0
  2. 7

From linux-manual-3.2 3.2.78-1 in Debian 7 (Wheezy). Parsed by carta from the page's man source.