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.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 0ffc17ccf1cc..8416910ee8bf 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -921,6 +921,7 @@ static void pblk_free(struct pblk *pblk)
921{ 921{
922 pblk_luns_free(pblk); 922 pblk_luns_free(pblk);
923 pblk_lines_free(pblk); 923 pblk_lines_free(pblk);
924 kfree(pblk->pad_dist);
924 pblk_line_meta_free(pblk); 925 pblk_line_meta_free(pblk);
925 pblk_core_free(pblk); 926 pblk_core_free(pblk);
926 pblk_l2p_free(pblk); 927 pblk_l2p_free(pblk);
@@ -998,11 +999,13 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk,
998 pblk->pad_rst_wa = 0; 999 pblk->pad_rst_wa = 0;
999 pblk->gc_rst_wa = 0; 1000 pblk->gc_rst_wa = 0;
1000 1001
1002 atomic64_set(&pblk->nr_flush, 0);
1003 pblk->nr_flush_rst = 0;
1004
1001#ifdef CONFIG_NVM_DEBUG 1005#ifdef CONFIG_NVM_DEBUG
1002 atomic_long_set(&pblk->inflight_writes, 0); 1006 atomic_long_set(&pblk->inflight_writes, 0);
1003 atomic_long_set(&pblk->padded_writes, 0); 1007 atomic_long_set(&pblk->padded_writes, 0);
1004 atomic_long_set(&pblk->padded_wb, 0); 1008 atomic_long_set(&pblk->padded_wb, 0);
1005 atomic_long_set(&pblk->nr_flush, 0);
1006 atomic_long_set(&pblk->req_writes, 0); 1009 atomic_long_set(&pblk->req_writes, 0);
1007 atomic_long_set(&pblk->sub_writes, 0); 1010 atomic_long_set(&pblk->sub_writes, 0);
1008 atomic_long_set(&pblk->sync_writes, 0); 1011 atomic_long_set(&pblk->sync_writes, 0);
@@ -1034,10 +1037,17 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk,
1034 goto fail_free_luns; 1037 goto fail_free_luns;
1035 } 1038 }
1036 1039
1040 pblk->pad_dist = kzalloc((pblk->min_write_pgs - 1) * sizeof(atomic64_t),
1041 GFP_KERNEL);
1042 if (!pblk->pad_dist) {
1043 ret = -ENOMEM;
1044 goto fail_free_line_meta;
1045 }
1046
1037 ret = pblk_core_init(pblk); 1047 ret = pblk_core_init(pblk);
1038 if (ret) { 1048 if (ret) {
1039 pr_err("pblk: could not initialize core\n"); 1049 pr_err("pblk: could not initialize core\n");
1040 goto fail_free_line_meta; 1050 goto fail_free_pad_dist;
1041 } 1051 }
1042 1052
1043 ret = pblk_l2p_init(pblk); 1053 ret = pblk_l2p_init(pblk);
@@ -1097,6 +1107,8 @@ fail_free_l2p:
1097 pblk_l2p_free(pblk); 1107 pblk_l2p_free(pblk);
1098fail_free_core: 1108fail_free_core:
1099 pblk_core_free(pblk); 1109 pblk_core_free(pblk);
1110fail_free_pad_dist:
1111 kfree(pblk->pad_dist);
1100fail_free_line_meta: 1112fail_free_line_meta:
1101 pblk_line_meta_free(pblk); 1113 pblk_line_meta_free(pblk);
1102fail_free_luns: 1114fail_free_luns: