---
name: "blk_rq_prep_clone"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/blk_rq_prep_clone"
---

# blk\_rq\_prep\_clone(9)

Helper function to setup clone request

## NAME

blk\_rq\_prep\_clone - Helper function to setup clone request

## SYNOPSIS

**int blk\_rq\_prep\_clone(struct request \*** *rq***, struct request \*** *rq\_src***, struct bio\_set \*** *bs***, gfp\_t** *gfp\_mask***, int (\****bio\_ctr***) (struct bio \*, struct bio \*, void \*), void \*** *data***);**

## ARGUMENTS

*rq*

the request to be setup

*rq\_src*

original request to be cloned

*bs*

bio\_set that bios for clone are allocated from

*gfp\_mask*

memory allocation mask for bio

*bio\_ctr*

setup function to be called for each clone bio. Returns **0** for success, non **0** for failure.

*data*

private data to be passed to *bio\_ctr*

## DESCRIPTION

Clones bios in *rq\_src* to *rq*, and copies attributes of *rq\_src* to *rq*. The actual data parts of *rq\_src* (e.g. -\>cmd, -\>sense) are not copied, and copying such parts is the caller's responsibility. Also, pages which the original bios are pointing to are not copied and the cloned bios just point same pages. So cloned bios must be completed before original bios, which means the caller must complete *rq* before *rq\_src*.

## COPYRIGHT
