1BIO_ALLOC_BIOSET(9)              The Linux VFS             BIO_ALLOC_BIOSET(9)
2
3
4

NAME

6       bio_alloc_bioset - allocate a bio for I/O
7

SYNOPSIS

9       struct bio * bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs,
10                                     struct bio_set * bs);
11

ARGUMENTS

13       gfp_mask
14           the GFP_ mask given to the slab allocator
15
16       nr_iovecs
17           number of iovecs to pre-allocate
18
19       bs
20           the bio_set to allocate from.
21

DESCRIPTION

23       If bs is NULL, uses kmalloc to allocate the bio; else the allocation is
24       backed by the bs's mempool.
25
26       When bs is not NULL, if __GFP_WAIT is set then bio_alloc will always be
27       able to allocate a bio. This is due to the mempool guarantees. To make
28       this work, callers must never allocate more than 1 bio at a time from
29       this pool. Callers that need to allocate more than 1 bio must always
30       submit the previously allocated bio for IO before attempting to
31       allocate a new one. Failure to do so can cause deadlocks under memory
32       pressure.
33
34       Note that when running under generic_make_request (i.e. any block
35       driver), bios are not submitted until after you return - see the code
36       in generic_make_request that converts recursion into iteration, to
37       prevent stack overflows.
38
39       This would normally mean allocating multiple bios under
40       generic_make_request would be susceptible to deadlocks, but we have
41       deadlock avoidance code that resubmits any blocked bios from a rescuer
42       thread.
43
44       However, we do not guarantee forward progress for allocations from
45       other mempools. Doing multiple allocations from the same mempool under
46       generic_make_request should be avoided - instead, use bio_set's
47       front_pad for per bio allocations.
48

RETURNS

50       Pointer to new bio on success, NULL on failure.
51
53Kernel Hackers Manual 3.10         June 2019               BIO_ALLOC_BIOSET(9)
Impressum