Commit 5f04eeb8 authored by Alberto Bertogli's avatar Alberto Bertogli Committed by Jens Axboe

Fix bio_alloc() and bio_kmalloc() documentation

Commit 451a9ebf accidentally broke bio_alloc() and bio_kmalloc() comments by
(almost) swapping them.

This patch fixes that, by placing the comments in the right place.
Signed-off-by: default avatarAlberto Bertogli <albertito@blitiri.com.ar>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent ad0bf110
...@@ -325,8 +325,16 @@ static void bio_fs_destructor(struct bio *bio) ...@@ -325,8 +325,16 @@ static void bio_fs_destructor(struct bio *bio)
* @gfp_mask: allocation mask to use * @gfp_mask: allocation mask to use
* @nr_iovecs: number of iovecs * @nr_iovecs: number of iovecs
* *
* Allocate a new bio with @nr_iovecs bvecs. If @gfp_mask * bio_alloc will allocate a bio and associated bio_vec array that can hold
* contains __GFP_WAIT, the allocation is guaranteed to succeed. * 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: * RETURNS:
* Pointer to new bio on success, NULL on failure. * Pointer to new bio on success, NULL on failure.
...@@ -350,21 +358,13 @@ static void bio_kmalloc_destructor(struct bio *bio) ...@@ -350,21 +358,13 @@ static void bio_kmalloc_destructor(struct bio *bio)
} }
/** /**
* bio_alloc - allocate a bio for I/O * bio_kmalloc - allocate a bio for I/O using kmalloc()
* @gfp_mask: the GFP_ mask given to the slab allocator * @gfp_mask: the GFP_ mask given to the slab allocator
* @nr_iovecs: number of iovecs to pre-allocate * @nr_iovecs: number of iovecs to pre-allocate
* *
* Description: * Description:
* bio_alloc will allocate a bio and associated bio_vec array that can hold * Allocate a new bio with @nr_iovecs bvecs. If @gfp_mask contains
* at least @nr_iovecs entries. Allocations will be done from the * %__GFP_WAIT, the allocation is guaranteed to succeed.
* fs_bio_set. Also see @bio_alloc_bioset.
*
* 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.
* *
**/ **/
struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs) struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment