public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Igor Konopko <igor.j.konopko@intel.com>
To: Hans Holmberg <hans@owltronix.com>
Cc: "Matias Bjorling" <mb@lightnvm.io>,
	"Javier González" <javier@javigon.com>,
	"Hans Holmberg" <hans.holmberg@cnexlabs.com>,
	linux-block@vger.kernel.org
Subject: Re: [PATCH v2 7/8] lightnvm: pblk: warn about opened chunk on factory init
Date: Wed, 6 Mar 2019 15:31:05 +0100	[thread overview]
Message-ID: <3511f916-364d-4944-3e63-9c2e644ece27@intel.com> (raw)
In-Reply-To: <CANr-nt2M_miemdqpEyGJFNhbRDwVhYJgiToJ_kb4DvEvLqpg2Q@mail.gmail.com>



On 06.03.2019 15:27, Hans Holmberg wrote:
> On Tue, Mar 5, 2019 at 2:54 PM Igor Konopko <igor.j.konopko@intel.com> wrote:
>>
>> When we creating pblk instance with factory flag, there is a
>> possibility that some chunks are in open state, which does not allow
>> to issue erase request to them directly, based on OCSSD 2.0 spec.
>> Still most of the controllers allows for such a transition, but it is
>> not guaranteed that the particular drive will do so. This patch adds
>> the proper warning during pblk factory creation to let user know about
>> number of chunks in such a state, which can potentially be a reason
>> of erase failures.
>>
>> Signed-off-by: Igor Konopko <igor.j.konopko@intel.com>
>> ---
>>   drivers/lightnvm/pblk-core.c | 14 ++++++++++++++
>>   drivers/lightnvm/pblk-init.c | 14 +++++++++++---
>>   drivers/lightnvm/pblk.h      |  1 +
>>   3 files changed, 26 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
>> index 64280e6..4f16596 100644
>> --- a/drivers/lightnvm/pblk-core.c
>> +++ b/drivers/lightnvm/pblk-core.c
>> @@ -161,6 +161,20 @@ struct nvm_chk_meta *pblk_chunk_get_off(struct pblk *pblk,
>>          return meta + ch_off + lun_off + chk_off;
>>   }
>>
>> +int pblk_count_opened_chunks(struct pblk *pblk, struct nvm_chk_meta *meta)
>> +{
>> +       struct nvm_tgt_dev *dev = pblk->dev;
>> +       struct nvm_geo *geo = &dev->geo;
>> +       int i, cnt = 0;
>> +
>> +       for (i = 0; i < geo->all_luns; i++) {
> 
> Shouldn't this be i < geo->all_chunks ?
> 

Yes, it should be.

Anyway, Javier proposed to use existing pblk_setup_line_meta_chk() 
function for counting that, so I'm gonna to rewrite this patch.

> Otherwise the patch looks good.
> 
> Thanks,
> Hans
> 
>> +               if (meta[i].state == NVM_CHK_ST_OPEN)
>> +                       cnt++;
>> +       }
>> +
>> +       return cnt;
>> +}
>> +
>>   void __pblk_map_invalidate(struct pblk *pblk, struct pblk_line *line,
>>                             u64 paddr)
>>   {
>> diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
>> index 97b4c6e..f590f62 100644
>> --- a/drivers/lightnvm/pblk-init.c
>> +++ b/drivers/lightnvm/pblk-init.c
>> @@ -1028,12 +1028,12 @@ static int pblk_line_meta_init(struct pblk *pblk)
>>          return 0;
>>   }
>>
>> -static int pblk_lines_init(struct pblk *pblk)
>> +static int pblk_lines_init(struct pblk *pblk, bool factory_init)
>>   {
>>          struct pblk_line_mgmt *l_mg = &pblk->l_mg;
>>          struct pblk_line *line;
>>          void *chunk_meta;
>> -       int nr_free_chks = 0;
>> +       int nr_free_chks = 0, nr_opened_chks;
>>          int i, ret;
>>
>>          ret = pblk_line_meta_init(pblk);
>> @@ -1054,6 +1054,14 @@ static int pblk_lines_init(struct pblk *pblk)
>>                  goto fail_free_luns;
>>          }
>>
>> +       if (factory_init) {
>> +               nr_opened_chks = pblk_count_opened_chunks(pblk, chunk_meta);
>> +               if (nr_opened_chks) {
>> +                       pblk_warn(pblk, "There are %d opened chunks\n",
>> +                                 nr_opened_chks);
>> +               }
>> +       }
>> +
>>          pblk->lines = kcalloc(l_mg->nr_lines, sizeof(struct pblk_line),
>>                                                                  GFP_KERNEL);
>>          if (!pblk->lines) {
>> @@ -1245,7 +1253,7 @@ static void *pblk_init(struct nvm_tgt_dev *dev, struct gendisk *tdisk,
>>                  goto fail;
>>          }
>>
>> -       ret = pblk_lines_init(pblk);
>> +       ret = pblk_lines_init(pblk, flags & NVM_TARGET_FACTORY);
>>          if (ret) {
>>                  pblk_err(pblk, "could not initialize lines\n");
>>                  goto fail_free_core;
>> diff --git a/drivers/lightnvm/pblk.h b/drivers/lightnvm/pblk.h
>> index 6c82776..c2f07ec 100644
>> --- a/drivers/lightnvm/pblk.h
>> +++ b/drivers/lightnvm/pblk.h
>> @@ -795,6 +795,7 @@ struct nvm_chk_meta *pblk_get_chunk_meta(struct pblk *pblk);
>>   struct nvm_chk_meta *pblk_chunk_get_off(struct pblk *pblk,
>>                                                struct nvm_chk_meta *lp,
>>                                                struct ppa_addr ppa);
>> +int pblk_count_opened_chunks(struct pblk *pblk, struct nvm_chk_meta *_meta);
>>   void pblk_log_write_err(struct pblk *pblk, struct nvm_rq *rqd);
>>   void pblk_log_read_err(struct pblk *pblk, struct nvm_rq *rqd);
>>   int pblk_submit_io(struct pblk *pblk, struct nvm_rq *rqd);
>> --
>> 2.9.5
>>

  reply	other threads:[~2019-03-06 14:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-05 13:51 [PATCH v2 0/8] lightnvm: bugfixes and improvements Igor Konopko
2019-03-05 13:51 ` [PATCH v2 1/8] lightnvm: pblk: Gracefully handle GC vmalloc fail Igor Konopko
2019-03-06 14:09   ` Hans Holmberg
2019-03-05 13:51 ` [PATCH v2 2/8] lightnvm: pblk: Fix put line back behaviour Igor Konopko
2019-03-05 13:51 ` [PATCH v2 3/8] lightnvm: pblk: Count all read errors in stats Igor Konopko
2019-03-06  7:28   ` Javier González
2019-03-06 14:19     ` Hans Holmberg
2019-03-06 14:22       ` Igor Konopko
2019-03-05 13:51 ` [PATCH v2 4/8] lightnvm: pblk: Ensure that erase is chunk aligned Igor Konopko
2019-03-06  7:28   ` Javier González
2019-03-06 14:20   ` Hans Holmberg
2019-03-05 13:51 ` [PATCH v2 5/8] lightnvm: pblk: Cleanly fail when there is not enough memory Igor Konopko
2019-03-06 14:20   ` Hans Holmberg
2019-03-05 13:51 ` [PATCH v2 6/8] lightnvm: pblk: Set proper read stutus in bio Igor Konopko
2019-03-06  8:00   ` Javier González
2019-03-06 14:23   ` Hans Holmberg
2019-03-05 13:51 ` [PATCH v2 7/8] lightnvm: pblk: warn about opened chunk on factory init Igor Konopko
2019-03-06  7:43   ` Javier González
2019-03-06 14:27   ` Hans Holmberg
2019-03-06 14:31     ` Igor Konopko [this message]
2019-03-05 13:51 ` [PATCH v2 8/8] lightnvm: Inherit mdts from the parent nvme device Igor Konopko
2019-03-05 14:34   ` Matias Bjørling
2019-03-06  7:44     ` Javier González
2019-03-06 14:29       ` Hans Holmberg
2019-03-09 16:56 ` [PATCH v2 0/8] lightnvm: bugfixes and improvements Matias Bjørling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3511f916-364d-4944-3e63-9c2e644ece27@intel.com \
    --to=igor.j.konopko@intel.com \
    --cc=hans.holmberg@cnexlabs.com \
    --cc=hans@owltronix.com \
    --cc=javier@javigon.com \
    --cc=linux-block@vger.kernel.org \
    --cc=mb@lightnvm.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox