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
next prev parent reply other threads:[~2017-09-12 6:46 UTC|newest]
Thread overview: 16+ 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 ` [PATCH v2 1/5] ext4: prevent data corruption with inline data + DAX Ross Zwisler
2017-09-12 6:38 ` Jan Kara
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 6:41 ` Jan Kara
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 6:45 ` Jan Kara
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 6:46 ` Jan Kara [this message]
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-10-12 16:18 ` Theodore Ts'o
2017-09-29 17:37 ` [PATCH v2 0/5] ext4: DAX data corruption fixes 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@suse.cz \
--cc=adilger.kernel@dilger.ca \
--cc=dan.j.williams@intel.com \
--cc=david@fromorbit.com \
--cc=hch@lst.de \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=ross.zwisler@linux.intel.com \
--cc=tytso@mit.edu \
/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
Powered by JetHome