aboutsummaryrefslogtreecommitdiffstats
path: root/fs/bio-integrity.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/bio-integrity.c')
-rw-r--r--fs/bio-integrity.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index 49a34e7f7306..612a5c38d3c1 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -24,6 +24,7 @@
24#include <linux/mempool.h> 24#include <linux/mempool.h>
25#include <linux/bio.h> 25#include <linux/bio.h>
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
27#include <linux/slab.h>
27 28
28struct integrity_slab { 29struct integrity_slab {
29 struct kmem_cache *slab; 30 struct kmem_cache *slab;
@@ -61,7 +62,7 @@ static inline unsigned int vecs_to_idx(unsigned int nr)
61 62
62static inline int use_bip_pool(unsigned int idx) 63static inline int use_bip_pool(unsigned int idx)
63{ 64{
64 if (idx == BIOVEC_NR_POOLS) 65 if (idx == BIOVEC_MAX_IDX)
65 return 1; 66 return 1;
66 67
67 return 0; 68 return 0;
@@ -95,6 +96,7 @@ struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *bio,
95 96
96 /* Use mempool if lower order alloc failed or max vecs were requested */ 97 /* Use mempool if lower order alloc failed or max vecs were requested */
97 if (bip == NULL) { 98 if (bip == NULL) {
99 idx = BIOVEC_MAX_IDX; /* so we free the payload properly later */
98 bip = mempool_alloc(bs->bio_integrity_pool, gfp_mask); 100 bip = mempool_alloc(bs->bio_integrity_pool, gfp_mask);
99 101
100 if (unlikely(bip == NULL)) { 102 if (unlikely(bip == NULL)) {