Skip to contentSkip to conversation

xfs fixups for the fop_flags conversion

PATCH New Christoph Hellwig 3 participants 6 messages Apr 23, 2024 – Apr 24, 2024 XFS filesystem

lore
Share & tools
lore
#0 lore raw

Hi all,

this series against Christian's vfs.misc branch fixes up pointless harmless but pointless over-declaration of capabilities for XFS directories.

Christian: the first patch would make sense to just fold into the original fop_flags conversion if you're still rebasing the branch.

 xfs_file.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
#1 lore raw

PATCH 1/3 xfs: fix overly long line in the file_operations

Re-wrap the newly added fop_flags fields to not go over 80 characters.

---
 fs/xfs/xfs_file.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
fs/xfs/xfs_file.c +4 -4
index 147439ad358138..c6b6809c1ffebd 100644
@@ -1496,8 +1496,8 @@ const struct file_operations xfs_file_operations = {
 	.fallocate	= xfs_file_fallocate,
 	.fadvise	= xfs_file_fadvise,
 	.remap_file_range = xfs_file_remap_range,
-	.fop_flags	= FOP_MMAP_SYNC | FOP_BUFFER_RASYNC | FOP_BUFFER_WASYNC |
-			  FOP_DIO_PARALLEL_WRITE,
+	.fop_flags	= FOP_MMAP_SYNC | FOP_BUFFER_RASYNC |
+			  FOP_BUFFER_WASYNC | FOP_DIO_PARALLEL_WRITE,
 };
 
 const struct file_operations xfs_dir_file_operations = {
@@ -1510,6 +1510,6 @@ const struct file_operations xfs_dir_file_operations = {
 	.compat_ioctl	= xfs_file_compat_ioctl,
 #endif
 	.fsync		= xfs_dir_fsync,
-	.fop_flags	= FOP_MMAP_SYNC | FOP_BUFFER_RASYNC | FOP_BUFFER_WASYNC |
-			  FOP_DIO_PARALLEL_WRITE,
+	.fop_flags	= FOP_MMAP_SYNC | FOP_BUFFER_RASYNC |
+			  FOP_BUFFER_WASYNC | FOP_DIO_PARALLEL_WRITE,
 };
Signature · 1 line
2.39.2
#2 lore raw

PATCH 2/3 xfs: drop fop_flags for directories

In reply to Christoph Hellwig

Directories have non of the capabilities, so drop the flags. Note that the current state is harmless as no one actually checks for the flags either.

---
 fs/xfs/xfs_file.c | 2 --
 1 file changed, 2 deletions(-)
fs/xfs/xfs_file.c +0 -2
index c6b6809c1ffebd..4415d0f3bbc51b 100644
@@ -1510,6 +1510,4 @@ const struct file_operations xfs_dir_file_operations = {
 	.compat_ioctl	= xfs_file_compat_ioctl,
 #endif
 	.fsync		= xfs_dir_fsync,
-	.fop_flags	= FOP_MMAP_SYNC | FOP_BUFFER_RASYNC |
-			  FOP_BUFFER_WASYNC | FOP_DIO_PARALLEL_WRITE,
 };
Signature · 1 line
2.39.2
#3 lore raw

PATCH 3/3 xfs: don't call xfs_file_open from xfs_dir_open

In reply to Christoph Hellwig

Directories do not support direct I/O and thus no non-blocking direct I/O either. Open code the shutdown check and call to generic_file_open instead.

---
 fs/xfs/xfs_file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/xfs/xfs_file.c +3 -1
index 4415d0f3bbc51b..2ce302b4885f53 100644
@@ -1243,7 +1243,9 @@ xfs_dir_open(
 	unsigned int	mode;
 	int		error;
 
-	error = xfs_file_open(inode, file);
+	if (xfs_is_shutdown(ip->i_mount))
+		return -EIO;
+	error = generic_file_open(inode, file);
 	if (error)
 		return error;
 
Signature · 1 line
2.39.2
Reviewed-by
#4 lore raw
In reply to Christoph Hellwig
Quoted 8 lines · Christoph Hellwig

Hi all,

this series against Christian's vfs.misc branch fixes up pointless harmless but pointless over-declaration of capabilities for XFS directories.

Christian: the first patch would make sense to just fold into the original fop_flags conversion if you're still rebasing the branch.

All three patches look good to me,

--D

Quoted 3 lines
 xfs_file.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
#5 lore raw
In reply to Christoph Hellwig
Quoted 8 lines · Christoph Hellwig

this series against Christian's vfs.misc branch fixes up pointless harmless but pointless over-declaration of capabilities for XFS directories.

Christian: the first patch would make sense to just fold into the original fop_flags conversion if you're still rebasing the branch.

[...]

Thanks for the fixes! I didn't fold because it would rebase a lot of other stuff which I'd like to avoid. :/

---

Applied to the vfs.misc branch of the vfs/vfs.git tree. Patches in the vfs.misc branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc

[1/3] xfs: fix overly long line in the file_operations

      https://git.kernel.org/vfs/vfs/c/19e048641bc6
[2/3] xfs: drop fop_flags for directories
      https://git.kernel.org/vfs/vfs/c/f50805713a6e
[3/3] xfs: don't call xfs_file_open from xfs_dir_open
      https://git.kernel.org/vfs/vfs/c/652efdeca5b1