---
name: "bio_alloc"
section: "9"
platform: "linux"
package: "linux-manual-3.2"
version: "3.2.78-1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/bio_alloc"
---

# bio\_alloc(9)

allocate a new bio, memory pool backed

## NAME

bio\_alloc - allocate a new bio, memory pool backed

## SYNOPSIS

**struct bio \* bio\_alloc(gfp\_t** *gfp\_mask***, unsigned int** *nr\_iovecs***);**

## ARGUMENTS

*gfp\_mask*

allocation mask to use

*nr\_iovecs*

number of iovecs

## DESCRIPTION

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.

## COPYRIGHT
