aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorMatthew Dobson <colpatch@us.ibm.com>2006-03-26 04:37:47 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:56:59 -0500
commit0eaae62abaa1ad1f231932b6cdd9fb1b91df6651 (patch)
treecda02cffff075a8b542ddcea4fa0ff0064130502 /drivers/block
parent53184082b070dfb077218828fdf839826102ed96 (diff)
[PATCH] mempool: use common mempool kmalloc allocator
This patch changes several mempool users, all of which are basically just wrappers around kmalloc(), to use the common mempool_kmalloc/kfree, rather than their own wrapper function, removing a bunch of duplicated code. 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>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/pktcdvd.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 1d261f985f31..a04f60693c39 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -230,16 +230,6 @@ static int pkt_grow_pktlist(struct pktcdvd_device *pd, int nr_packets)
230 return 1; 230 return 1;
231} 231}
232 232
233static void *pkt_rb_alloc(gfp_t gfp_mask, void *data)
234{
235 return kmalloc(sizeof(struct pkt_rb_node), gfp_mask);
236}
237
238static void pkt_rb_free(void *ptr, void *data)
239{
240 kfree(ptr);
241}
242
243static inline struct pkt_rb_node *pkt_rbtree_next(struct pkt_rb_node *node) 233static inline struct pkt_rb_node *pkt_rbtree_next(struct pkt_rb_node *node)
244{ 234{
245 struct rb_node *n = rb_next(&node->rb_node); 235 struct rb_node *n = rb_next(&node->rb_node);
@@ -2073,16 +2063,6 @@ static int pkt_close(struct inode *inode, struct file *file)
2073} 2063}
2074 2064
2075 2065
2076static void *psd_pool_alloc(gfp_t gfp_mask, void *data)
2077{
2078 return kmalloc(sizeof(struct packet_stacked_data), gfp_mask);
2079}
2080
2081static void psd_pool_free(void *ptr, void *data)
2082{
2083 kfree(ptr);
2084}
2085
2086static int pkt_end_io_read_cloned(struct bio *bio, unsigned int bytes_done, int err) 2066static int pkt_end_io_read_cloned(struct bio *bio, unsigned int bytes_done, int err)
2087{ 2067{
2088 struct packet_stacked_data *psd = bio->bi_private; 2068 struct packet_stacked_data *psd = bio->bi_private;
@@ -2475,7 +2455,8 @@ static int pkt_setup_dev(struct pkt_ctrl_command *ctrl_cmd)
2475 if (!pd) 2455 if (!pd)
2476 return ret; 2456 return ret;
2477 2457
2478 pd->rb_pool = mempool_create(PKT_RB_POOL_SIZE, pkt_rb_alloc, pkt_rb_free, NULL); 2458 pd->rb_pool = mempool_create_kmalloc_pool(PKT_RB_POOL_SIZE,
2459 sizeof(struct pkt_rb_node));
2479 if (!pd->rb_pool) 2460 if (!pd->rb_pool)
2480 goto out_mem; 2461 goto out_mem;
2481 2462
@@ -2639,7 +2620,8 @@ static int __init pkt_init(void)
2639{ 2620{
2640 int ret; 2621 int ret;
2641 2622
2642 psd_pool = mempool_create(PSD_POOL_SIZE, psd_pool_alloc, psd_pool_free, NULL); 2623 psd_pool = mempool_create_kmalloc_pool(PSD_POOL_SIZE,
2624 sizeof(struct packet_stacked_data));
2643 if (!psd_pool) 2625 if (!psd_pool)
2644 return -ENOMEM; 2626 return -ENOMEM;
2645 2627