[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200520133728.GD30597@quack2.suse.cz>
Date: Wed, 20 May 2020 15:37:28 +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>,
Eric Biggers <ebiggers@...nel.org>,
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 V3 4/8] fs/ext4: Update ext4_should_use_dax()
On Tue 19-05-20 22:57:49, 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.
>
> Reviewed-by: Jan Kara <jack@...e.cz>
> Signed-off-by: Ira Weiny <ira.weiny@...el.com>
...
> @@ -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;
> }
Now that I think about it - shouldn't we rather cache the result of
bdev_dax_supported() in sb on mount and then just check the flag here?
Because bdev_dax_supported() isn't exactly cheap (it does a lot of checks
and mappings, tries to read from the pmem, ...).
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists