linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dax: update PMD fault handler with PMEM API
@ 2015-09-09 16:29 Ross Zwisler
  2015-09-09 16:49 ` Linus Torvalds
  0 siblings, 1 reply; 2+ messages in thread
From: Ross Zwisler @ 2015-09-09 16:29 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ross Zwisler, Alexander Viro, Matthew Wilcox, linux-fsdevel,
	linux-kernel, Dan Williams, linux-nvdimm, Kirill A. Shutemov

As part of the v4.3 merge window the DAX code was updated by Matthew and
Kirill to handle PMD pages.  Also as part of the v4.3 merge window we
updated the DAX code to do proper PMEM flushing:

2765cfbb342c ("dax: update I/O path to do proper PMEM flushing")

The additional code added by the DAX PMD patches also needs to be
updated to properly use the PMEM API.  This ensures that after a PMD
fault is handled the zeros written to the newly allocated pages are
durable on the DIMMs.

linux/dax.h is included to get rid of a bunch of sparse warnings.

Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
Linus, would you consider applying this to the v4.3 merge tree?
---
 fs/dax.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index e43389c..93bf2f9 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -17,6 +17,7 @@
 #include <linux/atomic.h>
 #include <linux/blkdev.h>
 #include <linux/buffer_head.h>
+#include <linux/dax.h>
 #include <linux/fs.h>
 #include <linux/genhd.h>
 #include <linux/highmem.h>
@@ -527,7 +528,7 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
 	unsigned long pmd_addr = address & PMD_MASK;
 	bool write = flags & FAULT_FLAG_WRITE;
 	long length;
-	void *kaddr;
+	void __pmem *kaddr;
 	pgoff_t size, pgoff;
 	sector_t block, sector;
 	unsigned long pfn;
@@ -570,7 +571,8 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
 	if (buffer_unwritten(&bh) || buffer_new(&bh)) {
 		int i;
 		for (i = 0; i < PTRS_PER_PMD; i++)
-			clear_page(kaddr + i * PAGE_SIZE);
+			clear_pmem(kaddr + i * PAGE_SIZE, PAGE_SIZE);
+		wmb_pmem();
 		count_vm_event(PGMAJFAULT);
 		mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT);
 		result |= VM_FAULT_MAJOR;
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] dax: update PMD fault handler with PMEM API
  2015-09-09 16:29 [PATCH] dax: update PMD fault handler with PMEM API Ross Zwisler
@ 2015-09-09 16:49 ` Linus Torvalds
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2015-09-09 16:49 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Alexander Viro, Matthew Wilcox, linux-fsdevel,
	Linux Kernel Mailing List, Dan Williams, linux-nvdimm,
	Kirill A. Shutemov

On Wed, Sep 9, 2015 at 9:29 AM, Ross Zwisler
<ross.zwisler@linux.intel.com> wrote:
> Linus, would you consider applying this to the v4.3 merge tree?

Done.

             Linus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-09 16:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-09 16:29 [PATCH] dax: update PMD fault handler with PMEM API Ross Zwisler
2015-09-09 16:49 ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).