Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp8490imm; Tue, 5 Jun 2018 14:03:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ8SshR7gA2XGkbfkbfseUdrgxmzAuC4ZaIW9uknZnKNtYZq0HSCxgBSJNR+/cRm6WQ2hrK X-Received: by 2002:a17:902:8b86:: with SMTP id ay6-v6mr199218plb.295.1528232582120; Tue, 05 Jun 2018 14:03:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528232582; cv=none; d=google.com; s=arc-20160816; b=tbewF03nAMZpNan82WNaaAfpRJJmaylXypEScwFSA13y6/BLIH/nZziPfkQSgFUlmf PeBIJ9GtANlgJHZZ2G0zgnFSXEeOnZ5kv9QwnFp+heXvjoheo8cCdYlJeHazmKdoPDtZ qFVk6e0XCUaHbQ3/i7n9oqOEqxT7EcsZjlWYt1Zyzy0lgKkTiBDJ1EbcmdDkQgLVSb89 I5yOyttmhzm6JdzGr3zDhs4KHBVTPfJNovkVgJTTY0mAUrtcrJ/NtmBNbqmIdkqXFt/X VeeXJEXiBqfhr+cXNHfFQMlcKL9MUwiVJ6d4340osMVFCdu08Hn33XnBK4OccTUzsnE0 pxKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=JaGP4AuM9RUHrqaXjqNN/4G1MsZKI2jrYOBtgTdZtYY=; b=xkaCFbxyH5HRnz2cBLrJR93EwXg0SWrHMAzO9qLcMMzDlMx2F09/0IkTLaCgGUpehZ jbsGvoXi27WW8ehxIJFxNNUUgyV7Kulo8bmuPhPsKSA7h36ZZ5cBP6iYTKlWQ6TAx20W 0/bZKktkHdf9SlznWBRPnaa11LTomofMTX99B83c/Vg1Hydb6uq1MEn/6NtjY1WTg6Jr mjgO9V0NMlIYIR/4ap2jAcxtLmN19vhrdmpjlO+raaMjq8Dn+isxbVATfsHlhQalGDOK ZrvHwr1fg1imchcGvw8y4+LXrwfNB0ZV1lrUO8hoHieqPllW7zqD0ICkR528c+Htuqjl BJ5Q== 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 s26-v6si13108230pgo.298.2018.06.05.14.02.28; Tue, 05 Jun 2018 14:03:02 -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 S1752091AbeFEU7C (ORCPT + 99 others); Tue, 5 Jun 2018 16:59:02 -0400 Received: from mga02.intel.com ([134.134.136.20]:25418 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751894AbeFEU7C (ORCPT ); Tue, 5 Jun 2018 16:59:02 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jun 2018 13:59:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,479,1520924400"; d="scan'208";a="234933759" Received: from theros.lm.intel.com ([10.232.112.164]) by fmsmga006.fm.intel.com with ESMTP; 05 Jun 2018 13:59:00 -0700 From: Ross Zwisler To: linux-kernel@vger.kernel.org Cc: Ross Zwisler , Dan Williams , Dave Jiang , linux-nvdimm@lists.01.org Subject: [PATCH 1/2] libnvdimm: use dax_write_cache* helpers Date: Tue, 5 Jun 2018 14:58:40 -0600 Message-Id: <20180605205841.15878-1-ross.zwisler@linux.intel.com> X-Mailer: git-send-email 2.14.4 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