Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be64f884 authored by Boaz Harrosh's avatar Boaz Harrosh Committed by Linus Torvalds
Browse files

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: default avatarBoaz Harrosh <boaz@plexistor.com>
Reviewed-by: default avatarJan 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 0e3b210c
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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;
+0 −18
Original line number Diff line number Diff line
@@ -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,
+1 −4
Original line number Diff line number Diff line
@@ -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 {
+2 −8
Original line number Diff line number Diff line
@@ -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 {
+0 −1
Original line number Diff line number Diff line
@@ -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 */
Loading