linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Boaz Harrosh <boaz@plexistor.com>
Cc: Dave Chinner <david@fromorbit.com>,
	Matthew Wilcox <matthew.r.wilcox@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Jan Kara <jack@suse.cz>, Hugh Dickins <hughd@google.com>,
	Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, linux-nvdimm <linux-nvdimm@ml01.01.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Eryu Guan <eguan@redhat.com>,
	Christoph Hellwig <hch@infradead.org>,
	Stable Tree <stable@vger.kernel.org>
Subject: Re: [PATCH 3/3] dax: Unify ext2/4_{dax,}_file_operations
Date: Tue, 7 Apr 2015 18:26:48 +0200	[thread overview]
Message-ID: <20150407162648.GH14897@quack.suse.cz> (raw)
In-Reply-To: <55239915.7030003@plexistor.com>

On Tue 07-04-15 11:45:09, Boaz Harrosh wrote:
> 
> The original dax patchset split the ext2/4_file_operations
> because of the two NULL splice_read/splice_write in the dax
> case.
> 
> At vfs if splice_read/splice_write are NULL would 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, ...).
> 
> CC: Dave Chinner <dchinner@redhat.com>
> CC: Matthew Wilcox <willy@linux.intel.com>
> Signed-off-by: Boaz Harrosh <boaz@plexistor.com>
  The patch looks good to me. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext2/ext2.h  |  1 -
>  fs/ext2/file.c  | 18 ------------------
>  fs/ext2/inode.c |  5 +----
>  fs/ext2/namei.c | 10 ++--------
>  fs/ext4/ext4.h  |  1 -
>  fs/ext4/file.c  | 20 --------------------
>  fs/ext4/inode.c |  5 +----
>  fs/ext4/namei.c | 10 ++--------
>  fs/splice.c     |  3 +++
>  9 files changed, 9 insertions(+), 64 deletions(-)
> 
> diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
> index 678f9ab..8d15feb 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,
>  		      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;
> diff --git a/fs/ext2/file.c b/fs/ext2/file.c
> index 866a3ce..19cac93 100644
> --- a/fs/ext2/file.c
> +++ b/fs/ext2/file.c
> @@ -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,
> diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
> index df9d6af..b29eb67 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)
>  
>  	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 {
> diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
> index 148f6e3..ce42293 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
>  		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 {
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index f63c3d5..8a3981e 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -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 */
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index aa78c70..e6d4280 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -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,
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index a3f4513..035b7a0 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)
>  
>  	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;
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 28fe71a..2291923 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -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);
> diff --git a/fs/splice.c b/fs/splice.c
> index 41cbb16..476024b 100644
> --- a/fs/splice.c
> +++ b/fs/splice.c
> @@ -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;
> -- 
> 1.9.3
> 
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-04-07 16:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07  8:33 [PATCH 0/3 v5] dax: some dax fixes and cleanups Boaz Harrosh
2015-04-07  8:40 ` [PATCH 1/3] mm(v4.1): New pfn_mkwrite same as page_mkwrite for VM_PFNMAP Boaz Harrosh
2015-04-07  8:51   ` Boaz Harrosh
2015-04-07  9:03   ` Kirill A. Shutemov
2015-04-07  9:22     ` Boaz Harrosh
2015-04-07 12:57   ` [PATCH 1/3 v6] " Boaz Harrosh
2015-04-07 13:17     ` Kirill A. Shutemov
2015-04-07 13:26       ` Kirill A. Shutemov
2015-04-07 13:37         ` Boaz Harrosh
2015-04-07 13:47           ` Kirill A. Shutemov
2015-04-07 14:09             ` Boaz Harrosh
2015-04-07 14:06   ` [PATCH 1/3 v7] " Boaz Harrosh
2015-04-07 14:12     ` Kirill A. Shutemov
2015-04-07  8:43 ` [PATCH 2/3] dax: use pfn_mkwrite to update c/mtime + freeze protection Boaz Harrosh
2015-04-07 16:28   ` Jan Kara
2015-04-07  8:45 ` [PATCH 3/3] dax: Unify ext2/4_{dax,}_file_operations Boaz Harrosh
2015-04-07 16:26   ` Jan Kara [this message]
2015-04-08 15:56 ` [PATCH 1/3 @stable] mm(v4.0): New pfn_mkwrite same as page_mkwrite for VM_PFNMAP Boaz Harrosh
2015-04-08 16:00   ` Boaz Harrosh
2015-04-08 20:26     ` Greg KH
2015-04-12  7:49       ` Boaz Harrosh
  -- strict thread matches above, loose matches on Subject: below --
2015-03-25 13:34 [PATCH 0/3 v4] dax: some dax fixes and cleanups Boaz Harrosh
2015-03-25 13:44 ` [PATCH 3/3] dax: Unify ext2/4_{dax,}_file_operations Boaz Harrosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150407162648.GH14897@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=boaz@plexistor.com \
    --cc=david@fromorbit.com \
    --cc=eguan@redhat.com \
    --cc=hch@infradead.org \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-nvdimm@ml01.01.org \
    --cc=matthew.r.wilcox@intel.com \
    --cc=mgorman@suse.de \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).