---
name: "blk_make_request"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/blk_make_request"
---

# blk\_make\_request(9)

given a bio, allocate a corresponding struct request.

## NAME

blk\_make\_request - given a bio, allocate a corresponding struct request.

## SYNOPSIS

**struct request \* blk\_make\_request(struct request\_queue \*** *q***, struct bio \*** *bio***, gfp\_t** *gfp\_mask***);**

## ARGUMENTS

*q*

target request queue

*bio*

The bio describing the memory mappings that will be submitted for IO. It may be a chained-bio properly constructed by block/bio layer.

*gfp\_mask*

gfp flags to be used for memory allocation

## DESCRIPTION

blk\_make\_request is the parallel of generic\_make\_request for BLOCK\_PC type commands. Where the struct request needs to be farther initialized by the caller. It is passed a struct bio, which describes the memory info of the I/O transfer.

The caller of blk\_make\_request must make sure that bi\_io\_vec are set to describe the memory buffers. That **bio\_data\_dir** will return the needed direction of the request. (And all bio's in the passed bio-chain are properly set accordingly)

If called under none-sleepable conditions, mapped bio buffers must not need bouncing, by calling the appropriate masked or flagged allocator, suitable for the target device. Otherwise the call to blk\_queue\_bounce will BUG.

## WARNING

When allocating/cloning a bio-chain, careful consideration should be given to how you allocate bios. In particular, you cannot use \_\_GFP\_WAIT for anything but the first bio in the chain. Otherwise you risk waiting for IO completion of a bio that hasn't been submitted yet, thus resulting in a deadlock. Alternatively bios should be allocated using **bio\_kmalloc** instead of **bio\_alloc**, as that avoids the mempool deadlock. If possible a big IO should be split into smaller parts when allocation fails. Partial allocation should not be an error, or you risk a live-lock.

## COPYRIGHT
