aboutsummaryrefslogtreecommitdiffstats
path: root/fs/bio.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/bio.c')
-rw-r--r--fs/bio.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 73e664c01d30..eb8fbc53f2cd 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -30,7 +30,7 @@
30 30
31#define BIO_POOL_SIZE 256 31#define BIO_POOL_SIZE 256
32 32
33static kmem_cache_t *bio_slab; 33static kmem_cache_t *bio_slab __read_mostly;
34 34
35#define BIOVEC_NR_POOLS 6 35#define BIOVEC_NR_POOLS 6
36 36
@@ -39,7 +39,7 @@ static kmem_cache_t *bio_slab;
39 * basically we just need to survive 39 * basically we just need to survive
40 */ 40 */
41#define BIO_SPLIT_ENTRIES 8 41#define BIO_SPLIT_ENTRIES 8
42mempool_t *bio_split_pool; 42mempool_t *bio_split_pool __read_mostly;
43 43
44struct biovec_slab { 44struct biovec_slab {
45 int nr_vecs; 45 int nr_vecs;
@@ -1125,16 +1125,6 @@ struct bio_pair *bio_split(struct bio *bi, mempool_t *pool, int first_sectors)
1125 return bp; 1125 return bp;
1126} 1126}
1127 1127
1128static void *bio_pair_alloc(gfp_t gfp_flags, void *data)
1129{
1130 return kmalloc(sizeof(struct bio_pair), gfp_flags);
1131}
1132
1133static void bio_pair_free(void *bp, void *data)
1134{
1135 kfree(bp);
1136}
1137
1138 1128
1139/* 1129/*
1140 * create memory pools for biovec's in a bio_set. 1130 * create memory pools for biovec's in a bio_set.
@@ -1151,8 +1141,7 @@ static int biovec_create_pools(struct bio_set *bs, int pool_entries, int scale)
1151 if (i >= scale) 1141 if (i >= scale)
1152 pool_entries >>= 1; 1142 pool_entries >>= 1;
1153 1143
1154 *bvp = mempool_create(pool_entries, mempool_alloc_slab, 1144 *bvp = mempool_create_slab_pool(pool_entries, bp->slab);
1155 mempool_free_slab, bp->slab);
1156 if (!*bvp) 1145 if (!*bvp)
1157 return -ENOMEM; 1146 return -ENOMEM;
1158 } 1147 }
@@ -1189,9 +1178,7 @@ struct bio_set *bioset_create(int bio_pool_size, int bvec_pool_size, int scale)
1189 if (!bs) 1178 if (!bs)
1190 return NULL; 1179 return NULL;
1191 1180
1192 bs->bio_pool = mempool_create(bio_pool_size, mempool_alloc_slab, 1181 bs->bio_pool = mempool_create_slab_pool(bio_pool_size, bio_slab);
1193 mempool_free_slab, bio_slab);
1194
1195 if (!bs->bio_pool) 1182 if (!bs->bio_pool)
1196 goto bad; 1183 goto bad;
1197 1184
@@ -1254,8 +1241,8 @@ static int __init init_bio(void)
1254 if (!fs_bio_set) 1241 if (!fs_bio_set)
1255 panic("bio: can't allocate bios\n"); 1242 panic("bio: can't allocate bios\n");
1256 1243
1257 bio_split_pool = mempool_create(BIO_SPLIT_ENTRIES, 1244 bio_split_pool = mempool_create_kmalloc_pool(BIO_SPLIT_ENTRIES,
1258 bio_pair_alloc, bio_pair_free, NULL); 1245 sizeof(struct bio_pair));
1259 if (!bio_split_pool) 1246 if (!bio_split_pool)
1260 panic("bio: can't create split pool\n"); 1247 panic("bio: can't create split pool\n");
1261 1248