From patchwork Fri Oct 13 12:46:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Matias_Bj=C3=B8rling?= X-Patchwork-Id: 10004533 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7202B60216 for ; Fri, 13 Oct 2017 12:53:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64AA429002 for ; Fri, 13 Oct 2017 12:53:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59B052905C; Fri, 13 Oct 2017 12:53:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C4E829002 for ; Fri, 13 Oct 2017 12:53:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932200AbdJMMrv (ORCPT ); Fri, 13 Oct 2017 08:47:51 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:54990 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758302AbdJMMro (ORCPT ); Fri, 13 Oct 2017 08:47:44 -0400 Received: by mail-wm0-f66.google.com with SMTP id i124so21517571wmf.3 for ; Fri, 13 Oct 2017 05:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bjorling.me; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Vm7IHlhb8uQ8t/de7n2NmlMFuSOGljVeJHXtcZR6+A4=; b=IUtfyQUBKxwhUxTl9SaKyKHtU8E17oRPjaPdvKwNxqZ6E1qvz14+GW1mCyDb8UwHCJ URKMcavWixeEbWe3vFKJBsGSD8oihNAfto3uOakmw3UwUOnom5XIFy/JdN1VC956Resb u0JzVlzjQL6GTm5UlZbngo6fduP9If/xeKr5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Vm7IHlhb8uQ8t/de7n2NmlMFuSOGljVeJHXtcZR6+A4=; b=HWMeP/GsL6S3KWptOmJqgO6HHM6FZZ40PVB8Ac83iwuyKt2DpCxDKOCKROBAMKUPLh eRbZLFyy79IkSPW6bVBUkh6r8snSN+BXk7r9jqRQKvSjfTY2goQw/1+7PHLhCBE72TiM c81XqQDgKt/WbmIRnwMRdIUmePJzBArv3pId5W4fYyDo1A7/S2bsZKZJKfoJYCPkFur/ yCSA8ZxAoQbtOzhomUUf/XL/ey5+4m4+OhYf3S6sUF2n/KtTti4YhkiNTCMGWnQyjS11 oJ4xUpqaNBqGwOgEv0RZ+addWCQDexon0rrHB8Le5h/UxUTBtkn3AMyvERORy7BJw2Jx dAHA== X-Gm-Message-State: AMCzsaWV5S/LkiFPIPA7nyc6Uj4tmX2KXjozRA+EdfGbDRo3PMxwv1GP F+cGeuEiVD0ZyxDD0HsiOb2tLQ== X-Google-Smtp-Source: AOwi7QDQg+EDzUOplXvJ80y5CAhuawQlWV4jF90cQqT+IyC915KtL4eWaKHVrgzM6tmx0MwOplLthg== X-Received: by 10.80.194.1 with SMTP id n1mr1968544edf.1.1507898863359; Fri, 13 Oct 2017 05:47:43 -0700 (PDT) Received: from skyninja.cnexlabs.com (6164211-cl69.boa.fiberby.dk. [193.106.164.211]) by smtp.gmail.com with ESMTPSA id p91sm735012edp.69.2017.10.13.05.47.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Oct 2017 05:47:42 -0700 (PDT) From: =?UTF-8?q?Matias=20Bj=C3=B8rling?= To: axboe@fb.com Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , =?UTF-8?q?Matias=20Bj=C3=B8rling?= Subject: [GIT PULL 38/58] lightnvm: pblk: ensure right bad block calculation Date: Fri, 13 Oct 2017 14:46:27 +0200 Message-Id: <20171013124647.32668-39-m@bjorling.me> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20171013124647.32668-1-m@bjorling.me> References: <20171013124647.32668-1-m@bjorling.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Javier González Make sure that the variable controlling block threshold for allocating extra metadata sectors in case of a line with bad blocks does not get a negative value. Otherwise, the line will be marked as corrupted and wasted. Signed-off-by: Javier González Signed-off-by: Matias Bjørling --- drivers/lightnvm/pblk-init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 3c37491..c7239c4 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -710,7 +710,7 @@ static int pblk_lines_init(struct pblk *pblk) goto add_emeta_page; } - lm->emeta_bb = geo->nr_luns - i; + lm->emeta_bb = geo->nr_luns > i ? geo->nr_luns - i : 0; lm->min_blk_line = 1; if (geo->nr_luns > 1)