[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200513113046.GE27709@quack2.suse.cz>
Date: Wed, 13 May 2020 13:30:46 +0200
From: Jan Kara <jack@...e.cz>
To: ira.weiny@...el.com
Cc: linux-ext4@...r.kernel.org,
Andreas Dilger <adilger.kernel@...ger.ca>,
"Theodore Y. Ts'o" <tytso@....edu>, Jan Kara <jack@...e.cz>,
Al Viro <viro@...iv.linux.org.uk>,
Dan Williams <dan.j.williams@...el.com>,
Dave Chinner <david@...morbit.com>,
Christoph Hellwig <hch@....de>, Jeff Moyer <jmoyer@...hat.com>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/9] fs/ext4: Update ext4_should_use_dax()
On Tue 12-05-20 22:43:20, ira.weiny@...el.com wrote:
> From: Ira Weiny <ira.weiny@...el.com>
>
> S_DAX should only be enabled when the underlying block device supports
> dax.
>
> Change ext4_should_use_dax() to check for device support prior to the
> over riding mount option.
>
> While we are at it change the function to ext4_should_enable_dax() as
> this better reflects the ask as well as matches xfs.
>
> Signed-off-by: Ira Weiny <ira.weiny@...el.com>
The patch looks good to me. You can add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
>
> ---
> Changes from RFC
> Change function name to 'should enable'
> Clean up bool conversion
> Reorder this for better bisect-ability
> ---
> fs/ext4/inode.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index a10ff12194db..d3a4c2ed7a1c 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4398,10 +4398,8 @@ 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)
> +static bool ext4_should_enable_dax(struct inode *inode)
> {
> - if (!test_opt(inode->i_sb, DAX_ALWAYS))
> - return false;
> if (!S_ISREG(inode->i_mode))
> return false;
> if (ext4_should_journal_data(inode))
> @@ -4412,7 +4410,13 @@ static bool ext4_should_use_dax(struct inode *inode)
> return false;
> if (ext4_test_inode_flag(inode, EXT4_INODE_VERITY))
> return false;
> - return true;
> + if (!bdev_dax_supported(inode->i_sb->s_bdev,
> + inode->i_sb->s_blocksize))
> + return false;
> + if (test_opt(inode->i_sb, DAX_ALWAYS))
> + return true;
> +
> + return false;
> }
>
> void ext4_set_inode_flags(struct inode *inode)
> @@ -4430,7 +4434,7 @@ void ext4_set_inode_flags(struct inode *inode)
> new_fl |= S_NOATIME;
> if (flags & EXT4_DIRSYNC_FL)
> new_fl |= S_DIRSYNC;
> - if (ext4_should_use_dax(inode))
> + if (ext4_should_enable_dax(inode))
> new_fl |= S_DAX;
> if (flags & EXT4_ENCRYPT_FL)
> new_fl |= S_ENCRYPTED;
> --
> 2.25.1
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists