aboutsummaryrefslogtreecommitdiffstats
path: root/fs/bio.c
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2009-06-26 09:37:49 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-07-01 04:56:25 -0400
commit7878cba9f0037f5599004b03a1260b32d9050360 (patch)
treebff5e1a47b6e64e45df0428925cc6db8542cad62 /fs/bio.c
parent6118b70b3a0b4c583439bb77600194c82f220ce3 (diff)
block: Create bip slabs with embedded integrity vectors
This patch restores stacking ability to the block layer integrity infrastructure by creating a set of dedicated bip slabs. Each bip slab has an embedded bio_vec array at the end. This cuts down on memory allocations and also simplifies the code compared to the original bvec version. Only the largest bip slab is backed by a mempool. The pool is contained in the bio_set so stacking drivers can ensure forward progress. Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Jens Axboe <axboe@carl.(none)>
Diffstat (limited to 'fs/bio.c')
-rw-r--r--fs/bio.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 24c914043532..1486b19fc431 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -238,7 +238,7 @@ void bio_free(struct bio *bio, struct bio_set *bs)
238 bvec_free_bs(bs, bio->bi_io_vec, BIO_POOL_IDX(bio)); 238 bvec_free_bs(bs, bio->bi_io_vec, BIO_POOL_IDX(bio));
239 239
240 if (bio_integrity(bio)) 240 if (bio_integrity(bio))
241 bio_integrity_free(bio); 241 bio_integrity_free(bio, bs);
242 242
243 /* 243 /*
244 * If we have front padding, adjust the bio pointer before freeing 244 * If we have front padding, adjust the bio pointer before freeing
@@ -341,7 +341,7 @@ struct bio *bio_alloc(gfp_t gfp_mask, int nr_iovecs)
341static void bio_kmalloc_destructor(struct bio *bio) 341static void bio_kmalloc_destructor(struct bio *bio)
342{ 342{
343 if (bio_integrity(bio)) 343 if (bio_integrity(bio))
344 bio_integrity_free(bio); 344 bio_integrity_free(bio, fs_bio_set);
345 kfree(bio); 345 kfree(bio);
346} 346}
347 347
@@ -472,7 +472,7 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)
472 if (bio_integrity(bio)) { 472 if (bio_integrity(bio)) {
473 int ret; 473 int ret;
474 474
475 ret = bio_integrity_clone(b, bio, gfp_mask); 475 ret = bio_integrity_clone(b, bio, gfp_mask, fs_bio_set);
476 476
477 if (ret < 0) { 477 if (ret < 0) {
478 bio_put(b); 478 bio_put(b);
@@ -1539,6 +1539,7 @@ void bioset_free(struct bio_set *bs)
1539 if (bs->bio_pool) 1539 if (bs->bio_pool)
1540 mempool_destroy(bs->bio_pool); 1540 mempool_destroy(bs->bio_pool);
1541 1541
1542 bioset_integrity_free(bs);
1542 biovec_free_pools(bs); 1543 biovec_free_pools(bs);
1543 bio_put_slab(bs); 1544 bio_put_slab(bs);
1544 1545
@@ -1579,6 +1580,9 @@ struct bio_set *bioset_create(unsigned int pool_size, unsigned int front_pad)
1579 if (!bs->bio_pool) 1580 if (!bs->bio_pool)
1580 goto bad; 1581 goto bad;
1581 1582
1583 if (bioset_integrity_create(bs, pool_size))
1584 goto bad;
1585
1582 if (!biovec_create_pools(bs, pool_size)) 1586 if (!biovec_create_pools(bs, pool_size))
1583 return bs; 1587 return bs;
1584 1588
@@ -1616,6 +1620,7 @@ static int __init init_bio(void)
1616 if (!bio_slabs) 1620 if (!bio_slabs)
1617 panic("bio: can't allocate bios\n"); 1621 panic("bio: can't allocate bios\n");
1618 1622
1623 bio_integrity_init();
1619 biovec_init_slabs(); 1624 biovec_init_slabs();
1620 1625
1621 fs_bio_set = bioset_create(BIO_POOL_SIZE, 0); 1626 fs_bio_set = bioset_create(BIO_POOL_SIZE, 0);