From patchwork Tue Nov 5 17:27:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 11228333 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9AABC14E5 for ; Tue, 5 Nov 2019 17:27:30 +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 7F6FE21929 for ; Tue, 5 Nov 2019 17:27:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F6FE21929 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from new-ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 02EAD100DC42E; Tue, 5 Nov 2019 09:30:11 -0800 (PST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=vishal.l.verma@intel.com; receiver= Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 EF85F100DC426 for ; Tue, 5 Nov 2019 09:30:08 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2019 09:27:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,271,1569308400"; d="scan'208";a="232547289" Received: from vverma7-desk1.amr.corp.intel.com (HELO vverma7-desk1.lm.intel.com) ([10.232.112.164]) by fmsmga002.fm.intel.com with ESMTP; 05 Nov 2019 09:27:27 -0800 From: Vishal Verma To: Subject: [ndctl PATCH v2 2/2] ndctl/namespace: fix reported count for disable-namespace Date: Tue, 5 Nov 2019 10:27:13 -0700 Message-Id: <20191105172713.3628-2-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191105172713.3628-1-vishal.l.verma@intel.com> References: <20191105172713.3628-1-vishal.l.verma@intel.com> MIME-Version: 1.0 Message-ID-Hash: MBHAEM2RCVFR4CQJ634P5M5U5AP7P5GS X-Message-ID-Hash: MBHAEM2RCVFR4CQJ634P5M5U5AP7P5GS X-MailFrom: vishal.l.verma@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: "Aneesh Kumar K.V" 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: Make the count reported disable-namespace consistent with enable-namespace by skipping namespaces that were already disabled. Cc: Dan Williams Signed-off-by: Vishal Verma --- ndctl/namespace.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ndctl/namespace.c b/ndctl/namespace.c index f2987ca..57998ce 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -1426,6 +1426,10 @@ static int do_xaction_namespace(const char *namespace, continue; switch (action) { case ACTION_DISABLE: + if (!ndctl_namespace_is_enabled(ndns)) { + rc = 0; + continue; + } rc = ndctl_namespace_disable_safe(ndns); if (rc == 0) (*processed)++;