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/ext2 | |
| 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/ext2')
| -rw-r--r-- | fs/ext2/ext2.h | 1 | ||||
| -rw-r--r-- | fs/ext2/file.c | 18 | ||||
| -rw-r--r-- | fs/ext2/inode.c | 5 | ||||
| -rw-r--r-- | fs/ext2/namei.c | 10 |
4 files changed, 3 insertions, 31 deletions
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index 678f9ab08c48..8d15febd0aa3 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h | |||
| @@ -793,7 +793,6 @@ extern int ext2_fsync(struct file *file, loff_t start, loff_t end, | |||
| 793 | int datasync); | 793 | int datasync); |
| 794 | extern const struct inode_operations ext2_file_inode_operations; | 794 | extern const struct inode_operations ext2_file_inode_operations; |
| 795 | extern const struct file_operations ext2_file_operations; | 795 | extern const struct file_operations ext2_file_operations; |
| 796 | extern const struct file_operations ext2_dax_file_operations; | ||
| 797 | 796 | ||
| 798 | /* inode.c */ | 797 | /* inode.c */ |
| 799 | extern const struct address_space_operations ext2_aops; | 798 | extern const struct address_space_operations ext2_aops; |
diff --git a/fs/ext2/file.c b/fs/ext2/file.c index 866a3ce3f864..19cac93a65d3 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c | |||
| @@ -109,24 +109,6 @@ const struct file_operations ext2_file_operations = { | |||
| 109 | .splice_write = iter_file_splice_write, | 109 | .splice_write = iter_file_splice_write, |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | #ifdef CONFIG_FS_DAX | ||
| 113 | const struct file_operations ext2_dax_file_operations = { | ||
| 114 | .llseek = generic_file_llseek, | ||
| 115 | .read = new_sync_read, | ||
| 116 | .write = new_sync_write, | ||
| 117 | .read_iter = generic_file_read_iter, | ||
| 118 | .write_iter = generic_file_write_iter, | ||
| 119 | .unlocked_ioctl = ext2_ioctl, | ||
| 120 | #ifdef CONFIG_COMPAT | ||
| 121 | .compat_ioctl = ext2_compat_ioctl, | ||
| 122 | #endif | ||
| 123 | .mmap = ext2_file_mmap, | ||
| 124 | .open = dquot_file_open, | ||
| 125 | .release = ext2_release_file, | ||
| 126 | .fsync = ext2_fsync, | ||
| 127 | }; | ||
| 128 | #endif | ||
| 129 | |||
| 130 | const struct inode_operations ext2_file_inode_operations = { | 112 | const struct inode_operations ext2_file_inode_operations = { |
| 131 | #ifdef CONFIG_EXT2_FS_XATTR | 113 | #ifdef CONFIG_EXT2_FS_XATTR |
| 132 | .setxattr = generic_setxattr, | 114 | .setxattr = generic_setxattr, |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index df9d6afbc5d5..b29eb6747116 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
| @@ -1388,10 +1388,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino) | |||
| 1388 | 1388 | ||
| 1389 | if (S_ISREG(inode->i_mode)) { | 1389 | if (S_ISREG(inode->i_mode)) { |
| 1390 | inode->i_op = &ext2_file_inode_operations; | 1390 | inode->i_op = &ext2_file_inode_operations; |
| 1391 | if (test_opt(inode->i_sb, DAX)) { | 1391 | if (test_opt(inode->i_sb, NOBH)) { |
| 1392 | inode->i_mapping->a_ops = &ext2_aops; | ||
| 1393 | inode->i_fop = &ext2_dax_file_operations; | ||
| 1394 | } else if (test_opt(inode->i_sb, NOBH)) { | ||
| 1395 | inode->i_mapping->a_ops = &ext2_nobh_aops; | 1392 | inode->i_mapping->a_ops = &ext2_nobh_aops; |
| 1396 | inode->i_fop = &ext2_file_operations; | 1393 | inode->i_fop = &ext2_file_operations; |
| 1397 | } else { | 1394 | } else { |
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index 148f6e3789ea..ce422931f411 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
| @@ -104,10 +104,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode | |||
| 104 | return PTR_ERR(inode); | 104 | return PTR_ERR(inode); |
| 105 | 105 | ||
| 106 | inode->i_op = &ext2_file_inode_operations; | 106 | inode->i_op = &ext2_file_inode_operations; |
| 107 | if (test_opt(inode->i_sb, DAX)) { | 107 | if (test_opt(inode->i_sb, NOBH)) { |
| 108 | inode->i_mapping->a_ops = &ext2_aops; | ||
| 109 | inode->i_fop = &ext2_dax_file_operations; | ||
| 110 | } else if (test_opt(inode->i_sb, NOBH)) { | ||
| 111 | inode->i_mapping->a_ops = &ext2_nobh_aops; | 108 | inode->i_mapping->a_ops = &ext2_nobh_aops; |
| 112 | inode->i_fop = &ext2_file_operations; | 109 | inode->i_fop = &ext2_file_operations; |
| 113 | } else { | 110 | } else { |
| @@ -125,10 +122,7 @@ static int ext2_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
| 125 | return PTR_ERR(inode); | 122 | return PTR_ERR(inode); |
| 126 | 123 | ||
| 127 | inode->i_op = &ext2_file_inode_operations; | 124 | inode->i_op = &ext2_file_inode_operations; |
| 128 | if (test_opt(inode->i_sb, DAX)) { | 125 | if (test_opt(inode->i_sb, NOBH)) { |
| 129 | inode->i_mapping->a_ops = &ext2_aops; | ||
| 130 | inode->i_fop = &ext2_dax_file_operations; | ||
| 131 | } else if (test_opt(inode->i_sb, NOBH)) { | ||
| 132 | inode->i_mapping->a_ops = &ext2_nobh_aops; | 126 | inode->i_mapping->a_ops = &ext2_nobh_aops; |
| 133 | inode->i_fop = &ext2_file_operations; | 127 | inode->i_fop = &ext2_file_operations; |
| 134 | } else { | 128 | } else { |
