From patchwork Wed Jan 6 13:17:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Michal_Such=C3=A1nek?= X-Patchwork-Id: 12001593 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_50, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AA34C433E0 for ; Wed, 6 Jan 2021 13:18:14 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E7D992310D for ; Wed, 6 Jan 2021 13:18:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7D992310D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BB747100EB326; Wed, 6 Jan 2021 05:18:13 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=195.135.220.15; helo=mx2.suse.de; envelope-from=msuchanek@suse.de; receiver= Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8C681100EB324 for ; Wed, 6 Jan 2021 05:18:11 -0800 (PST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 23168AD12; Wed, 6 Jan 2021 13:18:10 +0000 (UTC) From: Michal Suchanek To: linux-nvdimm@lists.01.org Subject: [PATCH ndctl rebased 3/3] namespace-action: Drop zero namespace checks. Date: Wed, 6 Jan 2021 14:17:42 +0100 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Message-ID-Hash: YFANYTTUGH4WAJKX73ABSVERUOOJ3TJF X-Message-ID-Hash: YFANYTTUGH4WAJKX73ABSVERUOOJ3TJF X-MailFrom: msuchanek@suse.de X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation CC: Michal Suchanek , Harish Sriram X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Santosh Sivaraj With seed namespaces catched early on these checks for sizes in enable and destroy namespace code path are not needed. Reverts commit b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace error for seed namespaces") Reverts commit e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace accounting relative to seed devices") Fixes: b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace error for seed namespaces") Fixes: e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace accounting relative to seed devices") Link: https://patchwork.kernel.org/patch/11739975/ Signed-off-by: Santosh Sivaraj [rebased on top of the previous patches] Signed-off-by: Michal Suchanek --- ndctl/lib/libndctl.c | 5 ----- ndctl/namespace.c | 10 ---------- 2 files changed, 15 deletions(-) diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c index 36fb6fe0f4cf..9f50f76c57e4 100644 --- a/ndctl/lib/libndctl.c +++ b/ndctl/lib/libndctl.c @@ -4501,16 +4501,11 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns) const char *devname = ndctl_namespace_get_devname(ndns); struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns); struct ndctl_region *region = ndns->region; - unsigned long long size = ndctl_namespace_get_size(ndns); int rc; if (ndctl_namespace_is_enabled(ndns)) return 0; - /* Don't try to enable idle namespace (no capacity allocated) */ - if (size == 0) - return -ENXIO; - rc = ndctl_bind(ctx, ndns->module, devname); /* diff --git a/ndctl/namespace.c b/ndctl/namespace.c index c3a058d8ff1a..4535372cb0f7 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -1161,15 +1161,12 @@ static int namespace_destroy(struct ndctl_region *region, struct ndctl_namespace *ndns) { const char *devname = ndctl_namespace_get_devname(ndns); - unsigned long long size; int rc; rc = namespace_prep_reconfig(region, ndns); if (rc < 0) return rc; - size = ndctl_namespace_get_size(ndns); - /* Labeled namespace, destroy label / allocation */ if (rc == 2) { rc = ndctl_namespace_delete(ndns); @@ -1177,13 +1174,6 @@ static int namespace_destroy(struct ndctl_region *region, debug("%s: failed to reclaim\n", devname); } - /* - * Don't report a destroyed namespace when no capacity was - * allocated. - */ - if (size == 0 && rc == 0) - rc = 1; - return rc; }