aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dax.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-07 12:44:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-07 12:44:06 -0400
commitb6ffe9ba46016f8351896ccee33bebcd0e5ea7c0 (patch)
tree839a5a070eabe8851797330ea77ca7eb7c93bcc1 /fs/dax.c
parent9f45efb9286268e01d5022d34a58a68f53ca3072 (diff)
parent9d92573fff3ec70785ef1815cc80573f70e7a921 (diff)
Merge tag 'libnvdimm-for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm
Pull libnvdimm updates from Dan Williams: "libnvdimm updates for the latest ACPI and UEFI specifications. This pull request also includes new 'struct dax_operations' enabling to undo the abuse of copy_user_nocache() for copy operations to pmem. The dax work originally missed 4.12 to address concerns raised by Al. Summary: - Introduce the _flushcache() family of memory copy helpers and use them for persistent memory write operations on x86. The _flushcache() semantic indicates that the cache is either bypassed for the copy operation (movnt) or any lines dirtied by the copy operation are written back (clwb, clflushopt, or clflush). - Extend dax_operations with ->copy_from_iter() and ->flush() operations. These operations and other infrastructure updates allow all persistent memory specific dax functionality to be pushed into libnvdimm and the pmem driver directly. It also allows dax-specific sysfs attributes to be linked to a host device, for example: /sys/block/pmem0/dax/write_cache - Add support for the new NVDIMM platform/firmware mechanisms introduced in ACPI 6.2 and UEFI 2.7. This support includes the v1.2 namespace label format, extensions to the address-range-scrub command set, new error injection commands, and a new BTT (block-translation-table) layout. These updates support inter-OS and pre-OS compatibility. - Fix a longstanding memory corruption bug in nfit_test. - Make the pmem and nvdimm-region 'badblocks' sysfs files poll(2) capable. - Miscellaneous fixes and small updates across libnvdimm and the nfit driver. Acknowledgements that came after the branch was pushed: commit 6aa734a2f38e ("libnvdimm, region, pmem: fix 'badblocks' sysfs_get_dirent() reference lifetime") was reviewed by Toshi Kani <toshi.kani@hpe.com>" * tag 'libnvdimm-for-4.13' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (42 commits) libnvdimm, namespace: record 'lbasize' for pmem namespaces acpi/nfit: Issue Start ARS to retrieve existing records libnvdimm: New ACPI 6.2 DSM functions acpi, nfit: Show bus_dsm_mask in sysfs libnvdimm, acpi, nfit: Add bus level dsm mask for pass thru. acpi, nfit: Enable DSM pass thru for root functions. libnvdimm: passthru functions clear to send libnvdimm, btt: convert some info messages to warn/err libnvdimm, region, pmem: fix 'badblocks' sysfs_get_dirent() reference lifetime libnvdimm: fix the clear-error check in nsio_rw_bytes libnvdimm, btt: fix btt_rw_page not returning errors acpi, nfit: quiet invalid block-aperture-region warnings libnvdimm, btt: BTT updates for UEFI 2.7 format acpi, nfit: constify *_attribute_group libnvdimm, pmem: disable dax flushing when pmem is fronting a volatile region libnvdimm, pmem, dax: export a cache control attribute dax: convert to bitmask for flags dax: remove default copy_from_iter fallback libnvdimm, nfit: enable support for volatile ranges libnvdimm, pmem: fix persistence warning ...
Diffstat (limited to 'fs/dax.c')
-rw-r--r--fs/dax.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/dax.c b/fs/dax.c
index cd8fced592d0..b1cd18dcc177 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -25,7 +25,6 @@
25#include <linux/mm.h> 25#include <linux/mm.h>
26#include <linux/mutex.h> 26#include <linux/mutex.h>
27#include <linux/pagevec.h> 27#include <linux/pagevec.h>
28#include <linux/pmem.h>
29#include <linux/sched.h> 28#include <linux/sched.h>
30#include <linux/sched/signal.h> 29#include <linux/sched/signal.h>
31#include <linux/uio.h> 30#include <linux/uio.h>
@@ -784,7 +783,7 @@ static int dax_writeback_one(struct block_device *bdev,
784 } 783 }
785 784
786 dax_mapping_entry_mkclean(mapping, index, pfn_t_to_pfn(pfn)); 785 dax_mapping_entry_mkclean(mapping, index, pfn_t_to_pfn(pfn));
787 wb_cache_pmem(kaddr, size); 786 dax_flush(dax_dev, pgoff, kaddr, size);
788 /* 787 /*
789 * 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
790 * 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
@@ -976,7 +975,8 @@ int __dax_zero_page_range(struct block_device *bdev,
976 dax_read_unlock(id); 975 dax_read_unlock(id);
977 return rc; 976 return rc;
978 } 977 }
979 clear_pmem(kaddr + offset, size); 978 memset(kaddr + offset, 0, size);
979 dax_flush(dax_dev, pgoff, kaddr + offset, size);
980 dax_read_unlock(id); 980 dax_read_unlock(id);
981 } 981 }
982 return 0; 982 return 0;
@@ -1055,7 +1055,8 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
1055 map_len = end - pos; 1055 map_len = end - pos;
1056 1056
1057 if (iov_iter_rw(iter) == WRITE) 1057 if (iov_iter_rw(iter) == WRITE)
1058 map_len = copy_from_iter_pmem(kaddr, map_len, iter); 1058 map_len = dax_copy_from_iter(dax_dev, pgoff, kaddr,
1059 map_len, iter);
1059 else 1060 else
1060 map_len = copy_to_iter(kaddr, map_len, iter); 1061 map_len = copy_to_iter(kaddr, map_len, iter);
1061 if (map_len <= 0) { 1062 if (map_len <= 0) {