Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp150882imm; Tue, 5 Jun 2018 16:58:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKSU07e9oslKgEjabmQKAfEZotWtFyugGOcJqzaigDKUiSGupCQeuKjgR1E9fg+Hjaw0IT5 X-Received: by 2002:a62:830e:: with SMTP id h14-v6mr70672pfe.64.1528243127238; Tue, 05 Jun 2018 16:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528243127; cv=none; d=google.com; s=arc-20160816; b=gwUQBbj5jXA8WnMKZhbYEdKvHUTMISpejI0wcc9UZNMM+qgNMXCiJT7BzAyuaoWIn6 D3uAeh/iQniiC6WkfUWfix9j9aMm40OsGXUO0C2TaEiubi7bU9FapAkBEVp9ifhqv6xd s7WMVp4QHXIWafh5fQzx40frJeLYj35Nkut3ADQ6PHuaVvvOeGJtEMbE20VDF4xMCmJJ dwz5cGSQHCWI4AiSLi/WwJ9V5FnGSzqNL6BQoDHLJeDxWVlfbWxT/9TbiI21uV8r3h4c Ggx959JQ6EhVGnjpbkHFx4tfy4YLfy+aAVJb4/z2duoHDRkK76yCC83M7W/DDUEXU70+ CxkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=JaGP4AuM9RUHrqaXjqNN/4G1MsZKI2jrYOBtgTdZtYY=; b=LTfRpFFpiFPuoAeVr3hPftByY7RZm1X597q6QgnrR4bu5qQPoFBnz4OmkimZwANfiw Q7KOb4BDSaY+2Tuvx0t2uwKh9RtMUelfx0tLWgH76iol0Bq+w55bOOzB8SYjkY99kmJW bx8biRq4xJvH+3XMXWVZxwuQeWxbGALEp3ZqNvUhYFyARUI4b2TV7vxrxAPpD29F1Q8l O+4/tK6WQYxiLEBKkQRUw07eu2l1miRoOS25YFxY2Q48k/J11+BEg/oUu9DaT9bmGNWK Kp5+L6hnE2433OYQ8I1bOhBLJx1/acNTWpVR5vNAbfWi3/TPfGUNa51txPBU+/3Sr5EE DFBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 38-v6si3394160pln.390.2018.06.05.16.58.32; Tue, 05 Jun 2018 16:58:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932207AbeFEX6K (ORCPT + 99 others); Tue, 5 Jun 2018 19:58:10 -0400 Received: from mga12.intel.com ([192.55.52.136]:62554 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752905AbeFEX6J (ORCPT ); Tue, 5 Jun 2018 19:58:09 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2018 16:58:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,481,1520924400"; d="scan'208";a="205631349" Received: from theros.lm.intel.com ([10.232.112.164]) by orsmga004.jf.intel.com with ESMTP; 05 Jun 2018 16:58:08 -0700 From: Ross Zwisler To: linux-kernel@vger.kernel.org Cc: Ross Zwisler , Dan Williams , Dave Jiang , linux-nvdimm@lists.01.org Subject: [PATCH v2 2/3] libnvdimm: use dax_write_cache* helpers Date: Tue, 5 Jun 2018 17:58:01 -0600 Message-Id: <20180605235802.14531-2-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180605235802.14531-1-ross.zwisler@linux.intel.com> References: <20180605235802.14531-1-ross.zwisler@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use dax_write_cache() and dax_write_cache_enabled() instead of open coding the bit operations. Signed-off-by: Ross Zwisler --- drivers/dax/super.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/dax/super.c b/drivers/dax/super.c index 2b2332b605e4..c2c46f96b18c 100644 --- a/drivers/dax/super.c +++ b/drivers/dax/super.c @@ -182,8 +182,7 @@ static ssize_t write_cache_show(struct device *dev, if (!dax_dev) return -ENXIO; - rc = sprintf(buf, "%d\n", !!test_bit(DAXDEV_WRITE_CACHE, - &dax_dev->flags)); + rc = sprintf(buf, "%d\n", !!dax_write_cache_enabled(dax_dev)); put_dax(dax_dev); return rc; } @@ -201,10 +200,8 @@ static ssize_t write_cache_store(struct device *dev, if (rc) len = rc; - else if (write_cache) - set_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags); else - clear_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags); + dax_write_cache(dax_dev, write_cache); put_dax(dax_dev); return len; @@ -286,7 +283,7 @@ EXPORT_SYMBOL_GPL(dax_copy_from_iter); void arch_wb_cache_pmem(void *addr, size_t size); void dax_flush(struct dax_device *dax_dev, void *addr, size_t size) { - if (unlikely(!test_bit(DAXDEV_WRITE_CACHE, &dax_dev->flags))) + if (unlikely(!dax_write_cache_enabled(dax_dev))) return; arch_wb_cache_pmem(addr, size); -- 2.14.4