Skip to content

Commit

Permalink
dax: Use dax_write_cache* helpers
Browse files Browse the repository at this point in the history
Use dax_write_cache() and dax_write_cache_enabled() instead of open coding
the bit operations.

Signed-off-by: Ross Zwisler <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
  • Loading branch information
Ross Zwisler authored and djbw committed Jun 6, 2018
1 parent 546eb03 commit 808c340
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions drivers/dax/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 808c340

Please sign in to comment.