]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
dax: unify ext2/4_{dax,}_file_operations
authorBoaz Harrosh <boaz@plexistor.com>
Wed, 15 Apr 2015 23:15:17 +0000 (16:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 15 Apr 2015 23:35:20 +0000 (16:35 -0700)
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>
fs/ext2/ext2.h
fs/ext2/file.c
fs/ext2/inode.c
fs/ext2/namei.c
fs/ext4/ext4.h
fs/ext4/file.c
fs/ext4/inode.c
fs/ext4/namei.c
fs/splice.c

index 678f9ab08c486c5b8384437709fda03a070f8746..8d15febd0aa38db2c87031f6473335e8bfea3aac 100644 (file)
@@ -793,7 +793,6 @@ extern int ext2_fsync(struct file *file, loff_t start, loff_t end,
                      int datasync);
 extern const struct inode_operations ext2_file_inode_operations;
 extern const struct file_operations ext2_file_operations;
-extern const struct file_operations ext2_dax_file_operations;
 
 /* inode.c */
 extern const struct address_space_operations ext2_aops;
index 866a3ce3f8643a6415cf02a6a74c240b6811d5b7..19cac93a65d3eb06e76e53c8283e8c63b795a10d 100644 (file)
@@ -109,24 +109,6 @@ const struct file_operations ext2_file_operations = {
        .splice_write   = iter_file_splice_write,
 };
 
-#ifdef CONFIG_FS_DAX
-const struct file_operations ext2_dax_file_operations = {
-       .llseek         = generic_file_llseek,
-       .read           = new_sync_read,
-       .write          = new_sync_write,
-       .read_iter      = generic_file_read_iter,
-       .write_iter     = generic_file_write_iter,
-       .unlocked_ioctl = ext2_ioctl,
-#ifdef CONFIG_COMPAT
-       .compat_ioctl   = ext2_compat_ioctl,
-#endif
-       .mmap           = ext2_file_mmap,
-       .open           = dquot_file_open,
-       .release        = ext2_release_file,
-       .fsync          = ext2_fsync,
-};
-#endif
-
 const struct inode_operations ext2_file_inode_operations = {
 #ifdef CONFIG_EXT2_FS_XATTR
        .setxattr       = generic_setxattr,
index df9d6afbc5d5eb745e00a9a2575b28890e94d7b7..b29eb6747116228cc35fa849a830187206e248b7 100644 (file)
@@ -1388,10 +1388,7 @@ struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
 
        if (S_ISREG(inode->i_mode)) {
                inode->i_op = &ext2_file_inode_operations;
-               if (test_opt(inode->i_sb, DAX)) {
-                       inode->i_mapping->a_ops = &ext2_aops;
-                       inode->i_fop = &ext2_dax_file_operations;
-               } else if (test_opt(inode->i_sb, NOBH)) {
+               if (test_opt(inode->i_sb, NOBH)) {
                        inode->i_mapping->a_ops = &ext2_nobh_aops;
                        inode->i_fop = &ext2_file_operations;
                } else {
index 148f6e3789eaea4fa7937ef019d9dbf23af36b60..ce422931f4114fff48d23a4887679a11c5341595 100644 (file)
@@ -104,10 +104,7 @@ static int ext2_create (struct inode * dir, struct dentry * dentry, umode_t mode
                return PTR_ERR(inode);
 
        inode->i_op = &ext2_file_inode_operations;
-       if (test_opt(inode->i_sb, DAX)) {
-               inode->i_mapping->a_ops = &ext2_aops;
-               inode->i_fop = &ext2_dax_file_operations;
-       } else if (test_opt(inode->i_sb, NOBH)) {
+       if (test_opt(inode->i_sb, NOBH)) {
                inode->i_mapping->a_ops = &ext2_nobh_aops;
                inode->i_fop = &ext2_file_operations;
        } else {
@@ -125,10 +122,7 @@ static int ext2_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
                return PTR_ERR(inode);
 
        inode->i_op = &ext2_file_inode_operations;
-       if (test_opt(inode->i_sb, DAX)) {
-               inode->i_mapping->a_ops = &ext2_aops;
-               inode->i_fop = &ext2_dax_file_operations;
-       } else if (test_opt(inode->i_sb, NOBH)) {
+       if (test_opt(inode->i_sb, NOBH)) {
                inode->i_mapping->a_ops = &ext2_nobh_aops;
                inode->i_fop = &ext2_file_operations;
        } else {
index f63c3d5805c4c156ad3ed412cbecf85e700cf9d2..8a3981ea35d874706e00ed17b37d05d509129950 100644 (file)
@@ -2593,7 +2593,6 @@ extern const struct file_operations ext4_dir_operations;
 /* file.c */
 extern const struct inode_operations ext4_file_inode_operations;
 extern const struct file_operations ext4_file_operations;
-extern const struct file_operations ext4_dax_file_operations;
 extern loff_t ext4_llseek(struct file *file, loff_t offset, int origin);
 
 /* inline.c */
index aa78c70553f4439f65c7aa7fc9bec31bbc7ad0aa..e6d4280d66be28f950747170c0c73d5ed5e6c810 100644 (file)
@@ -625,26 +625,6 @@ const struct file_operations ext4_file_operations = {
        .fallocate      = ext4_fallocate,
 };
 
-#ifdef CONFIG_FS_DAX
-const struct file_operations ext4_dax_file_operations = {
-       .llseek         = ext4_llseek,
-       .read           = new_sync_read,
-       .write          = new_sync_write,
-       .read_iter      = generic_file_read_iter,
-       .write_iter     = ext4_file_write_iter,
-       .unlocked_ioctl = ext4_ioctl,
-#ifdef CONFIG_COMPAT
-       .compat_ioctl   = ext4_compat_ioctl,
-#endif
-       .mmap           = ext4_file_mmap,
-       .open           = ext4_file_open,
-       .release        = ext4_release_file,
-       .fsync          = ext4_sync_file,
-       /* Splice not yet supported with DAX */
-       .fallocate      = ext4_fallocate,
-};
-#endif
-
 const struct inode_operations ext4_file_inode_operations = {
        .setattr        = ext4_setattr,
        .getattr        = ext4_getattr,
index a3f451370bef4b49a23343daf63af2459de0741c..035b7a06f1c3b0e09f059a7905b815bf344701f1 100644 (file)
@@ -4090,10 +4090,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
 
        if (S_ISREG(inode->i_mode)) {
                inode->i_op = &ext4_file_inode_operations;
-               if (test_opt(inode->i_sb, DAX))
-                       inode->i_fop = &ext4_dax_file_operations;
-               else
-                       inode->i_fop = &ext4_file_operations;
+               inode->i_fop = &ext4_file_operations;
                ext4_set_aops(inode);
        } else if (S_ISDIR(inode->i_mode)) {
                inode->i_op = &ext4_dir_inode_operations;
index 28fe71a2904c6de8c9774e67238d3a16a9b422a6..2291923dae4e6c4cf351dcdb7d88d59f9314590d 100644 (file)
@@ -2235,10 +2235,7 @@ retry:
        err = PTR_ERR(inode);
        if (!IS_ERR(inode)) {
                inode->i_op = &ext4_file_inode_operations;
-               if (test_opt(inode->i_sb, DAX))
-                       inode->i_fop = &ext4_dax_file_operations;
-               else
-                       inode->i_fop = &ext4_file_operations;
+               inode->i_fop = &ext4_file_operations;
                ext4_set_aops(inode);
                err = ext4_add_nondir(handle, dentry, inode);
                if (!err && IS_DIRSYNC(dir))
@@ -2302,10 +2299,7 @@ retry:
        err = PTR_ERR(inode);
        if (!IS_ERR(inode)) {
                inode->i_op = &ext4_file_inode_operations;
-               if (test_opt(inode->i_sb, DAX))
-                       inode->i_fop = &ext4_dax_file_operations;
-               else
-                       inode->i_fop = &ext4_file_operations;
+               inode->i_fop = &ext4_file_operations;
                ext4_set_aops(inode);
                d_tmpfile(dentry, inode);
                err = ext4_orphan_add(handle, inode);
index 41cbb16299e0949984eb284887c22f77fff0390f..476024bb6546527887517868b122c9305dc32d07 100644 (file)
@@ -523,6 +523,9 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
        loff_t isize, left;
        int ret;
 
+       if (IS_DAX(in->f_mapping->host))
+               return default_file_splice_read(in, ppos, pipe, len, flags);
+
        isize = i_size_read(in->f_mapping->host);
        if (unlikely(*ppos >= isize))
                return 0;