From patchwork Tue Mar 8 23:36:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8538341 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5C7CCC0553 for ; Tue, 8 Mar 2016 23:37:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92D66201FA for ; Tue, 8 Mar 2016 23:37:12 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C48A3201EF for ; Tue, 8 Mar 2016 23:37:11 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 52B1B1A1F3F; Tue, 8 Mar 2016 15:37:25 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ml01.01.org (Postfix) with ESMTP id CD8891A1F37 for ; Tue, 8 Mar 2016 15:37:23 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 08 Mar 2016 15:37:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,558,1449561600"; d="scan'208";a="666117581" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.14]) by FMSMGA003.fm.intel.com with ESMTP; 08 Mar 2016 15:37:10 -0800 Subject: [ndctl PATCH 3/8] ndctl: refresh dynamic pfn attributes from a duplicate From: Dan Williams To: linux-nvdimm@lists.01.org Date: Tue, 08 Mar 2016 15:36:43 -0800 Message-ID: <20160308233643.18628.30522.stgit@dwillia2-desk3.jf.intel.com> In-Reply-To: <20160308233628.18628.13786.stgit@dwillia2-desk3.jf.intel.com> References: <20160308233628.18628.13786.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 When we find a duplicate of an existing ndctl_pfn instance in add_pfn, it may have a more up to date value of the 'size' or 'resource' because those values are only valid while the instance is active. Copy those updates over before throwing away the duplicate. Signed-off-by: Dan Williams --- lib/libndctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libndctl.c b/lib/libndctl.c index 91e855bf525a..dde3ef5b72e4 100644 --- a/lib/libndctl.c +++ b/lib/libndctl.c @@ -3880,6 +3880,8 @@ static int add_pfn(void *parent, int id, const char *pfn_base) free(path); ndctl_pfn_foreach(region, pfn_dup) if (pfn->id == pfn_dup->id) { + pfn_dup->resource = pfn->resource; + pfn_dup->size = pfn->size; free_pfn(pfn, NULL); return 1; }