diff options
author | Boaz Harrosh <boaz@plexistor.com> | 2015-04-15 19:15:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 19:35:20 -0400 |
commit | be64f884bed729b5d127db6a737155a4e514d286 (patch) | |
tree | e6a8204f14b497cbfb845cc30920955dc7671527 /fs/ext4 | |
parent | 0e3b210ce1722168227cb3bc7746256d0c0afece (diff) |
dax: unify ext2/4_{dax,}_file_operations
The original dax patchset split the ext2/4_file_operations because of the
two NULL splice_read/splice_write in the dax case.
In the vfs if splice_read/splice_write are NULL we then call
default_splice_read/write.
What we do here is make generic_file_splice_read aware of IS_DAX() so the
original ext2/4_file_operations can be used as is.
For write it appears that iter_file_splice_write is just fine. It uses
the regular f_op->write(file,..) or new_sync_write(file, ...).
Signed-off-by: Boaz Harrosh <boaz@plexistor.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/ext4.h | 1 | ||||
-rw-r--r-- | fs/ext4/file.c | 20 | ||||
-rw-r--r-- | fs/ext4/inode.c | 5 | ||||
-rw-r--r-- | fs/ext4/namei.c | 10 |
4 files changed, 3 insertions, 33 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index f63c3d5805c4..8a3981ea35d8 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -2593,7 +2593,6 @@ extern const struct file_operations ext4_dir_operations; | |||
2593 | /* file.c */ | 2593 | /* file.c */ |
2594 | extern const struct inode_operations ext4_file_inode_operations; | 2594 | extern const struct inode_operations ext4_file_inode_operations; |
2595 | extern const struct file_operations ext4_file_operations; | 2595 | extern const struct file_operations ext4_file_operations; |
2596 | extern const struct file_operations ext4_dax_file_operations; | ||
2597 | extern loff_t ext4_llseek(struct file *file, loff_t offset, int origin); | 2596 | extern loff_t ext4_llseek(struct file *file, loff_t offset, int origin); |
2598 | 2597 | ||
2599 | /* inline.c */ | 2598 | /* inline.c */ |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index aa78c70553f4..e6d4280d66be 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -625,26 +625,6 @@ const struct file_operations ext4_file_operations = { | |||
625 | .fallocate = ext4_fallocate, | 625 | .fallocate = ext4_fallocate, |
626 | }; | 626 | }; |
627 | 627 | ||
628 | #ifdef CONFIG_FS_DAX | ||
629 | const struct file_operations ext4_dax_file_operations = { | ||
630 | .llseek = ext4_llseek, | ||
631 | .read = new_sync_read, | ||
632 | .write = new_sync_write, | ||
633 | .read_iter = generic_file_read_iter, | ||
634 | .write_iter = ext4_file_write_iter, | ||
635 | .unlocked_ioctl = ext4_ioctl, | ||
636 | #ifdef CONFIG_COMPAT | ||
637 | .compat_ioctl = ext4_compat_ioctl, | ||
638 | #endif | ||
639 | .mmap = ext4_file_mmap, | ||
640 | .open = ext4_file_open, | ||
641 | .release = ext4_release_file, | ||
642 | .fsync = ext4_sync_file, | ||
643 | /* Splice not yet supported with DAX */ | ||
644 | .fallocate = ext4_fallocate, | ||
645 | }; | ||
646 | #endif | ||
647 | |||
648 | const struct inode_operations ext4_file_inode_operations = { | 628 | const struct inode_operations ext4_file_inode_operations = { |
649 | .setattr = ext4_setattr, | 629 | .setattr = ext4_setattr, |
650 | .getattr = ext4_getattr, | 630 | .getattr = ext4_getattr, |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index a3f451370bef..035b7a06f1c3 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -4090,10 +4090,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
4090 | 4090 | ||
4091 | if (S_ISREG(inode->i_mode)) { | 4091 | if (S_ISREG(inode->i_mode)) { |
4092 | inode->i_op = &ext4_file_inode_operations; | 4092 | inode->i_op = &ext4_file_inode_operations; |
4093 | if (test_opt(inode->i_sb, DAX)) | 4093 | inode->i_fop = &ext4_file_operations; |
4094 | inode->i_fop = &ext4_dax_file_operations; | ||
4095 | else | ||
4096 | inode->i_fop = &ext4_file_operations; | ||
4097 | ext4_set_aops(inode); | 4094 | ext4_set_aops(inode); |
4098 | } else if (S_ISDIR(inode->i_mode)) { | 4095 | } else if (S_ISDIR(inode->i_mode)) { |
4099 | inode->i_op = &ext4_dir_inode_operations; | 4096 | inode->i_op = &ext4_dir_inode_operations; |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 28fe71a2904c..2291923dae4e 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -2235,10 +2235,7 @@ retry: | |||
2235 | err = PTR_ERR(inode); | 2235 | err = PTR_ERR(inode); |
2236 | if (!IS_ERR(inode)) { | 2236 | if (!IS_ERR(inode)) { |
2237 | inode->i_op = &ext4_file_inode_operations; | 2237 | inode->i_op = &ext4_file_inode_operations; |
2238 | if (test_opt(inode->i_sb, DAX)) | 2238 | inode->i_fop = &ext4_file_operations; |
2239 | inode->i_fop = &ext4_dax_file_operations; | ||
2240 | else | ||
2241 | inode->i_fop = &ext4_file_operations; | ||
2242 | ext4_set_aops(inode); | 2239 | ext4_set_aops(inode); |
2243 | err = ext4_add_nondir(handle, dentry, inode); | 2240 | err = ext4_add_nondir(handle, dentry, inode); |
2244 | if (!err && IS_DIRSYNC(dir)) | 2241 | if (!err && IS_DIRSYNC(dir)) |
@@ -2302,10 +2299,7 @@ retry: | |||
2302 | err = PTR_ERR(inode); | 2299 | err = PTR_ERR(inode); |
2303 | if (!IS_ERR(inode)) { | 2300 | if (!IS_ERR(inode)) { |
2304 | inode->i_op = &ext4_file_inode_operations; | 2301 | inode->i_op = &ext4_file_inode_operations; |
2305 | if (test_opt(inode->i_sb, DAX)) | 2302 | inode->i_fop = &ext4_file_operations; |
2306 | inode->i_fop = &ext4_dax_file_operations; | ||
2307 | else | ||
2308 | inode->i_fop = &ext4_file_operations; | ||
2309 | ext4_set_aops(inode); | 2303 | ext4_set_aops(inode); |
2310 | d_tmpfile(dentry, inode); | 2304 | d_tmpfile(dentry, inode); |
2311 | err = ext4_orphan_add(handle, inode); | 2305 | err = ext4_orphan_add(handle, inode); |