Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1057657imm; Wed, 6 Jun 2018 09:49:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLRZB8jbYiDD1SFKL4lFTqn5UGP/6smVw/YtyYp9SjQuHSmPjsh0m8L6HdJlbVtEPrjj9vE X-Received: by 2002:a62:da07:: with SMTP id c7-v6mr2076934pfh.106.1528303756088; Wed, 06 Jun 2018 09:49:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528303756; cv=none; d=google.com; s=arc-20160816; b=BAnaBJMKiyxJBCctSjVtNFotRLhevADYDQafOOl7n2gZf0cny9xpEAGxZpsTwR+OnE qoxPv8WzBMEBzUXRhXaPfRhmYc5f5zq8vYuroIVme/hfVdLLXqO9gKR05uNF4KE7S3n6 04UGgVliC7zwEUsukyTe+r/bJvBINca+++AiNEnH9Ctq3HY9zG1Ohn8+NeUGlZGlAdjP 3J+72A5fePf+XVkpySGvIX0XFVrNCGrSD3DNSWJtPB9RtKWr/yjKZIQUPgpMqxnKXd23 nKNiLvWf1gY68dxUKmj3rV5wqlJGuy0vmRVlPbLt65OCowWBo1Twv3WVmSfKgyFwXpzW 0spw== 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=xKGyW5w7Iv+ELAg/y9mmJ0/E03XaSkCDvobAbxSSg62/9WA/6IYeEoNw8HOfwzM6uC wzoc5GsYw8LHMYw4QTnn+PW8UnNPQkSuogBqNaDyU1EpFCwTY5md1xVqFaJRBGvl7DJV j+dl5woRgINcRCtDvL5wldrhDi71kg725wM3QdquojvQSynKu+LjrKhNCXRzWcKTN6y7 J87cVtbZq74MhIcsereLItGl1P+6xZRVn9+CNw6yadcZ+RCb+cGwroknxQk/fSNP14FW 9W8rd+8nUQrSLlckLS6Hal9q+DR00w3J9VVVc15EZfzMXCPfTSDiXVKCanj1/1053JDK wVKg== 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 z7-v6si27756642pfn.247.2018.06.06.09.49.01; Wed, 06 Jun 2018 09:49:16 -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 S933539AbeFFQpy (ORCPT + 99 others); Wed, 6 Jun 2018 12:45:54 -0400 Received: from mga01.intel.com ([192.55.52.88]:8289 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752496AbeFFQpR (ORCPT ); Wed, 6 Jun 2018 12:45:17 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jun 2018 09:45:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,483,1520924400"; d="scan'208";a="60932382" Received: from theros.lm.intel.com ([10.232.112.164]) by fmsmga004.fm.intel.com with ESMTP; 06 Jun 2018 09:45:16 -0700 From: Ross Zwisler To: linux-kernel@vger.kernel.org Cc: Ross Zwisler , Dan Williams , Dave Jiang , linux-nvdimm@lists.01.org Subject: [PATCH v3 3/4] libnvdimm: use dax_write_cache* helpers Date: Wed, 6 Jun 2018 10:45:14 -0600 Message-Id: <20180606164515.25677-3-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180606164515.25677-1-ross.zwisler@linux.intel.com> References: <20180606164515.25677-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