aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/pblk-init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/lightnvm/pblk-init.c')
-rw-r--r--drivers/lightnvm/pblk-init.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 7b1f29c71338..340552253580 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -20,7 +20,7 @@
20 20
21#include "pblk.h" 21#include "pblk.h"
22 22
23static struct kmem_cache *pblk_blk_ws_cache, *pblk_rec_cache, *pblk_g_rq_cache, 23static struct kmem_cache *pblk_ws_cache, *pblk_rec_cache, *pblk_g_rq_cache,
24 *pblk_w_rq_cache, *pblk_line_meta_cache; 24 *pblk_w_rq_cache, *pblk_line_meta_cache;
25static DECLARE_RWSEM(pblk_lock); 25static DECLARE_RWSEM(pblk_lock);
26struct bio_set *pblk_bio_set; 26struct bio_set *pblk_bio_set;
@@ -184,9 +184,9 @@ static int pblk_init_global_caches(struct pblk *pblk)
184 char cache_name[PBLK_CACHE_NAME_LEN]; 184 char cache_name[PBLK_CACHE_NAME_LEN];
185 185
186 down_write(&pblk_lock); 186 down_write(&pblk_lock);
187 pblk_blk_ws_cache = kmem_cache_create("pblk_blk_ws", 187 pblk_ws_cache = kmem_cache_create("pblk_blk_ws",
188 sizeof(struct pblk_line_ws), 0, 0, NULL); 188 sizeof(struct pblk_line_ws), 0, 0, NULL);
189 if (!pblk_blk_ws_cache) { 189 if (!pblk_ws_cache) {
190 up_write(&pblk_lock); 190 up_write(&pblk_lock);
191 return -ENOMEM; 191 return -ENOMEM;
192 } 192 }
@@ -194,7 +194,7 @@ static int pblk_init_global_caches(struct pblk *pblk)
194 pblk_rec_cache = kmem_cache_create("pblk_rec", 194 pblk_rec_cache = kmem_cache_create("pblk_rec",
195 sizeof(struct pblk_rec_ctx), 0, 0, NULL); 195 sizeof(struct pblk_rec_ctx), 0, 0, NULL);
196 if (!pblk_rec_cache) { 196 if (!pblk_rec_cache) {
197 kmem_cache_destroy(pblk_blk_ws_cache); 197 kmem_cache_destroy(pblk_ws_cache);
198 up_write(&pblk_lock); 198 up_write(&pblk_lock);
199 return -ENOMEM; 199 return -ENOMEM;
200 } 200 }
@@ -202,7 +202,7 @@ static int pblk_init_global_caches(struct pblk *pblk)
202 pblk_g_rq_cache = kmem_cache_create("pblk_g_rq", pblk_g_rq_size, 202 pblk_g_rq_cache = kmem_cache_create("pblk_g_rq", pblk_g_rq_size,
203 0, 0, NULL); 203 0, 0, NULL);
204 if (!pblk_g_rq_cache) { 204 if (!pblk_g_rq_cache) {
205 kmem_cache_destroy(pblk_blk_ws_cache); 205 kmem_cache_destroy(pblk_ws_cache);
206 kmem_cache_destroy(pblk_rec_cache); 206 kmem_cache_destroy(pblk_rec_cache);
207 up_write(&pblk_lock); 207 up_write(&pblk_lock);
208 return -ENOMEM; 208 return -ENOMEM;
@@ -211,7 +211,7 @@ static int pblk_init_global_caches(struct pblk *pblk)
211 pblk_w_rq_cache = kmem_cache_create("pblk_w_rq", pblk_w_rq_size, 211 pblk_w_rq_cache = kmem_cache_create("pblk_w_rq", pblk_w_rq_size,
212 0, 0, NULL); 212 0, 0, NULL);
213 if (!pblk_w_rq_cache) { 213 if (!pblk_w_rq_cache) {
214 kmem_cache_destroy(pblk_blk_ws_cache); 214 kmem_cache_destroy(pblk_ws_cache);
215 kmem_cache_destroy(pblk_rec_cache); 215 kmem_cache_destroy(pblk_rec_cache);
216 kmem_cache_destroy(pblk_g_rq_cache); 216 kmem_cache_destroy(pblk_g_rq_cache);
217 up_write(&pblk_lock); 217 up_write(&pblk_lock);
@@ -223,7 +223,7 @@ static int pblk_init_global_caches(struct pblk *pblk)
223 pblk_line_meta_cache = kmem_cache_create(cache_name, 223 pblk_line_meta_cache = kmem_cache_create(cache_name,
224 pblk->lm.sec_bitmap_len, 0, 0, NULL); 224 pblk->lm.sec_bitmap_len, 0, 0, NULL);
225 if (!pblk_line_meta_cache) { 225 if (!pblk_line_meta_cache) {
226 kmem_cache_destroy(pblk_blk_ws_cache); 226 kmem_cache_destroy(pblk_ws_cache);
227 kmem_cache_destroy(pblk_rec_cache); 227 kmem_cache_destroy(pblk_rec_cache);
228 kmem_cache_destroy(pblk_g_rq_cache); 228 kmem_cache_destroy(pblk_g_rq_cache);
229 kmem_cache_destroy(pblk_w_rq_cache); 229 kmem_cache_destroy(pblk_w_rq_cache);
@@ -246,20 +246,20 @@ static int pblk_core_init(struct pblk *pblk)
246 if (pblk_init_global_caches(pblk)) 246 if (pblk_init_global_caches(pblk))
247 return -ENOMEM; 247 return -ENOMEM;
248 248
249 /* internal bios can be at most the sectors signaled by the device. */ 249 /* Internal bios can be at most the sectors signaled by the device. */
250 pblk->page_bio_pool = mempool_create_page_pool(nvm_max_phys_sects(dev), 250 pblk->page_bio_pool = mempool_create_page_pool(nvm_max_phys_sects(dev),
251 0); 251 0);
252 if (!pblk->page_bio_pool) 252 if (!pblk->page_bio_pool)
253 return -ENOMEM; 253 return -ENOMEM;
254 254
255 pblk->line_ws_pool = mempool_create_slab_pool(PBLK_WS_POOL_SIZE, 255 pblk->gen_ws_pool = mempool_create_slab_pool(PBLK_GEN_WS_POOL_SIZE,
256 pblk_blk_ws_cache); 256 pblk_ws_cache);
257 if (!pblk->line_ws_pool) 257 if (!pblk->gen_ws_pool)
258 goto free_page_bio_pool; 258 goto free_page_bio_pool;
259 259
260 pblk->rec_pool = mempool_create_slab_pool(geo->nr_luns, pblk_rec_cache); 260 pblk->rec_pool = mempool_create_slab_pool(geo->nr_luns, pblk_rec_cache);
261 if (!pblk->rec_pool) 261 if (!pblk->rec_pool)
262 goto free_blk_ws_pool; 262 goto free_gen_ws_pool;
263 263
264 pblk->g_rq_pool = mempool_create_slab_pool(PBLK_READ_REQ_POOL_SIZE, 264 pblk->g_rq_pool = mempool_create_slab_pool(PBLK_READ_REQ_POOL_SIZE,
265 pblk_g_rq_cache); 265 pblk_g_rq_cache);
@@ -308,8 +308,8 @@ free_g_rq_pool:
308 mempool_destroy(pblk->g_rq_pool); 308 mempool_destroy(pblk->g_rq_pool);
309free_rec_pool: 309free_rec_pool:
310 mempool_destroy(pblk->rec_pool); 310 mempool_destroy(pblk->rec_pool);
311free_blk_ws_pool: 311free_gen_ws_pool:
312 mempool_destroy(pblk->line_ws_pool); 312 mempool_destroy(pblk->gen_ws_pool);
313free_page_bio_pool: 313free_page_bio_pool:
314 mempool_destroy(pblk->page_bio_pool); 314 mempool_destroy(pblk->page_bio_pool);
315 return -ENOMEM; 315 return -ENOMEM;
@@ -324,13 +324,13 @@ static void pblk_core_free(struct pblk *pblk)
324 destroy_workqueue(pblk->bb_wq); 324 destroy_workqueue(pblk->bb_wq);
325 325
326 mempool_destroy(pblk->page_bio_pool); 326 mempool_destroy(pblk->page_bio_pool);
327 mempool_destroy(pblk->line_ws_pool); 327 mempool_destroy(pblk->gen_ws_pool);
328 mempool_destroy(pblk->rec_pool); 328 mempool_destroy(pblk->rec_pool);
329 mempool_destroy(pblk->g_rq_pool); 329 mempool_destroy(pblk->g_rq_pool);
330 mempool_destroy(pblk->w_rq_pool); 330 mempool_destroy(pblk->w_rq_pool);
331 mempool_destroy(pblk->line_meta_pool); 331 mempool_destroy(pblk->line_meta_pool);
332 332
333 kmem_cache_destroy(pblk_blk_ws_cache); 333 kmem_cache_destroy(pblk_ws_cache);
334 kmem_cache_destroy(pblk_rec_cache); 334 kmem_cache_destroy(pblk_rec_cache);
335 kmem_cache_destroy(pblk_g_rq_cache); 335 kmem_cache_destroy(pblk_g_rq_cache);
336 kmem_cache_destroy(pblk_w_rq_cache); 336 kmem_cache_destroy(pblk_w_rq_cache);