From patchwork Sun Jan 10 21:28:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7998131 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 88EDE9F3F6 for ; Sun, 10 Jan 2016 21:28:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE21920384 for ; Sun, 10 Jan 2016 21:28:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BAA1B20383 for ; Sun, 10 Jan 2016 21:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757597AbcAJV2d (ORCPT ); Sun, 10 Jan 2016 16:28:33 -0500 Received: from mga03.intel.com ([134.134.136.65]:19764 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757595AbcAJV2d (ORCPT ); Sun, 10 Jan 2016 16:28:33 -0500 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 10 Jan 2016 13:28:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,549,1444719600"; d="scan'208";a="631274025" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.136]) by FMSMGA003.fm.intel.com with ESMTP; 10 Jan 2016 13:28:32 -0800 Subject: [PATCH v3 05/10] libnvdimm: don't fail init for full badblocks list From: Dan Williams To: linux-nvdimm@lists.01.org Cc: linux-block@vger.kernel.org, vishal.l.verma@intel.com Date: Sun, 10 Jan 2016 13:28:07 -0800 Message-ID: <20160110212807.35359.56738.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20160110212740.35359.59453.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20160110212740.35359.59453.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the badblocks list runs out of space it simply means that software is unable to intercept all errors. This is no different than the latent discovery of new badblocks case and should not be an initialization failure condition. Signed-off-by: Dan Williams --- drivers/nvdimm/core.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/nvdimm/core.c b/drivers/nvdimm/core.c index 21003b7f0b38..e419d661e294 100644 --- a/drivers/nvdimm/core.c +++ b/drivers/nvdimm/core.c @@ -360,6 +360,18 @@ struct nvdimm_bus *__nvdimm_bus_register(struct device *parent, } EXPORT_SYMBOL_GPL(__nvdimm_bus_register); +static void set_badblock(struct gendisk *disk, sector_t s, int num) +{ + struct device *dev = disk->driverfs_dev; + + dev_dbg(dev, "Found a poison range (0x%llx, 0x%llx)\n", + (u64) s * 512, (u64) num * 512); + /* this isn't an error as the hardware will still throw an exception */ + if (disk_set_badblocks(disk, s, num)) + dev_info_once(dev, "%s: failed for sector %llx\n", + __func__, (u64) s); +} + /** * __add_badblock_range() - Convert a physical address range to bad sectors * @disk: the disk associated with the namespace @@ -396,15 +408,14 @@ static int __add_badblock_range(struct gendisk *disk, u64 ns_offset, u64 len) while (remaining) { int done = min_t(u64, remaining, INT_MAX); - rc = disk_set_badblocks(disk, s, done); - if (rc) - return rc; + set_badblock(disk, s, done); remaining -= done; s += done; } - return 0; } else - return disk_set_badblocks(disk, start_sector, num_sectors); + set_badblock(disk, start_sector, num_sectors); + + return 0; } /** @@ -463,9 +474,6 @@ int nvdimm_namespace_add_poison(struct gendisk *disk, resource_size_t offset, rc = __add_badblock_range(disk, start - ns_start, len); if (rc) return rc; - dev_info(&nvdimm_bus->dev, - "Found a poison range (0x%llx, 0x%llx)\n", - start, len); continue; } /* Deal with overlap for poison starting before the namespace */ @@ -480,9 +488,6 @@ int nvdimm_namespace_add_poison(struct gendisk *disk, resource_size_t offset, rc = __add_badblock_range(disk, 0, len); if (rc) return rc; - dev_info(&nvdimm_bus->dev, - "Found a poison range (0x%llx, 0x%llx)\n", - pl->start, len); } }