aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/file.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 11:38:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-17 11:38:30 -0500
commitc397f8fa4379040bada53256c848e62c8b060392 (patch)
tree8101efb5c0c3b0a73e5e65f3474843c0914cc4d0 /fs/ext2/file.c
parent796e1c55717e9a6ff5c81b12289ffa1ffd919b6f (diff)
parentaaaf5fbf56f16c81a653713cc333b18ad6e25ea9 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge fifth set of updates from Andrew Morton: - A few things which were awaiting merges from linux-next: - rtc - ocfs2 - misc others - Willy's "dax" feature: direct fs access to memory (mainly NV-DIMMs) which isn't backed by pageframes. * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (37 commits) rtc: add driver for DS1685 family of real time clocks MAINTAINERS: add entry for Maxim PMICs on Samsung boards lib/Kconfig: use bool instead of boolean powerpc: drop _PAGE_FILE and pte_file()-related helpers ocfs2: set append dio as a ro compat feature ocfs2: wait for orphan recovery first once append O_DIRECT write crash ocfs2: complete the rest request through buffer io ocfs2: do not fallback to buffer I/O write if appending ocfs2: allocate blocks in ocfs2_direct_IO_get_blocks ocfs2: implement ocfs2_direct_IO_write ocfs2: add orphan recovery types in ocfs2_recover_orphans ocfs2: add functions to add and remove inode in orphan dir ocfs2: prepare some interfaces used in append direct io MAINTAINERS: fix spelling mistake & remove trailing WS dax: does not work correctly with virtual aliasing caches brd: rename XIP to DAX ext4: add DAX functionality dax: add dax_zero_page_range ext2: get rid of most mentions of XIP in ext2 ext2: remove ext2_aops_xip ...
Diffstat (limited to 'fs/ext2/file.c')
-rw-r--r--fs/ext2/file.c44
1 files changed, 38 insertions, 6 deletions
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 7c87b22a7228..e31701713516 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -25,6 +25,36 @@
25#include "xattr.h" 25#include "xattr.h"
26#include "acl.h" 26#include "acl.h"
27 27
28#ifdef CONFIG_FS_DAX
29static int ext2_dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
30{
31 return dax_fault(vma, vmf, ext2_get_block);
32}
33
34static int ext2_dax_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
35{
36 return dax_mkwrite(vma, vmf, ext2_get_block);
37}
38
39static const struct vm_operations_struct ext2_dax_vm_ops = {
40 .fault = ext2_dax_fault,
41 .page_mkwrite = ext2_dax_mkwrite,
42};
43
44static int ext2_file_mmap(struct file *file, struct vm_area_struct *vma)
45{
46 if (!IS_DAX(file_inode(file)))
47 return generic_file_mmap(file, vma);
48
49 file_accessed(file);
50 vma->vm_ops = &ext2_dax_vm_ops;
51 vma->vm_flags |= VM_MIXEDMAP;
52 return 0;
53}
54#else
55#define ext2_file_mmap generic_file_mmap
56#endif
57
28/* 58/*
29 * Called when filp is released. This happens when all file descriptors 59 * Called when filp is released. This happens when all file descriptors
30 * for a single struct file are closed. Note that different open() calls 60 * for a single struct file are closed. Note that different open() calls
@@ -70,7 +100,7 @@ const struct file_operations ext2_file_operations = {
70#ifdef CONFIG_COMPAT 100#ifdef CONFIG_COMPAT
71 .compat_ioctl = ext2_compat_ioctl, 101 .compat_ioctl = ext2_compat_ioctl,
72#endif 102#endif
73 .mmap = generic_file_mmap, 103 .mmap = ext2_file_mmap,
74 .open = dquot_file_open, 104 .open = dquot_file_open,
75 .release = ext2_release_file, 105 .release = ext2_release_file,
76 .fsync = ext2_fsync, 106 .fsync = ext2_fsync,
@@ -78,16 +108,18 @@ const struct file_operations ext2_file_operations = {
78 .splice_write = iter_file_splice_write, 108 .splice_write = iter_file_splice_write,
79}; 109};
80 110
81#ifdef CONFIG_EXT2_FS_XIP 111#ifdef CONFIG_FS_DAX
82const struct file_operations ext2_xip_file_operations = { 112const struct file_operations ext2_dax_file_operations = {
83 .llseek = generic_file_llseek, 113 .llseek = generic_file_llseek,
84 .read = xip_file_read, 114 .read = new_sync_read,
85 .write = xip_file_write, 115 .write = new_sync_write,
116 .read_iter = generic_file_read_iter,
117 .write_iter = generic_file_write_iter,
86 .unlocked_ioctl = ext2_ioctl, 118 .unlocked_ioctl = ext2_ioctl,
87#ifdef CONFIG_COMPAT 119#ifdef CONFIG_COMPAT
88 .compat_ioctl = ext2_compat_ioctl, 120 .compat_ioctl = ext2_compat_ioctl,
89#endif 121#endif
90 .mmap = xip_file_mmap, 122 .mmap = ext2_file_mmap,
91 .open = dquot_file_open, 123 .open = dquot_file_open,
92 .release = ext2_release_file, 124 .release = ext2_release_file,
93 .fsync = ext2_fsync, 125 .fsync = ext2_fsync,