summaryrefslogtreecommitdiffstats
path: root/block/bio-integrity.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-02-02 18:19:29 +0100
committerJens Axboe <axboe@kernel.dk>2021-02-08 08:33:16 -0700
commit7a800a20ae6329e803c5c646b20811a6ae9ca136 (patch)
tree9c72ec387e817945bde72c5b2e75e633688509c9 /block/bio-integrity.c
parent72b043654ba8b8ce2e0cf3da49247b2db3acb2c1 (diff)
downloadlinux-stable-7a800a20ae6329e803c5c646b20811a6ae9ca136.tar.gz
linux-stable-7a800a20ae6329e803c5c646b20811a6ae9ca136.tar.bz2
linux-stable-7a800a20ae6329e803c5c646b20811a6ae9ca136.zip
block: use bi_max_vecs to find the bvec pool
Instead of encoding of the bvec pool using magic bio flags, just use a helper to find the pool based on the max_vecs value. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bio-integrity.c')
-rw-r--r--block/bio-integrity.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 19617fa326c3..dfa652122a2d 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -28,7 +28,7 @@ static void __bio_integrity_free(struct bio_set *bs,
if (bs && mempool_initialized(&bs->bio_integrity_pool)) {
if (bip->bip_vec)
bvec_free(&bs->bvec_integrity_pool, bip->bip_vec,
- bip->bip_slab);
+ bip->bip_max_vcnt);
mempool_free(bip, &bs->bio_integrity_pool);
} else {
kfree(bip);
@@ -70,14 +70,11 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
memset(bip, 0, sizeof(*bip));
if (nr_vecs > inline_vecs) {
- unsigned long idx = 0;
-
- bip->bip_vec = bvec_alloc(gfp_mask, nr_vecs, &idx,
- &bs->bvec_integrity_pool);
+ bip->bip_max_vcnt = nr_vecs;
+ bip->bip_vec = bvec_alloc(&bs->bvec_integrity_pool,
+ &bip->bip_max_vcnt, gfp_mask);
if (!bip->bip_vec)
goto err;
- bip->bip_max_vcnt = bvec_nr_vecs(idx);
- bip->bip_slab = idx;
} else {
bip->bip_vec = bip->bip_inline_vecs;
bip->bip_max_vcnt = inline_vecs;