diff options
Diffstat (limited to 'drivers/dax/dax.c')
-rw-r--r-- | drivers/dax/dax.c | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c index 0261f332bf3e..922ec461dcaa 100644 --- a/drivers/dax/dax.c +++ b/drivers/dax/dax.c | |||
@@ -419,7 +419,7 @@ static phys_addr_t pgoff_to_phys(struct dax_dev *dax_dev, pgoff_t pgoff, | |||
419 | return -1; | 419 | return -1; |
420 | } | 420 | } |
421 | 421 | ||
422 | static int __dax_dev_fault(struct dax_dev *dax_dev, struct vm_fault *vmf) | 422 | static int __dax_dev_pte_fault(struct dax_dev *dax_dev, struct vm_fault *vmf) |
423 | { | 423 | { |
424 | struct device *dev = &dax_dev->dev; | 424 | struct device *dev = &dax_dev->dev; |
425 | struct dax_region *dax_region; | 425 | struct dax_region *dax_region; |
@@ -455,23 +455,6 @@ static int __dax_dev_fault(struct dax_dev *dax_dev, struct vm_fault *vmf) | |||
455 | return VM_FAULT_NOPAGE; | 455 | return VM_FAULT_NOPAGE; |
456 | } | 456 | } |
457 | 457 | ||
458 | static int dax_dev_fault(struct vm_fault *vmf) | ||
459 | { | ||
460 | struct vm_area_struct *vma = vmf->vma; | ||
461 | int rc; | ||
462 | struct file *filp = vma->vm_file; | ||
463 | struct dax_dev *dax_dev = filp->private_data; | ||
464 | |||
465 | dev_dbg(&dax_dev->dev, "%s: %s: %s (%#lx - %#lx)\n", __func__, | ||
466 | current->comm, (vmf->flags & FAULT_FLAG_WRITE) | ||
467 | ? "write" : "read", vma->vm_start, vma->vm_end); | ||
468 | rcu_read_lock(); | ||
469 | rc = __dax_dev_fault(dax_dev, vmf); | ||
470 | rcu_read_unlock(); | ||
471 | |||
472 | return rc; | ||
473 | } | ||
474 | |||
475 | static int __dax_dev_pmd_fault(struct dax_dev *dax_dev, struct vm_fault *vmf) | 458 | static int __dax_dev_pmd_fault(struct dax_dev *dax_dev, struct vm_fault *vmf) |
476 | { | 459 | { |
477 | unsigned long pmd_addr = vmf->address & PMD_MASK; | 460 | unsigned long pmd_addr = vmf->address & PMD_MASK; |
@@ -510,7 +493,7 @@ static int __dax_dev_pmd_fault(struct dax_dev *dax_dev, struct vm_fault *vmf) | |||
510 | vmf->flags & FAULT_FLAG_WRITE); | 493 | vmf->flags & FAULT_FLAG_WRITE); |
511 | } | 494 | } |
512 | 495 | ||
513 | static int dax_dev_pmd_fault(struct vm_fault *vmf) | 496 | static int dax_dev_fault(struct vm_fault *vmf) |
514 | { | 497 | { |
515 | int rc; | 498 | int rc; |
516 | struct file *filp = vmf->vma->vm_file; | 499 | struct file *filp = vmf->vma->vm_file; |
@@ -522,7 +505,16 @@ static int dax_dev_pmd_fault(struct vm_fault *vmf) | |||
522 | vmf->vma->vm_start, vmf->vma->vm_end); | 505 | vmf->vma->vm_start, vmf->vma->vm_end); |
523 | 506 | ||
524 | rcu_read_lock(); | 507 | rcu_read_lock(); |
525 | rc = __dax_dev_pmd_fault(dax_dev, vmf); | 508 | switch (vmf->flags & FAULT_FLAG_SIZE_MASK) { |
509 | case FAULT_FLAG_SIZE_PTE: | ||
510 | rc = __dax_dev_pte_fault(dax_dev, vmf); | ||
511 | break; | ||
512 | case FAULT_FLAG_SIZE_PMD: | ||
513 | rc = __dax_dev_pmd_fault(dax_dev, vmf); | ||
514 | break; | ||
515 | default: | ||
516 | return VM_FAULT_FALLBACK; | ||
517 | } | ||
526 | rcu_read_unlock(); | 518 | rcu_read_unlock(); |
527 | 519 | ||
528 | return rc; | 520 | return rc; |
@@ -530,7 +522,7 @@ static int dax_dev_pmd_fault(struct vm_fault *vmf) | |||
530 | 522 | ||
531 | static const struct vm_operations_struct dax_dev_vm_ops = { | 523 | static const struct vm_operations_struct dax_dev_vm_ops = { |
532 | .fault = dax_dev_fault, | 524 | .fault = dax_dev_fault, |
533 | .pmd_fault = dax_dev_pmd_fault, | 525 | .huge_fault = dax_dev_fault, |
534 | }; | 526 | }; |
535 | 527 | ||
536 | static int dax_mmap(struct file *filp, struct vm_area_struct *vma) | 528 | static int dax_mmap(struct file *filp, struct vm_area_struct *vma) |