Skip to contentSkip to conversation

fs/stat: set attributes_mask for STATX_ATTR_DAX

PATCH In review XiaoLi Feng 2 participants 3 messages Nov 25, 2020 VFS

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fs/stat: set attributes_mask for STATX_ATTR_DAX

From: Xiaoli Feng <[email protected]>

keep attributes and attributes_mask are consistent for STATX_ATTR_DAX.
---
Hi,
Please help to review this patch. I send this patch because xfstests generic/532 is failed for dax test.

 fs/stat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/stat.c +3 -1
index dacecdda2e79..4619b3fc9694 100644
@@ -80,8 +80,10 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
 	if (IS_AUTOMOUNT(inode))
 		stat->attributes |= STATX_ATTR_AUTOMOUNT;
 
-	if (IS_DAX(inode))
+	if (IS_DAX(inode)) {
 		stat->attributes |= STATX_ATTR_DAX;
+		stat->attributes_mask |= STATX_ATTR_DAX;
+	}
 
 	if (inode->i_op->getattr)
 		return inode->i_op->getattr(path, stat, request_mask,
Signature · 1 line
2.18.1
#1 lore raw
Quoted 17 lines · XiaoLi Feng

From: Xiaoli Feng <[email protected]>

keep attributes and attributes_mask are consistent for STATX_ATTR_DAX.
---
Hi,
Please help to review this patch. I send this patch because xfstests generic/532 is failed for dax test.

 fs/stat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/stat.c +0 -0
index dacecdda2e79..4619b3fc9694 100644

fs/stat.c int vfs_getattr_nosec(const struct path *path, struct kstat *stat, · line 85

Quoted 7 lines
fs/stat.c +2 -1
@@ -80,8 +80,10 @@ int vfs_getattr_nosec(const struct path *path, struct kstat *stat,
 	if (IS_AUTOMOUNT(inode))
 		stat->attributes |= STATX_ATTR_AUTOMOUNT;
 
-	if (IS_DAX(inode))
+	if (IS_DAX(inode)) {
 		stat->attributes |= STATX_ATTR_DAX;
+		stat->attributes_mask |= STATX_ATTR_DAX;

From the discussion of the V1 patch:

Doesn't it make more sense for /filesystems/ driver to set the attr_mask bit when the filesystem is capable of DAX? Surely we should be able to tell applications that DAX is a possibility for the fs even if it's not enabled on this specific file.

IOWs the place to make this change is in the ext2/ext4/fuse/xfs code, not in the generic vfs.

--D

Quoted 7 lines
fs/stat.c +1 -0
+	}
 
 	if (inode->i_op->getattr)
 		return inode->i_op->getattr(path, stat, request_mask,
Signature · 1 line
2.18.1
#2 lore raw

Hi,

----- Original Message -----

Quoted 36 lines

From: "Darrick J. Wong" <[email protected]>
To: "XiaoLi Feng" <[email protected]>
Cc: [email protected], [email protected], "Xiaoli Feng" <[email protected]>
Sent: Wednesday, November 25, 2020 10:46:44 AM
Subject: Re: [PATCH v2] fs/stat: set attributes_mask for STATX_ATTR_DAX

Quoted 18 lines · XiaoLi Feng

From: Xiaoli Feng <[email protected]>

keep attributes and attributes_mask are consistent for STATX_ATTR_DAX.
---
Hi,
Please help to review this patch. I send this patch because xfstests generic/532
is failed for dax test.

 fs/stat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/stat.c +0 -0
index dacecdda2e79..4619b3fc9694 100644

fs/stat.c int vfs_getattr_nosec(const struct path *path, struct · line 86

Quoted 8 lines
fs/stat.c +2 -1
@@ -80,8 +80,10 @@ int vfs_getattr_nosec(const struct path *path, struct
 kstat *stat,
 	if (IS_AUTOMOUNT(inode))
 		stat->attributes |= STATX_ATTR_AUTOMOUNT;
 
-	if (IS_DAX(inode))
+	if (IS_DAX(inode)) {
 		stat->attributes |= STATX_ATTR_DAX;
+		stat->attributes_mask |= STATX_ATTR_DAX;

From the discussion of the V1 patch:

Quoted 7 lines

Doesn't it make more sense for /filesystems/ driver to set the attr_mask bit when the filesystem is capable of DAX? Surely we should be able to tell applications that DAX is a possibility for the fs even if it's not enabled on this specific file.

IOWs the place to make this change is in the ext2/ext4/fuse/xfs code, not in the generic vfs.

Got it. Thanks for review.

Quoted 12 lines

--D

Quoted 7 lines
fs/stat.c +1 -0
+	}
 
 	if (inode->i_op->getattr)

return inode->i_op->getattr(path, stat, request_mask,
--
2.18.1