diff options
-rw-r--r-- | drivers/block/pktcdvd.c | 26 | ||||
-rw-r--r-- | drivers/md/bitmap.c | 14 | ||||
-rw-r--r-- | drivers/md/dm-io.c | 13 | ||||
-rw-r--r-- | drivers/md/dm-raid1.c | 14 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 60 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mem.c | 22 | ||||
-rw-r--r-- | fs/bio.c | 14 |
7 files changed, 34 insertions, 129 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 | ||
233 | static void *pkt_rb_alloc(gfp_t gfp_mask, void *data) | ||
234 | { | ||
235 | return kmalloc(sizeof(struct pkt_rb_node), gfp_mask); | ||
236 | } | ||
237 | |||
238 | static void pkt_rb_free(void *ptr, void *data) | ||
239 | { | ||
240 | kfree(ptr); | ||
241 | } | ||
242 | |||
243 | static inline struct pkt_rb_node *pkt_rbtree_next(struct pkt_rb_node *node) | 233 | static 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 | ||
2076 | static void *psd_pool_alloc(gfp_t gfp_mask, void *data) | ||
2077 | { | ||
2078 | return kmalloc(sizeof(struct packet_stacked_data), gfp_mask); | ||
2079 | } | ||
2080 | |||
2081 | static void psd_pool_free(void *ptr, void *data) | ||
2082 | { | ||
2083 | kfree(ptr); | ||
2084 | } | ||
2085 | |||
2086 | static int pkt_end_io_read_cloned(struct bio *bio, unsigned int bytes_done, int err) | 2066 | static 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 | ||
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index e1c18aa1d712..f8ffaee20ff8 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -89,16 +89,6 @@ int bitmap_active(struct bitmap *bitmap) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | #define WRITE_POOL_SIZE 256 | 91 | #define WRITE_POOL_SIZE 256 |
92 | /* mempool for queueing pending writes on the bitmap file */ | ||
93 | static void *write_pool_alloc(gfp_t gfp_flags, void *data) | ||
94 | { | ||
95 | return kmalloc(sizeof(struct page_list), gfp_flags); | ||
96 | } | ||
97 | |||
98 | static void write_pool_free(void *ptr, void *data) | ||
99 | { | ||
100 | kfree(ptr); | ||
101 | } | ||
102 | 92 | ||
103 | /* | 93 | /* |
104 | * just a placeholder - calls kmalloc for bitmap pages | 94 | * just a placeholder - calls kmalloc for bitmap pages |
@@ -1564,8 +1554,8 @@ int bitmap_create(mddev_t *mddev) | |||
1564 | spin_lock_init(&bitmap->write_lock); | 1554 | spin_lock_init(&bitmap->write_lock); |
1565 | INIT_LIST_HEAD(&bitmap->complete_pages); | 1555 | INIT_LIST_HEAD(&bitmap->complete_pages); |
1566 | init_waitqueue_head(&bitmap->write_wait); | 1556 | init_waitqueue_head(&bitmap->write_wait); |
1567 | bitmap->write_pool = mempool_create(WRITE_POOL_SIZE, write_pool_alloc, | 1557 | bitmap->write_pool = mempool_create_kmalloc_pool(WRITE_POOL_SIZE, |
1568 | write_pool_free, NULL); | 1558 | sizeof(struct page_list)); |
1569 | err = -ENOMEM; | 1559 | err = -ENOMEM; |
1570 | if (!bitmap->write_pool) | 1560 | if (!bitmap->write_pool) |
1571 | goto error; | 1561 | goto error; |
diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index 4809b209fbb1..da663d2ff552 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c | |||
@@ -32,16 +32,6 @@ struct io { | |||
32 | static unsigned _num_ios; | 32 | static unsigned _num_ios; |
33 | static mempool_t *_io_pool; | 33 | static mempool_t *_io_pool; |
34 | 34 | ||
35 | static void *alloc_io(gfp_t gfp_mask, void *pool_data) | ||
36 | { | ||
37 | return kmalloc(sizeof(struct io), gfp_mask); | ||
38 | } | ||
39 | |||
40 | static void free_io(void *element, void *pool_data) | ||
41 | { | ||
42 | kfree(element); | ||
43 | } | ||
44 | |||
45 | static unsigned int pages_to_ios(unsigned int pages) | 35 | static unsigned int pages_to_ios(unsigned int pages) |
46 | { | 36 | { |
47 | return 4 * pages; /* too many ? */ | 37 | return 4 * pages; /* too many ? */ |
@@ -65,7 +55,8 @@ static int resize_pool(unsigned int new_ios) | |||
65 | 55 | ||
66 | } else { | 56 | } else { |
67 | /* create new pool */ | 57 | /* create new pool */ |
68 | _io_pool = mempool_create(new_ios, alloc_io, free_io, NULL); | 58 | _io_pool = mempool_create_kmalloc_pool(new_ios, |
59 | sizeof(struct io)); | ||
69 | if (!_io_pool) | 60 | if (!_io_pool) |
70 | return -ENOMEM; | 61 | return -ENOMEM; |
71 | 62 | ||
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 6cfa8d435d55..4e90f231fbfb 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c | |||
@@ -122,16 +122,6 @@ static inline sector_t region_to_sector(struct region_hash *rh, region_t region) | |||
122 | /* FIXME move this */ | 122 | /* FIXME move this */ |
123 | static void queue_bio(struct mirror_set *ms, struct bio *bio, int rw); | 123 | static void queue_bio(struct mirror_set *ms, struct bio *bio, int rw); |
124 | 124 | ||
125 | static void *region_alloc(gfp_t gfp_mask, void *pool_data) | ||
126 | { | ||
127 | return kmalloc(sizeof(struct region), gfp_mask); | ||
128 | } | ||
129 | |||
130 | static void region_free(void *element, void *pool_data) | ||
131 | { | ||
132 | kfree(element); | ||
133 | } | ||
134 | |||
135 | #define MIN_REGIONS 64 | 125 | #define MIN_REGIONS 64 |
136 | #define MAX_RECOVERY 1 | 126 | #define MAX_RECOVERY 1 |
137 | static int rh_init(struct region_hash *rh, struct mirror_set *ms, | 127 | static int rh_init(struct region_hash *rh, struct mirror_set *ms, |
@@ -173,8 +163,8 @@ static int rh_init(struct region_hash *rh, struct mirror_set *ms, | |||
173 | INIT_LIST_HEAD(&rh->quiesced_regions); | 163 | INIT_LIST_HEAD(&rh->quiesced_regions); |
174 | INIT_LIST_HEAD(&rh->recovered_regions); | 164 | INIT_LIST_HEAD(&rh->recovered_regions); |
175 | 165 | ||
176 | rh->region_pool = mempool_create(MIN_REGIONS, region_alloc, | 166 | rh->region_pool = mempool_create_kmalloc_pool(MIN_REGIONS, |
177 | region_free, NULL); | 167 | sizeof(struct region)); |
178 | if (!rh->region_pool) { | 168 | if (!rh->region_pool) { |
179 | vfree(rh->buckets); | 169 | vfree(rh->buckets); |
180 | rh->buckets = NULL; | 170 | rh->buckets = NULL; |
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 95b92f317b6f..395cfc6a344f 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -829,18 +829,6 @@ zfcp_unit_dequeue(struct zfcp_unit *unit) | |||
829 | device_unregister(&unit->sysfs_device); | 829 | device_unregister(&unit->sysfs_device); |
830 | } | 830 | } |
831 | 831 | ||
832 | static void * | ||
833 | zfcp_mempool_alloc(gfp_t gfp_mask, void *size) | ||
834 | { | ||
835 | return kmalloc((size_t) size, gfp_mask); | ||
836 | } | ||
837 | |||
838 | static void | ||
839 | zfcp_mempool_free(void *element, void *size) | ||
840 | { | ||
841 | kfree(element); | ||
842 | } | ||
843 | |||
844 | /* | 832 | /* |
845 | * Allocates a combined QTCB/fsf_req buffer for erp actions and fcp/SCSI | 833 | * Allocates a combined QTCB/fsf_req buffer for erp actions and fcp/SCSI |
846 | * commands. | 834 | * commands. |
@@ -853,51 +841,39 @@ static int | |||
853 | zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter) | 841 | zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter) |
854 | { | 842 | { |
855 | adapter->pool.fsf_req_erp = | 843 | adapter->pool.fsf_req_erp = |
856 | mempool_create(ZFCP_POOL_FSF_REQ_ERP_NR, | 844 | mempool_create_kmalloc_pool(ZFCP_POOL_FSF_REQ_ERP_NR, |
857 | zfcp_mempool_alloc, zfcp_mempool_free, (void *) | 845 | sizeof(struct zfcp_fsf_req_pool_element)); |
858 | sizeof(struct zfcp_fsf_req_pool_element)); | 846 | if (!adapter->pool.fsf_req_erp) |
859 | |||
860 | if (NULL == adapter->pool.fsf_req_erp) | ||
861 | return -ENOMEM; | 847 | return -ENOMEM; |
862 | 848 | ||
863 | adapter->pool.fsf_req_scsi = | 849 | adapter->pool.fsf_req_scsi = |
864 | mempool_create(ZFCP_POOL_FSF_REQ_SCSI_NR, | 850 | mempool_create_kmalloc_pool(ZFCP_POOL_FSF_REQ_SCSI_NR, |
865 | zfcp_mempool_alloc, zfcp_mempool_free, (void *) | 851 | sizeof(struct zfcp_fsf_req_pool_element)); |
866 | sizeof(struct zfcp_fsf_req_pool_element)); | 852 | if (!adapter->pool.fsf_req_scsi) |
867 | |||
868 | if (NULL == adapter->pool.fsf_req_scsi) | ||
869 | return -ENOMEM; | 853 | return -ENOMEM; |
870 | 854 | ||
871 | adapter->pool.fsf_req_abort = | 855 | adapter->pool.fsf_req_abort = |
872 | mempool_create(ZFCP_POOL_FSF_REQ_ABORT_NR, | 856 | mempool_create_kmalloc_pool(ZFCP_POOL_FSF_REQ_ABORT_NR, |
873 | zfcp_mempool_alloc, zfcp_mempool_free, (void *) | 857 | sizeof(struct zfcp_fsf_req_pool_element)); |
874 | sizeof(struct zfcp_fsf_req_pool_element)); | 858 | if (!adapter->pool.fsf_req_abort) |
875 | |||
876 | if (NULL == adapter->pool.fsf_req_abort) | ||
877 | return -ENOMEM; | 859 | return -ENOMEM; |
878 | 860 | ||
879 | adapter->pool.fsf_req_status_read = | 861 | adapter->pool.fsf_req_status_read = |
880 | mempool_create(ZFCP_POOL_STATUS_READ_NR, | 862 | mempool_create_kmalloc_pool(ZFCP_POOL_STATUS_READ_NR, |
881 | zfcp_mempool_alloc, zfcp_mempool_free, | 863 | sizeof(struct zfcp_fsf_req)); |
882 | (void *) sizeof(struct zfcp_fsf_req)); | 864 | if (!adapter->pool.fsf_req_status_read) |
883 | |||
884 | if (NULL == adapter->pool.fsf_req_status_read) | ||
885 | return -ENOMEM; | 865 | return -ENOMEM; |
886 | 866 | ||
887 | adapter->pool.data_status_read = | 867 | adapter->pool.data_status_read = |
888 | mempool_create(ZFCP_POOL_STATUS_READ_NR, | 868 | mempool_create_kmalloc_pool(ZFCP_POOL_STATUS_READ_NR, |
889 | zfcp_mempool_alloc, zfcp_mempool_free, | 869 | sizeof(struct fsf_status_read_buffer)); |
890 | (void *) sizeof(struct fsf_status_read_buffer)); | 870 | if (!adapter->pool.data_status_read) |
891 | |||
892 | if (NULL == adapter->pool.data_status_read) | ||
893 | return -ENOMEM; | 871 | return -ENOMEM; |
894 | 872 | ||
895 | adapter->pool.data_gid_pn = | 873 | adapter->pool.data_gid_pn = |
896 | mempool_create(ZFCP_POOL_DATA_GID_PN_NR, | 874 | mempool_create_kmalloc_pool(ZFCP_POOL_DATA_GID_PN_NR, |
897 | zfcp_mempool_alloc, zfcp_mempool_free, (void *) | 875 | sizeof(struct zfcp_gid_pn_data)); |
898 | sizeof(struct zfcp_gid_pn_data)); | 876 | if (!adapter->pool.data_gid_pn) |
899 | |||
900 | if (NULL == adapter->pool.data_gid_pn) | ||
901 | return -ENOMEM; | 877 | return -ENOMEM; |
902 | 878 | ||
903 | return 0; | 879 | return 0; |
diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c index 352df47bcaca..07017658ac56 100644 --- a/drivers/scsi/lpfc/lpfc_mem.c +++ b/drivers/scsi/lpfc/lpfc_mem.c | |||
@@ -38,18 +38,6 @@ | |||
38 | #define LPFC_MBUF_POOL_SIZE 64 /* max elements in MBUF safety pool */ | 38 | #define LPFC_MBUF_POOL_SIZE 64 /* max elements in MBUF safety pool */ |
39 | #define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */ | 39 | #define LPFC_MEM_POOL_SIZE 64 /* max elem in non-DMA safety pool */ |
40 | 40 | ||
41 | static void * | ||
42 | lpfc_pool_kmalloc(gfp_t gfp_flags, void *data) | ||
43 | { | ||
44 | return kmalloc((unsigned long)data, gfp_flags); | ||
45 | } | ||
46 | |||
47 | static void | ||
48 | lpfc_pool_kfree(void *obj, void *data) | ||
49 | { | ||
50 | kfree(obj); | ||
51 | } | ||
52 | |||
53 | int | 41 | int |
54 | lpfc_mem_alloc(struct lpfc_hba * phba) | 42 | lpfc_mem_alloc(struct lpfc_hba * phba) |
55 | { | 43 | { |
@@ -79,15 +67,13 @@ lpfc_mem_alloc(struct lpfc_hba * phba) | |||
79 | pool->current_count++; | 67 | pool->current_count++; |
80 | } | 68 | } |
81 | 69 | ||
82 | phba->mbox_mem_pool = mempool_create(LPFC_MEM_POOL_SIZE, | 70 | phba->mbox_mem_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE, |
83 | lpfc_pool_kmalloc, lpfc_pool_kfree, | 71 | sizeof(LPFC_MBOXQ_t)); |
84 | (void *)(unsigned long)sizeof(LPFC_MBOXQ_t)); | ||
85 | if (!phba->mbox_mem_pool) | 72 | if (!phba->mbox_mem_pool) |
86 | goto fail_free_mbuf_pool; | 73 | goto fail_free_mbuf_pool; |
87 | 74 | ||
88 | phba->nlp_mem_pool = mempool_create(LPFC_MEM_POOL_SIZE, | 75 | phba->nlp_mem_pool = mempool_create_kmalloc_pool(LPFC_MEM_POOL_SIZE, |
89 | lpfc_pool_kmalloc, lpfc_pool_kfree, | 76 | sizeof(struct lpfc_nodelist)); |
90 | (void *)(unsigned long)sizeof(struct lpfc_nodelist)); | ||
91 | if (!phba->nlp_mem_pool) | 77 | if (!phba->nlp_mem_pool) |
92 | goto fail_free_mbox_pool; | 78 | goto fail_free_mbox_pool; |
93 | 79 | ||
@@ -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 | ||
1128 | static void *bio_pair_alloc(gfp_t gfp_flags, void *data) | ||
1129 | { | ||
1130 | return kmalloc(sizeof(struct bio_pair), gfp_flags); | ||
1131 | } | ||
1132 | |||
1133 | static 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. |
@@ -1254,8 +1244,8 @@ static int __init init_bio(void) | |||
1254 | if (!fs_bio_set) | 1244 | if (!fs_bio_set) |
1255 | panic("bio: can't allocate bios\n"); | 1245 | panic("bio: can't allocate bios\n"); |
1256 | 1246 | ||
1257 | bio_split_pool = mempool_create(BIO_SPLIT_ENTRIES, | 1247 | bio_split_pool = mempool_create_kmalloc_pool(BIO_SPLIT_ENTRIES, |
1258 | bio_pair_alloc, bio_pair_free, NULL); | 1248 | sizeof(struct bio_pair)); |
1259 | if (!bio_split_pool) | 1249 | if (!bio_split_pool) |
1260 | panic("bio: can't create split pool\n"); | 1250 | panic("bio: can't create split pool\n"); |
1261 | 1251 | ||