diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -263,6 +263,30 @@ void bio_init(struct bio *bio) | |||
263 | EXPORT_SYMBOL(bio_init); | 263 | EXPORT_SYMBOL(bio_init); |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * bio_reset - reinitialize a bio | ||
267 | * @bio: bio to reset | ||
268 | * | ||
269 | * Description: | ||
270 | * After calling bio_reset(), @bio will be in the same state as a freshly | ||
271 | * allocated bio returned bio bio_alloc_bioset() - the only fields that are | ||
272 | * preserved are the ones that are initialized by bio_alloc_bioset(). See | ||
273 | * comment in struct bio. | ||
274 | */ | ||
275 | void bio_reset(struct bio *bio) | ||
276 | { | ||
277 | unsigned long flags = bio->bi_flags & (~0UL << BIO_RESET_BITS); | ||
278 | |||
279 | if (bio_integrity(bio)) | ||
280 | bio_integrity_free(bio); | ||
281 | |||
282 | bio_disassociate_task(bio); | ||
283 | |||
284 | memset(bio, 0, BIO_RESET_BYTES); | ||
285 | bio->bi_flags = flags|(1 << BIO_UPTODATE); | ||
286 | } | ||
287 | EXPORT_SYMBOL(bio_reset); | ||
288 | |||
289 | /** | ||
266 | * bio_alloc_bioset - allocate a bio for I/O | 290 | * bio_alloc_bioset - allocate a bio for I/O |
267 | * @gfp_mask: the GFP_ mask given to the slab allocator | 291 | * @gfp_mask: the GFP_ mask given to the slab allocator |
268 | * @nr_iovecs: number of iovecs to pre-allocate | 292 | * @nr_iovecs: number of iovecs to pre-allocate |