Messages in this thread | | | Date | Wed, 20 May 2020 15:37:28 +0200 | From | Jan Kara <> | Subject | Re: [PATCH V3 4/8] fs/ext4: Update ext4_should_use_dax() |
| |
On Tue 19-05-20 22:57:49, ira.weiny@intel.com wrote: > From: Ira Weiny <ira.weiny@intel.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@suse.cz> > Signed-off-by: Ira Weiny <ira.weiny@intel.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@suse.com> SUSE Labs, CR
| |