dm-verity: remove useless mempool
v->fec->extra_pool has zero reserved entries, so we can remove it and use the kernel cache directly. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Eric Biggers <ebiggers@kernel.org>pull/1354/merge
parent
d9f3e47d3f
commit
b9dd1f71e6
|
|
@ -333,7 +333,7 @@ static int fec_alloc_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio)
|
||||||
if (fio->bufs[n])
|
if (fio->bufs[n])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fio->bufs[n] = mempool_alloc(&v->fec->extra_pool, GFP_NOWAIT);
|
fio->bufs[n] = kmem_cache_alloc(v->fec->cache, GFP_NOWAIT);
|
||||||
/* we can manage with even one buffer if necessary */
|
/* we can manage with even one buffer if necessary */
|
||||||
if (unlikely(!fio->bufs[n]))
|
if (unlikely(!fio->bufs[n]))
|
||||||
break;
|
break;
|
||||||
|
|
@ -482,7 +482,8 @@ void verity_fec_finish_io(struct dm_verity_io *io)
|
||||||
mempool_free(fio->bufs[n], &f->prealloc_pool);
|
mempool_free(fio->bufs[n], &f->prealloc_pool);
|
||||||
|
|
||||||
fec_for_each_extra_buffer(fio, n)
|
fec_for_each_extra_buffer(fio, n)
|
||||||
mempool_free(fio->bufs[n], &f->extra_pool);
|
if (fio->bufs[n])
|
||||||
|
kmem_cache_free(f->cache, fio->bufs[n]);
|
||||||
|
|
||||||
mempool_free(fio->output, &f->output_pool);
|
mempool_free(fio->output, &f->output_pool);
|
||||||
}
|
}
|
||||||
|
|
@ -534,7 +535,6 @@ void verity_fec_dtr(struct dm_verity *v)
|
||||||
|
|
||||||
mempool_exit(&f->rs_pool);
|
mempool_exit(&f->rs_pool);
|
||||||
mempool_exit(&f->prealloc_pool);
|
mempool_exit(&f->prealloc_pool);
|
||||||
mempool_exit(&f->extra_pool);
|
|
||||||
mempool_exit(&f->output_pool);
|
mempool_exit(&f->output_pool);
|
||||||
kmem_cache_destroy(f->cache);
|
kmem_cache_destroy(f->cache);
|
||||||
|
|
||||||
|
|
@ -787,12 +787,6 @@ int verity_fec_ctr(struct dm_verity *v)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = mempool_init_slab_pool(&f->extra_pool, 0, f->cache);
|
|
||||||
if (ret) {
|
|
||||||
ti->error = "Cannot allocate FEC buffer extra pool";
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Preallocate an output buffer for each thread */
|
/* Preallocate an output buffer for each thread */
|
||||||
ret = mempool_init_kmalloc_pool(&f->output_pool, num_online_cpus(),
|
ret = mempool_init_kmalloc_pool(&f->output_pool, num_online_cpus(),
|
||||||
1 << v->data_dev_block_bits);
|
1 << v->data_dev_block_bits);
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ struct dm_verity_fec {
|
||||||
unsigned char rsn; /* N of RS(M, N) */
|
unsigned char rsn; /* N of RS(M, N) */
|
||||||
mempool_t rs_pool; /* mempool for fio->rs */
|
mempool_t rs_pool; /* mempool for fio->rs */
|
||||||
mempool_t prealloc_pool; /* mempool for preallocated buffers */
|
mempool_t prealloc_pool; /* mempool for preallocated buffers */
|
||||||
mempool_t extra_pool; /* mempool for extra buffers */
|
|
||||||
mempool_t output_pool; /* mempool for output */
|
mempool_t output_pool; /* mempool for output */
|
||||||
struct kmem_cache *cache; /* cache for buffers */
|
struct kmem_cache *cache; /* cache for buffers */
|
||||||
atomic64_t corrected; /* corrected errors */
|
atomic64_t corrected; /* corrected errors */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue