diff options
Diffstat (limited to 'fs/bio.c')
-rw-r--r-- | fs/bio.c | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -325,8 +325,16 @@ static void bio_fs_destructor(struct bio *bio) | |||
325 | * @gfp_mask: allocation mask to use | 325 | * @gfp_mask: allocation mask to use |
326 | * @nr_iovecs: number of iovecs | 326 | * @nr_iovecs: number of iovecs |
327 | * | 327 | * |
328 | * Allocate a new bio with @nr_iovecs bvecs. If @gfp_mask | 328 | * bio_alloc will allocate a bio and associated bio_vec array that can hold |
329 | * contains __GFP_WAIT, the allocation is guaranteed to succeed. | 329 | * at least @nr_iovecs entries. Allocations will be done from the |
330 | * fs_bio_set. Also see @bio_alloc_bioset and @bio_kmalloc. | ||
331 | * | ||
332 | * If %__GFP_WAIT is set, then bio_alloc will always be able to allocate | ||
333 | * a bio. This is due to the mempool guarantees. To make this work, callers | ||
334 | * must never allocate more than 1 bio at a time from this pool. Callers | ||
335 | * that need to allocate more than 1 bio must always submit the previously | ||
336 | * allocated bio for IO before attempting to allocate a new one. Failure to | ||
337 | * do so can cause livelocks under memory pressure. | ||
330 | * | 338 | * |
331 | * RETURNS: | 339 | * RETURNS: |
332 | * Pointer to new bio on success, NULL on failure. | 340 | * Pointer to new bio on success, NULL on failure. |
@@ -350,21 +358,13 @@ static void bio_kmalloc_destructor(struct bio *bio) | |||
350 | } | 358 | } |
351 | 359 | ||
352 | /** | 360 | /** |
353 | * bio_alloc - allocate a bio for I/O | 361 | * bio_kmalloc - allocate a bio for I/O using kmalloc() |
354 | * @gfp_mask: the GFP_ mask given to the slab allocator | 362 | * @gfp_mask: the GFP_ mask given to the slab allocator |
355 | * @nr_iovecs: number of iovecs to pre-allocate | 363 | * @nr_iovecs: number of iovecs to pre-allocate |
356 | * | 364 | * |
357 | * Description: | 365 | * Description: |
358 | * bio_alloc will allocate a bio and associated bio_vec array that can hold | 366 | * Allocate a new bio with @nr_iovecs bvecs. If @gfp_mask contains |
359 | * at least @nr_iovecs entries. Allocations will be done from the | 367 | * %__GFP_WAIT, the allocation is guaranteed to succeed. |
360 | * fs_bio_set. Also see @bio_alloc_bioset. | ||
361 | * | ||
362 | * If %__GFP_WAIT is set, then bio_alloc will always be able to allocate | ||
363 | * a bio. This is due to the mempool guarantees. To make this work, callers | ||
364 | * must never allocate more than 1 bio at a time from this pool. Callers | ||
365 | * that need to allocate more than 1 bio must always submit the previously | ||
366 | * allocated bio for IO before attempting to allocate a new one. Failure to | ||
367 | * do so can cause livelocks under memory pressure. | ||
368 | * | 368 | * |
369 | **/ | 369 | **/ |
370 | struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs) | 370 | struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs) |
@@ -407,7 +407,7 @@ EXPORT_SYMBOL(zero_fill_bio); | |||
407 | * | 407 | * |
408 | * Description: | 408 | * Description: |
409 | * Put a reference to a &struct bio, either one you have gotten with | 409 | * Put a reference to a &struct bio, either one you have gotten with |
410 | * bio_alloc or bio_get. The last put of a bio will free it. | 410 | * bio_alloc, bio_get or bio_clone. The last put of a bio will free it. |
411 | **/ | 411 | **/ |
412 | void bio_put(struct bio *bio) | 412 | void bio_put(struct bio *bio) |
413 | { | 413 | { |