Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+3 -10
+3 -9
drivers/md/dm-verity-fec.c
··· 333 333 if (fio->bufs[n]) 334 334 continue; 335 335 336 - fio->bufs[n] = mempool_alloc(&v->fec->extra_pool, GFP_NOWAIT); 336 + fio->bufs[n] = kmem_cache_alloc(v->fec->cache, GFP_NOWAIT); 337 337 /* we can manage with even one buffer if necessary */ 338 338 if (unlikely(!fio->bufs[n])) 339 339 break; ··· 482 482 mempool_free(fio->bufs[n], &f->prealloc_pool); 483 483 484 484 fec_for_each_extra_buffer(fio, n) 485 - mempool_free(fio->bufs[n], &f->extra_pool); 485 + if (fio->bufs[n]) 486 + kmem_cache_free(f->cache, fio->bufs[n]); 486 487 487 488 mempool_free(fio->output, &f->output_pool); 488 489 } ··· 535 534 536 535 mempool_exit(&f->rs_pool); 537 536 mempool_exit(&f->prealloc_pool); 538 - mempool_exit(&f->extra_pool); 539 537 mempool_exit(&f->output_pool); 540 538 kmem_cache_destroy(f->cache); 541 539 ··· 784 784 f->cache); 785 785 if (ret) { 786 786 ti->error = "Cannot allocate FEC buffer prealloc pool"; 787 - return ret; 788 - } 789 - 790 - ret = mempool_init_slab_pool(&f->extra_pool, 0, f->cache); 791 - if (ret) { 792 - ti->error = "Cannot allocate FEC buffer extra pool"; 793 787 return ret; 794 788 } 795 789
-1
drivers/md/dm-verity-fec.h
··· 42 42 unsigned char rsn; /* N of RS(M, N) */ 43 43 mempool_t rs_pool; /* mempool for fio->rs */ 44 44 mempool_t prealloc_pool; /* mempool for preallocated buffers */ 45 - mempool_t extra_pool; /* mempool for extra buffers */ 46 45 mempool_t output_pool; /* mempool for output */ 47 46 struct kmem_cache *cache; /* cache for buffers */ 48 47 atomic64_t corrected; /* corrected errors */