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

[PATCH] mempool: use mempool_create_slab_pool()

Modify well over a dozen mempool users to call mempool_create_slab_pool()
rather than calling mempool_create() with extra arguments, saving about 30
lines of code and increasing readability.

Signed-off-by: Matthew Dobson <colpatch@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Matthew Dobson and committed by
Linus Torvalds
93d2341c fec433aa

+39 -72
+1 -1
block/cfq-iosched.c
··· 2191 2191 if (!cfqd->cfq_hash) 2192 2192 goto out_cfqhash; 2193 2193 2194 - cfqd->crq_pool = mempool_create(BLKDEV_MIN_RQ, mempool_alloc_slab, mempool_free_slab, crq_pool); 2194 + cfqd->crq_pool = mempool_create_slab_pool(BLKDEV_MIN_RQ, crq_pool); 2195 2195 if (!cfqd->crq_pool) 2196 2196 goto out_crqpool; 2197 2197
+1 -3
drivers/block/aoe/aoeblk.c
··· 211 211 return; 212 212 } 213 213 214 - d->bufpool = mempool_create(MIN_BUFS, 215 - mempool_alloc_slab, mempool_free_slab, 216 - buf_pool_cache); 214 + d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); 217 215 if (d->bufpool == NULL) { 218 216 printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate bufpool " 219 217 "for %ld.%ld\n", d->aoemajor, d->aoeminor);
+1 -2
drivers/md/dm-crypt.c
··· 616 616 } 617 617 } 618 618 619 - cc->io_pool = mempool_create(MIN_IOS, mempool_alloc_slab, 620 - mempool_free_slab, _crypt_io_pool); 619 + cc->io_pool = mempool_create_slab_pool(MIN_IOS, _crypt_io_pool); 621 620 if (!cc->io_pool) { 622 621 ti->error = PFX "Cannot allocate crypt io mempool"; 623 622 goto bad3;
+1 -2
drivers/md/dm-mpath.c
··· 179 179 m->queue_io = 1; 180 180 INIT_WORK(&m->process_queued_ios, process_queued_ios, m); 181 181 INIT_WORK(&m->trigger_event, trigger_event, m); 182 - m->mpio_pool = mempool_create(MIN_IOS, mempool_alloc_slab, 183 - mempool_free_slab, _mpio_cache); 182 + m->mpio_pool = mempool_create_slab_pool(MIN_IOS, _mpio_cache); 184 183 if (!m->mpio_pool) { 185 184 kfree(m); 186 185 return NULL;
+1 -2
drivers/md/dm-snap.c
··· 1174 1174 goto bad4; 1175 1175 } 1176 1176 1177 - pending_pool = mempool_create(128, mempool_alloc_slab, 1178 - mempool_free_slab, pending_cache); 1177 + pending_pool = mempool_create_slab_pool(128, pending_cache); 1179 1178 if (!pending_pool) { 1180 1179 DMERR("Couldn't create pending pool."); 1181 1180 r = -ENOMEM;
+2 -4
drivers/md/dm.c
··· 823 823 md->queue->unplug_fn = dm_unplug_all; 824 824 md->queue->issue_flush_fn = dm_flush_all; 825 825 826 - md->io_pool = mempool_create(MIN_IOS, mempool_alloc_slab, 827 - mempool_free_slab, _io_cache); 826 + md->io_pool = mempool_create_slab_pool(MIN_IOS, _io_cache); 828 827 if (!md->io_pool) 829 828 goto bad2; 830 829 831 - md->tio_pool = mempool_create(MIN_IOS, mempool_alloc_slab, 832 - mempool_free_slab, _tio_cache); 830 + md->tio_pool = mempool_create_slab_pool(MIN_IOS, _tio_cache); 833 831 if (!md->tio_pool) 834 832 goto bad3; 835 833
+1 -2
drivers/md/kcopyd.c
··· 227 227 if (!_job_cache) 228 228 return -ENOMEM; 229 229 230 - _job_pool = mempool_create(MIN_JOBS, mempool_alloc_slab, 231 - mempool_free_slab, _job_cache); 230 + _job_pool = mempool_create_slab_pool(MIN_JOBS, _job_cache); 232 231 if (!_job_pool) { 233 232 kmem_cache_destroy(_job_cache); 234 233 return -ENOMEM;
+3 -4
drivers/message/i2o/i2o_block.c
··· 1179 1179 goto exit; 1180 1180 } 1181 1181 1182 - i2o_blk_req_pool.pool = mempool_create(I2O_BLOCK_REQ_MEMPOOL_SIZE, 1183 - mempool_alloc_slab, 1184 - mempool_free_slab, 1185 - i2o_blk_req_pool.slab); 1182 + i2o_blk_req_pool.pool = 1183 + mempool_create_slab_pool(I2O_BLOCK_REQ_MEMPOOL_SIZE, 1184 + i2o_blk_req_pool.slab); 1186 1185 if (!i2o_blk_req_pool.pool) { 1187 1186 osm_err("can't init request mempool\n"); 1188 1187 rc = -ENOMEM;
+2 -2
drivers/scsi/iscsi_tcp.c
··· 3200 3200 * Data-Out PDU's within R2T-sequence can be quite big; 3201 3201 * using mempool 3202 3202 */ 3203 - ctask->datapool = mempool_create(ISCSI_DTASK_DEFAULT_MAX, 3204 - mempool_alloc_slab, mempool_free_slab, taskcache); 3203 + ctask->datapool = mempool_create_slab_pool(ISCSI_DTASK_DEFAULT_MAX, 3204 + taskcache); 3205 3205 if (ctask->datapool == NULL) { 3206 3206 kfifo_free(ctask->r2tqueue); 3207 3207 iscsi_pool_free(&ctask->r2tpool, (void**)ctask->r2ts);
+1 -2
drivers/scsi/qla2xxx/qla_os.c
··· 2154 2154 int rval; 2155 2155 2156 2156 rval = QLA_SUCCESS; 2157 - ha->srb_mempool = mempool_create(SRB_MIN_REQ, mempool_alloc_slab, 2158 - mempool_free_slab, srb_cachep); 2157 + ha->srb_mempool = mempool_create_slab_pool(SRB_MIN_REQ, srb_cachep); 2159 2158 if (ha->srb_mempool == NULL) { 2160 2159 qla_printk(KERN_INFO, ha, "Unable to allocate SRB mempool.\n"); 2161 2160 rval = QLA_FUNCTION_FAILED;
+2 -3
drivers/scsi/scsi_lib.c
··· 1787 1787 sgp->name); 1788 1788 } 1789 1789 1790 - sgp->pool = mempool_create(SG_MEMPOOL_SIZE, 1791 - mempool_alloc_slab, mempool_free_slab, 1792 - sgp->slab); 1790 + sgp->pool = mempool_create_slab_pool(SG_MEMPOOL_SIZE, 1791 + sgp->slab); 1793 1792 if (!sgp->pool) { 1794 1793 printk(KERN_ERR "SCSI: can't init sg mempool %s\n", 1795 1794 sgp->name);
+2 -5
fs/bio.c
··· 1141 1141 if (i >= scale) 1142 1142 pool_entries >>= 1; 1143 1143 1144 - *bvp = mempool_create(pool_entries, mempool_alloc_slab, 1145 - mempool_free_slab, bp->slab); 1144 + *bvp = mempool_create_slab_pool(pool_entries, bp->slab); 1146 1145 if (!*bvp) 1147 1146 return -ENOMEM; 1148 1147 } ··· 1178 1179 if (!bs) 1179 1180 return NULL; 1180 1181 1181 - bs->bio_pool = mempool_create(bio_pool_size, mempool_alloc_slab, 1182 - mempool_free_slab, bio_slab); 1183 - 1182 + bs->bio_pool = mempool_create_slab_pool(bio_pool_size, bio_slab); 1184 1183 if (!bs->bio_pool) 1185 1184 goto bad; 1186 1185
+6 -12
fs/cifs/cifsfs.c
··· 738 738 cERROR(1,("cifs_min_rcv set to maximum (64)")); 739 739 } 740 740 741 - cifs_req_poolp = mempool_create(cifs_min_rcv, 742 - mempool_alloc_slab, 743 - mempool_free_slab, 744 - cifs_req_cachep); 741 + cifs_req_poolp = mempool_create_slab_pool(cifs_min_rcv, 742 + cifs_req_cachep); 745 743 746 744 if(cifs_req_poolp == NULL) { 747 745 kmem_cache_destroy(cifs_req_cachep); ··· 769 771 cFYI(1,("cifs_min_small set to maximum (256)")); 770 772 } 771 773 772 - cifs_sm_req_poolp = mempool_create(cifs_min_small, 773 - mempool_alloc_slab, 774 - mempool_free_slab, 775 - cifs_sm_req_cachep); 774 + cifs_sm_req_poolp = mempool_create_slab_pool(cifs_min_small, 775 + cifs_sm_req_cachep); 776 776 777 777 if(cifs_sm_req_poolp == NULL) { 778 778 mempool_destroy(cifs_req_poolp); ··· 804 808 if (cifs_mid_cachep == NULL) 805 809 return -ENOMEM; 806 810 807 - cifs_mid_poolp = mempool_create(3 /* a reasonable min simultan opers */, 808 - mempool_alloc_slab, 809 - mempool_free_slab, 810 - cifs_mid_cachep); 811 + /* 3 is a reasonable minimum number of simultaneous operations */ 812 + cifs_mid_poolp = mempool_create_slab_pool(3, cifs_mid_cachep); 811 813 if(cifs_mid_poolp == NULL) { 812 814 kmem_cache_destroy(cifs_mid_cachep); 813 815 return -ENOMEM;
+2 -2
fs/jfs/jfs_metapage.c
··· 220 220 if (metapage_cache == NULL) 221 221 return -ENOMEM; 222 222 223 - metapage_mempool = mempool_create(METAPOOL_MIN_PAGES, mempool_alloc_slab, 224 - mempool_free_slab, metapage_cache); 223 + metapage_mempool = mempool_create_slab_pool(METAPOOL_MIN_PAGES, 224 + metapage_cache); 225 225 226 226 if (metapage_mempool == NULL) { 227 227 kmem_cache_destroy(metapage_cache);
+2 -4
fs/nfs/read.c
··· 663 663 if (nfs_rdata_cachep == NULL) 664 664 return -ENOMEM; 665 665 666 - nfs_rdata_mempool = mempool_create(MIN_POOL_READ, 667 - mempool_alloc_slab, 668 - mempool_free_slab, 669 - nfs_rdata_cachep); 666 + nfs_rdata_mempool = mempool_create_slab_pool(MIN_POOL_READ, 667 + nfs_rdata_cachep); 670 668 if (nfs_rdata_mempool == NULL) 671 669 return -ENOMEM; 672 670
+4 -8
fs/nfs/write.c
··· 1521 1521 if (nfs_wdata_cachep == NULL) 1522 1522 return -ENOMEM; 1523 1523 1524 - nfs_wdata_mempool = mempool_create(MIN_POOL_WRITE, 1525 - mempool_alloc_slab, 1526 - mempool_free_slab, 1527 - nfs_wdata_cachep); 1524 + nfs_wdata_mempool = mempool_create_slab_pool(MIN_POOL_WRITE, 1525 + nfs_wdata_cachep); 1528 1526 if (nfs_wdata_mempool == NULL) 1529 1527 return -ENOMEM; 1530 1528 1531 - nfs_commit_mempool = mempool_create(MIN_POOL_COMMIT, 1532 - mempool_alloc_slab, 1533 - mempool_free_slab, 1534 - nfs_wdata_cachep); 1529 + nfs_commit_mempool = mempool_create_slab_pool(MIN_POOL_COMMIT, 1530 + nfs_wdata_cachep); 1535 1531 if (nfs_commit_mempool == NULL) 1536 1532 return -ENOMEM; 1537 1533
+2 -3
fs/xfs/linux-2.6/xfs_super.c
··· 375 375 if (!xfs_ioend_zone) 376 376 goto out_destroy_vnode_zone; 377 377 378 - xfs_ioend_pool = mempool_create(4 * MAX_BUF_PER_PAGE, 379 - mempool_alloc_slab, mempool_free_slab, 380 - xfs_ioend_zone); 378 + xfs_ioend_pool = mempool_create_slab_pool(4 * MAX_BUF_PER_PAGE, 379 + xfs_ioend_zone); 381 380 if (!xfs_ioend_pool) 382 381 goto out_free_ioend_zone; 383 382 return 0;
+1 -3
include/linux/i2o.h
··· 950 950 if (!pool->slab) 951 951 goto free_name; 952 952 953 - pool->mempool = 954 - mempool_create(min_nr, mempool_alloc_slab, mempool_free_slab, 955 - pool->slab); 953 + pool->mempool = mempool_create_slab_pool(min_nr, pool->slab); 956 954 if (!pool->mempool) 957 955 goto free_slab; 958 956
+4 -8
net/sunrpc/sched.c
··· 1167 1167 NULL, NULL); 1168 1168 if (!rpc_buffer_slabp) 1169 1169 goto err_nomem; 1170 - rpc_task_mempool = mempool_create(RPC_TASK_POOLSIZE, 1171 - mempool_alloc_slab, 1172 - mempool_free_slab, 1173 - rpc_task_slabp); 1170 + rpc_task_mempool = mempool_create_slab_pool(RPC_TASK_POOLSIZE, 1171 + rpc_task_slabp); 1174 1172 if (!rpc_task_mempool) 1175 1173 goto err_nomem; 1176 - rpc_buffer_mempool = mempool_create(RPC_BUFFER_POOLSIZE, 1177 - mempool_alloc_slab, 1178 - mempool_free_slab, 1179 - rpc_buffer_slabp); 1174 + rpc_buffer_mempool = mempool_create_slab_pool(RPC_BUFFER_POOLSIZE, 1175 + rpc_buffer_slabp); 1180 1176 if (!rpc_buffer_mempool) 1181 1177 goto err_nomem; 1182 1178 return 0;