All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>
To: Ross Zwisler <ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>,
	linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
	Dave Chinner <david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Andreas Dilger
	<adilger.kernel-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org>,
	Theodore Ts'o <tytso-3s7WtUTddSA@public.gmane.org>,
	linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Subject: Re: [PATCH v2 4/5] ext4: add ext4_should_use_dax()
Date: Tue, 12 Sep 2017 08:46:12 +0200	[thread overview]
Message-ID: <20170912064612.GD16554@quack2.suse.cz> (raw)
In-Reply-To: <20170912050526.7627-5-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

On Mon 11-09-17 23:05:25, Ross Zwisler wrote:
> This helper, in the spirit of ext4_should_dioread_nolock() et al., replaces
> the complex conditional in ext4_set_inode_flags().
> 
> Signed-off-by: Ross Zwisler <ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Yeah, makes sense to me. You can add:

Reviewed-by: Jan Kara <jack-AlSwsSmVLrQ@public.gmane.org>

								Honza

> ---
>  fs/ext4/inode.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 3207333..525dd63 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4577,6 +4577,21 @@ int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc)
>  		!ext4_test_inode_state(inode, EXT4_STATE_XATTR));
>  }
>  
> +static bool ext4_should_use_dax(struct inode *inode)
> +{
> +	if (!test_opt(inode->i_sb, DAX))
> +		return false;
> +	if (!S_ISREG(inode->i_mode))
> +		return false;
> +	if (ext4_should_journal_data(inode))
> +		return false;
> +	if (ext4_has_inline_data(inode))
> +		return false;
> +	if (ext4_encrypted_inode(inode))
> +		return false;
> +	return true;
> +}
> +
>  void ext4_set_inode_flags(struct inode *inode)
>  {
>  	unsigned int flags = EXT4_I(inode)->i_flags;
> @@ -4592,9 +4607,7 @@ void ext4_set_inode_flags(struct inode *inode)
>  		new_fl |= S_NOATIME;
>  	if (flags & EXT4_DIRSYNC_FL)
>  		new_fl |= S_DIRSYNC;
> -	if (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode) &&
> -	    !ext4_should_journal_data(inode) && !ext4_has_inline_data(inode) &&
> -	    !ext4_encrypted_inode(inode))
> +	if (ext4_should_use_dax(inode))
>  		new_fl |= S_DAX;
>  	inode_set_flags(inode, new_fl,
>  			S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX);
> -- 
> 2.9.5
> 
-- 
Jan Kara <jack-IBi9RG/b67k@public.gmane.org>
SUSE Labs, CR

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz>
To: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Jan Kara <jack@suse.cz>,
	linux-nvdimm@lists.01.org, Dave Chinner <david@fromorbit.com>,
	linux-kernel@vger.kernel.org,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Theodore Ts'o <tytso@mit.edu>,
	linux-ext4@vger.kernel.org, Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v2 4/5] ext4: add ext4_should_use_dax()
Date: Tue, 12 Sep 2017 08:46:12 +0200	[thread overview]
Message-ID: <20170912064612.GD16554@quack2.suse.cz> (raw)
In-Reply-To: <20170912050526.7627-5-ross.zwisler@linux.intel.com>

On Mon 11-09-17 23:05:25, Ross Zwisler wrote:
> This helper, in the spirit of ext4_should_dioread_nolock() et al., replaces
> the complex conditional in ext4_set_inode_flags().
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>

Yeah, makes sense to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/inode.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 3207333..525dd63 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4577,6 +4577,21 @@ int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc)
>  		!ext4_test_inode_state(inode, EXT4_STATE_XATTR));
>  }
>  
> +static bool ext4_should_use_dax(struct inode *inode)
> +{
> +	if (!test_opt(inode->i_sb, DAX))
> +		return false;
> +	if (!S_ISREG(inode->i_mode))
> +		return false;
> +	if (ext4_should_journal_data(inode))
> +		return false;
> +	if (ext4_has_inline_data(inode))
> +		return false;
> +	if (ext4_encrypted_inode(inode))
> +		return false;
> +	return true;
> +}
> +
>  void ext4_set_inode_flags(struct inode *inode)
>  {
>  	unsigned int flags = EXT4_I(inode)->i_flags;
> @@ -4592,9 +4607,7 @@ void ext4_set_inode_flags(struct inode *inode)
>  		new_fl |= S_NOATIME;
>  	if (flags & EXT4_DIRSYNC_FL)
>  		new_fl |= S_DIRSYNC;
> -	if (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode) &&
> -	    !ext4_should_journal_data(inode) && !ext4_has_inline_data(inode) &&
> -	    !ext4_encrypted_inode(inode))
> +	if (ext4_should_use_dax(inode))
>  		new_fl |= S_DAX;
>  	inode_set_flags(inode, new_fl,
>  			S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX);
> -- 
> 2.9.5
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

WARNING: multiple messages have this Message-ID (diff)
From: Jan Kara <jack@suse.cz>
To: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>, Jan Kara <jack@suse.cz>,
	linux-kernel@vger.kernel.org,
	Andreas Dilger <adilger.kernel@dilger.ca>,
	Christoph Hellwig <hch@lst.de>,
	Dan Williams <dan.j.williams@intel.com>,
	Dave Chinner <david@fromorbit.com>,
	linux-ext4@vger.kernel.org, linux-nvdimm@lists.01.org
