aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dax.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2017-08-31 21:47:43 -0400
committerMike Snitzer <snitzer@redhat.com>2017-09-11 11:00:55 -0400
commitc3ca015fab6df124c933b91902f3f2a3473f9da5 (patch)
treea43633630e05a08bbb14de927b4d399b5d2f6c1d /fs/dax.c
parentb5e8ad92c3ac0b073bbf08ffd1a6a31d3449caae (diff)
dax: remove the pmem_dax_ops->flush abstraction
Commit abebfbe2f731 ("dm: add ->flush() dax operation support") is buggy. A DM device may be composed of multiple underlying devices and all of them need to be flushed. That commit just routes the flush request to the first device and ignores the other devices. It could be fixed by adding more complex logic to the device mapper. But there is only one implementation of the method pmem_dax_ops->flush - that is pmem_dax_flush() - and it calls arch_wb_cache_pmem(). Consequently, we don't need the pmem_dax_ops->flush abstraction at all, we can call arch_wb_cache_pmem() directly from dax_flush() because dax_dev->ops->flush can't ever reach anything different from arch_wb_cache_pmem(). It should be also pointed out that for some uses of persistent memory it is needed to flush only a very small amount of data (such as 1 cacheline), and it would be overkill if we go through that device mapper machinery for a single flushed cache line. Fix this by removing the pmem_dax_ops->flush abstraction and call arch_wb_cache_pmem() directly from dax_flush(). Also, remove the device mapper code that forwards the flushes. Fixes: abebfbe2f731 ("dm: add ->flush() dax operation support") Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'fs/dax.c')
-rw-r--r--fs/dax.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/dax.c b/fs/dax.c
index 865d42c63e23..18d970fb0e09 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -783,7 +783,7 @@ static int dax_writeback_one(struct block_device *bdev,
783 } 783 }
784 784
785 dax_mapping_entry_mkclean(mapping, index, pfn_t_to_pfn(pfn)); 785 dax_mapping_entry_mkclean(mapping, index, pfn_t_to_pfn(pfn));
786 dax_flush(dax_dev, pgoff, kaddr, size); 786 dax_flush(dax_dev, kaddr, size);
787 /* 787 /*
788 * After we have flushed the cache, we can clear the dirty tag. There 788 * After we have flushed the cache, we can clear the dirty tag. There
789 * cannot be new dirty data in the pfn after the flush has completed as 789 * cannot be new dirty data in the pfn after the flush has completed as
@@ -978,7 +978,7 @@ int __dax_zero_page_range(struct block_device *bdev,
978 return rc; 978 return rc;
979 } 979 }
980 memset(kaddr + offset, 0, size); 980 memset(kaddr + offset, 0, size);
981 dax_flush(dax_dev, pgoff, kaddr + offset, size); 981 dax_flush(dax_dev, kaddr + offset, size);
982 dax_read_unlock(id); 982 dax_read_unlock(id);
983 } 983 }
984 return 0; 984 return 0;