diff options
Diffstat (limited to 'fs/dax.c')
-rw-r--r-- | fs/dax.c | 45 |
1 files changed, 32 insertions, 13 deletions
@@ -1118,16 +1118,8 @@ static int dax_fault_return(int error) | |||
1118 | return VM_FAULT_SIGBUS; | 1118 | return VM_FAULT_SIGBUS; |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | /** | 1121 | static int dax_iomap_pte_fault(struct vm_fault *vmf, |
1122 | * dax_iomap_fault - handle a page fault on a DAX file | 1122 | const struct iomap_ops *ops) |
1123 | * @vmf: The description of the fault | ||
1124 | * @ops: iomap ops passed from the file system | ||
1125 | * | ||
1126 | * When a page fault occurs, filesystems may call this helper in their fault | ||
1127 | * or mkwrite handler for DAX files. Assumes the caller has done all the | ||
1128 | * necessary locking for the page fault to proceed successfully. | ||
1129 | */ | ||
1130 | int dax_iomap_fault(struct vm_fault *vmf, const struct iomap_ops *ops) | ||
1131 | { | 1123 | { |
1132 | struct address_space *mapping = vmf->vma->vm_file->f_mapping; | 1124 | struct address_space *mapping = vmf->vma->vm_file->f_mapping; |
1133 | struct inode *inode = mapping->host; | 1125 | struct inode *inode = mapping->host; |
@@ -1244,7 +1236,6 @@ int dax_iomap_fault(struct vm_fault *vmf, const struct iomap_ops *ops) | |||
1244 | } | 1236 | } |
1245 | return vmf_ret; | 1237 | return vmf_ret; |
1246 | } | 1238 | } |
1247 | EXPORT_SYMBOL_GPL(dax_iomap_fault); | ||
1248 | 1239 | ||
1249 | #ifdef CONFIG_FS_DAX_PMD | 1240 | #ifdef CONFIG_FS_DAX_PMD |
1250 | /* | 1241 | /* |
@@ -1335,7 +1326,8 @@ fallback: | |||
1335 | return VM_FAULT_FALLBACK; | 1326 | return VM_FAULT_FALLBACK; |
1336 | } | 1327 | } |
1337 | 1328 | ||
1338 | int dax_iomap_pmd_fault(struct vm_fault *vmf, const struct iomap_ops *ops) | 1329 | static int dax_iomap_pmd_fault(struct vm_fault *vmf, |
1330 | const struct iomap_ops *ops) | ||
1339 | { | 1331 | { |
1340 | struct vm_area_struct *vma = vmf->vma; | 1332 | struct vm_area_struct *vma = vmf->vma; |
1341 | struct address_space *mapping = vma->vm_file->f_mapping; | 1333 | struct address_space *mapping = vma->vm_file->f_mapping; |
@@ -1443,5 +1435,32 @@ out: | |||
1443 | trace_dax_pmd_fault_done(inode, vmf, max_pgoff, result); | 1435 | trace_dax_pmd_fault_done(inode, vmf, max_pgoff, result); |
1444 | return result; | 1436 | return result; |
1445 | } | 1437 | } |
1446 | EXPORT_SYMBOL_GPL(dax_iomap_pmd_fault); | 1438 | #else |
1439 | static int dax_iomap_pmd_fault(struct vm_fault *vmf, struct iomap_ops *ops) | ||
1440 | { | ||
1441 | return VM_FAULT_FALLBACK; | ||
1442 | } | ||
1447 | #endif /* CONFIG_FS_DAX_PMD */ | 1443 | #endif /* CONFIG_FS_DAX_PMD */ |
1444 | |||
1445 | /** | ||
1446 | * dax_iomap_fault - handle a page fault on a DAX file | ||
1447 | * @vmf: The description of the fault | ||
1448 | * @ops: iomap ops passed from the file system | ||
1449 | * | ||
1450 | * When a page fault occurs, filesystems may call this helper in | ||
1451 | * their fault handler for DAX files. dax_iomap_fault() assumes the caller | ||
1452 | * has done all the necessary locking for page fault to proceed | ||
1453 | * successfully. | ||
1454 | */ | ||
1455 | int dax_iomap_fault(struct vm_fault *vmf, const struct iomap_ops *ops) | ||
1456 | { | ||
1457 | switch (vmf->flags & FAULT_FLAG_SIZE_MASK) { | ||
1458 | case FAULT_FLAG_SIZE_PTE: | ||
1459 | return dax_iomap_pte_fault(vmf, ops); | ||
1460 | case FAULT_FLAG_SIZE_PMD: | ||
1461 | return dax_iomap_pmd_fault(vmf, ops); | ||
1462 | default: | ||
1463 | return VM_FAULT_FALLBACK; | ||
1464 | } | ||
1465 | } | ||
1466 | EXPORT_SYMBOL_GPL(dax_iomap_fault); | ||