Subject: Re: [PATCH v2 4/5] ext4: add ext4_should_use_dax()
Date: Tue, 12 Sep 2017 08:46:12 +0200	[thread overview]
Message-ID: <20170912064612.GD16554@quack2.suse.cz> (raw)
In-Reply-To: <20170912050526.7627-5-ross.zwisler@linux.intel.com>

On Mon 11-09-17 23:05:25, Ross Zwisler wrote:
> This helper, in the spirit of ext4_should_dioread_nolock() et al., replaces
> the complex conditional in ext4_set_inode_flags().
> 
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>

Yeah, makes sense to me. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/inode.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 3207333..525dd63 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4577,6 +4577,21 @@ int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc)
>  		!ext4_test_inode_state(inode, EXT4_STATE_XATTR));
>  }
>  
> +static bool ext4_should_use_dax(struct inode *inode)
> +{
> +	if (!test_opt(inode->i_sb, DAX))
> +		return false;
> +	if (!S_ISREG(inode->i_mode))
> +		return false;
> +	if (ext4_should_journal_data(inode))
> +		return false;
> +	if (ext4_has_inline_data(inode))
> +		return false;
> +	if (ext4_encrypted_inode(inode))
> +		return false;
> +	return true;
> +}
> +
>  void ext4_set_inode_flags(struct inode *inode)
>  {
>  	unsigned int flags = EXT4_I(inode)->i_flags;
> @@ -4592,9 +4607,7 @@ void ext4_set_inode_flags(struct inode *inode)
>  		new_fl |= S_NOATIME;
>  	if (flags & EXT4_DIRSYNC_FL)
>  		new_fl |= S_DIRSYNC;
> -	if (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode) &&
> -	    !ext4_should_journal_data(inode) && !ext4_has_inline_data(inode) &&
> -	    !ext4_encrypted_inode(inode))
> +	if (ext4_should_use_dax(inode))
>  		new_fl |= S_DAX;
>  	inode_set_flags(inode, new_fl,
>  			S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX);
> -- 
> 2.9.5
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  parent reply	other threads:[~2017-09-12  6:46 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-12  5:05 [PATCH v2 0/5] ext4: DAX data corruption fixes Ross Zwisler
2017-09-12  5:05 ` Ross Zwisler
     [not found] ` <20170912050526.7627-1-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-12  5:05   ` [PATCH v2 1/5] ext4: prevent data corruption with inline data + DAX Ross Zwisler
2017-09-12  5:05     ` Ross Zwisler
2017-09-12  5:05     ` Ross Zwisler
     [not found]     ` <20170912050526.7627-2-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-12  6:38       ` Jan Kara
2017-09-12  6:38         ` Jan Kara
2017-09-12  6:38         ` Jan Kara
2017-10-12 15:52     ` Theodore Ts'o
2017-10-12 15:52       ` Theodore Ts'o
2017-09-12  5:05   ` [PATCH v2 2/5] ext4: prevent data corruption with journaling " Ross Zwisler
2017-09-12  5:05     ` Ross Zwisler
2017-09-12  5:05     ` Ross Zwisler
2017-09-12  6:41     ` Jan Kara
2017-09-12  6:41       ` Jan Kara
     [not found]     ` <20170912050526.7627-3-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-10-12 15:55       ` Theodore Ts'o
2017-10-12 15:55         ` Theodore Ts'o
2017-10-12 15:55         ` Theodore Ts'o
2017-09-12  5:05   ` [PATCH v2 3/5] ext4: add sanity check for encryption " Ross Zwisler
2017-09-12  5:05     ` Ross Zwisler
2017-09-12  5:05     ` Ross Zwisler
2017-09-12  6:45     ` Jan Kara
2017-09-12  6:45       ` Jan Kara
2017-09-12 15:39       ` Ross Zwisler
2017-09-12 15:39         ` Ross Zwisler
2017-09-12  5:05   ` [PATCH v2 4/5] ext4: add ext4_should_use_dax() Ross Zwisler
2017-09-12  5:05     ` Ross Zwisler
2017-09-12  5:05     ` Ross Zwisler
     [not found]     ` <20170912050526.7627-5-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-12  6:46       ` Jan Kara [this message]
2017-09-12  6:46         ` Jan Kara
2017-09-12  6:46         ` Jan Kara
     [not found]         ` <20170912064612.GD16554-4I4JzKEfoa/jFM9bn6wA6Q@public.gmane.org>
2017-10-12 16:01           ` Theodore Ts'o
2017-10-12 16:01             ` Theodore Ts'o
2017-10-12 16:01             ` Theodore Ts'o
2017-09-12  5:05   ` [PATCH v2 5/5] ext4: remove duplicate extended attributes defs Ross Zwisler
2017-09-12  5:05     ` Ross Zwisler
2017-09-12  5:05     ` Ross Zwisler
     [not found]     ` <20170912050526.7627-6-ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-10-12 16:18       ` Theodore Ts'o
2017-10-12 16:18         ` Theodore Ts'o
2017-10-12 16:18         ` Theodore Ts'o
2017-09-29 17:37   ` [PATCH v2 0/5] ext4: DAX data corruption fixes Ross Zwisler
2017-09-29 17:37     ` Ross Zwisler
2017-09-29 17:37     ` Ross Zwisler

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=20170912064612.GD16554@quack2.suse.cz \
    --to=jack-alswssmvlrq@public.gmane.org \
    --cc=adilger.kernel-m1MBpc4rdrD3fQ9qLvQP4Q@public.gmane.org \
    --cc=david-FqsqvQoI3Ljby3iVrkZq2A@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=linux-ext4-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
    --cc=ross.zwisler-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=tytso-3s7WtUTddSA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.