dax: change bdev_dax_supported() to support boolean returns
The function return values are confusing with the way the function is named. We expect a true or false return value but it actually returns 0/-errno. This makes the code very confusing. Changing the return values to return a bool where if DAX is supported then return true and no DAX support returns false. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:

committato da
Darrick J. Wong

parent
ba23cba9b3
commit
80660f2025
@@ -1103,8 +1103,8 @@ xfs_ioctl_setattr_dax_invalidate(
|
||||
if (fa->fsx_xflags & FS_XFLAG_DAX) {
|
||||
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
|
||||
return -EINVAL;
|
||||
if (bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
|
||||
sb->s_blocksize) < 0)
|
||||
if (!bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
|
||||
sb->s_blocksize))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@@ -1701,17 +1701,17 @@ xfs_fs_fill_super(
|
||||
sb->s_flags |= SB_I_VERSION;
|
||||
|
||||
if (mp->m_flags & XFS_MOUNT_DAX) {
|
||||
int error2 = 0;
|
||||
bool rtdev_is_dax = false, datadev_is_dax;
|
||||
|
||||
xfs_warn(mp,
|
||||
"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
|
||||
|
||||
error = bdev_dax_supported(mp->m_ddev_targp->bt_bdev,
|
||||
sb->s_blocksize);
|
||||
datadev_is_dax = bdev_dax_supported(mp->m_ddev_targp->bt_bdev,
|
||||
sb->s_blocksize);
|
||||
if (mp->m_rtdev_targp)
|
||||
error2 = bdev_dax_supported(mp->m_rtdev_targp->bt_bdev,
|
||||
sb->s_blocksize);
|
||||
if (error && error2) {
|
||||
rtdev_is_dax = bdev_dax_supported(
|
||||
mp->m_rtdev_targp->bt_bdev, sb->s_blocksize);
|
||||
if (!rtdev_is_dax && !datadev_is_dax) {
|
||||
xfs_alert(mp,
|
||||
"DAX unsupported by block device. Turning off DAX.");
|
||||
mp->m_flags &= ~XFS_MOUNT_DAX;
|
||||
|
Fai riferimento in un nuovo problema
Block a user