mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Javier González" <jg@lightnvm.io>
To: mb@lightnvm.io, axboe@fb.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Javier González" <javier@cnexlabs.com>,
	"Matias Bjørling" <matias@cnexlabs.com>
Subject: [PATCH 08/10] lightnvm: pblk: add initialization check
Date: Fri, 30 Jun 2017 17:56:41 +0200	[thread overview]
Message-ID: <1498838203-21539-9-git-send-email-javier@cnexlabs.com> (raw)
In-Reply-To: <1498838203-21539-1-git-send-email-javier@cnexlabs.com>

Add a sanity check to the pblk initialization sequence in order to
ensure that enough LUNs have been allocated to store the line metadata.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
---
 drivers/lightnvm/pblk-init.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 025d8fe52154..1b0f61233c21 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -716,6 +716,12 @@ static int pblk_lines_init(struct pblk *pblk)
 	lm->emeta_bb = geo->nr_luns - i;
 	lm->min_blk_line = 1 + DIV_ROUND_UP(lm->smeta_sec + lm->emeta_sec[0],
 							geo->sec_per_blk);
+	if (lm->min_blk_line > lm->blk_per_line) {
+		pr_err("pblk: config. not supported. Min. LUN in line:%d\n",
+							lm->blk_per_line);
+		ret = -EINVAL;
+		goto fail;
+	}
 
 	ret = pblk_lines_alloc_metadata(pblk);
 	if (ret)
-- 
2.7.4

  parent reply	other threads:[~2017-06-30 15:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 15:56 [PATCH 00/10] lightnvm: pblk fixes for 4.13 Javier González
2017-06-30 15:56 ` [PATCH 01/10] lightnvm: pblk: fix bad le64 assignations Javier González
2017-06-30 15:56 ` [PATCH 02/10] lightnvm: pblk: fix double-free on pblk init Javier González
2017-06-30 15:56 ` [PATCH 03/10] lightnvm: pblk: remove unused return variable Javier González
2017-06-30 15:56 ` [PATCH 04/10] lightnvm: pblk: schedule if data is not ready Javier González
2017-06-30 15:56 ` [PATCH 05/10] lightnvm: pblk: use right metadata buffer for recovery Javier González
2017-06-30 15:56 ` [PATCH 06/10] lightnvm: pblk: use vmalloc for GC data buffer Javier González
2017-06-30 15:56 ` [PATCH 07/10] lightnvm: pblk: remove target using async. I/Os Javier González
2017-06-30 15:56 ` Javier González [this message]
2017-06-30 15:56 ` [PATCH 09/10] lightnvm: pblk: verify that cache read is still valid Javier González
2017-06-30 15:56 ` [PATCH 10/10] lightnvm: pblk: set line bitmap check under debug Javier González
2017-06-30 17:08 ` [PATCH 00/10] lightnvm: pblk fixes for 4.13 Jens Axboe

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=1498838203-21539-9-git-send-email-javier@cnexlabs.com \
    --to=jg@lightnvm.io \
    --cc=axboe@fb.com \
    --cc=javier@cnexlabs.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matias@cnexlabs.com \
    --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

all inboxes | Powered by JetHome®