mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fs: drop f_dentry
@ 2025-06-25  8:35 Sascha Hauer
  2025-06-27 14:41 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2025-06-25  8:35 UTC (permalink / raw)
  To: Barebox List

Defining f_dentry f_path.dentry is confusing as it suggests that a
struct member f_dentry is modified that doesn't exist and furthermore
it suggests that the f_path member is not modified. Drop the define
and replace its usage with f_path.dentry directly. While at it remove
the unused define f_vfsmnt.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/9p/vfs_file.c       | 2 +-
 fs/9p/vfs_inode_dotl.c | 2 +-
 fs/fs.c                | 4 ++--
 fs/legacy.c            | 2 +-
 fs/tftp.c              | 2 +-
 include/linux/fs.h     | 2 --
 6 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 2a44a77326..f99f7f294b 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -44,7 +44,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
 	fid = file->private_data;
 
 	if (!fid) {
-		fid = v9fs_fid_clone(file->f_dentry);
+		fid = v9fs_fid_clone(file->f_path.dentry);
 		if (IS_ERR(fid))
 			return PTR_ERR(fid);
 
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 2eb3cc9274..46fc858eae 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -319,7 +319,7 @@ v9fs_truncate(struct device *dev, struct file *f, loff_t size)
 		.ia_file = f,
 	};
 
-	return v9fs_vfs_setattr_dotl(f->f_dentry, &iattr);
+	return v9fs_vfs_setattr_dotl(f->f_path.dentry, &iattr);
 }
 
 /**
diff --git a/fs/fs.c b/fs/fs.c
index 3580bff6f5..3d7bea3a63 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -2243,7 +2243,7 @@ static const char *path_init(int dirfd, struct nameidata *nd, unsigned flags)
 			return ERR_CAST(f);
 
 		nd->path.mnt = &f->fsdev->vfsmount;
-		nd->path.dentry = f->f_dentry;
+		nd->path.dentry = f->f_path.dentry;
 		follow_mount(&nd->path);
 
 		if (*s == '/')
@@ -2590,7 +2590,7 @@ int openat(int dirfd, const char *pathname, int flags)
 		}
 
 		f->path = NULL;
-		f->f_dentry = NULL;
+		f->f_path.dentry = NULL;
 		f->f_inode = new_inode(&fsdev->sb);
 		f->f_inode->i_mode = S_IFREG;
 		f->f_flags = flags;
diff --git a/fs/legacy.c b/fs/legacy.c
index f0901ce0d4..5cb4ec22fe 100644
--- a/fs/legacy.c
+++ b/fs/legacy.c
@@ -89,7 +89,7 @@ static int legacy_open(struct inode *inode, struct file *file)
 	if (!legacy_ops->open)
 		return 0;
 
-	pathname = dpath(file->f_dentry, fsdev->vfsmount.mnt_root);
+	pathname = dpath(file->f_path.dentry, fsdev->vfsmount.mnt_root);
 	error = legacy_ops->open(&file->fsdev->dev, file, pathname);
 	free(pathname);
 
diff --git a/fs/tftp.c b/fs/tftp.c
index 5cb71431eb..01ebcbfc7a 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -769,7 +769,7 @@ static int tftp_open(struct inode *inode, struct file *file)
 {
 	struct file_priv *priv;
 
-	priv = tftp_do_open(&file->fsdev->dev, file->f_flags, file->f_dentry, false);
+	priv = tftp_do_open(&file->fsdev->dev, file->f_flags, file->f_path.dentry, false);
 	if (IS_ERR(priv))
 		return PTR_ERR(priv);
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 7ae52d476d..55e01d386d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -228,8 +228,6 @@ struct file {
 #define FILE_SIZE_STREAM	((loff_t) -1)
 #define f_size f_inode->i_size
 	struct inode		*f_inode;	/* cached value */
-#define f_dentry	f_path.dentry
-#define f_vfsmnt	f_path.mnt
 	const struct file_operations	*f_op;
 	unsigned int 		f_flags;
 	loff_t			f_pos;
-- 
2.39.5




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs: drop f_dentry
  2025-06-25  8:35 [PATCH] fs: drop f_dentry Sascha Hauer
@ 2025-06-27 14:41 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-06-27 14:41 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Wed, 25 Jun 2025 10:35:44 +0200, Sascha Hauer wrote:
> Defining f_dentry f_path.dentry is confusing as it suggests that a
> struct member f_dentry is modified that doesn't exist and furthermore
> it suggests that the f_path member is not modified. Drop the define
> and replace its usage with f_path.dentry directly. While at it remove
> the unused define f_vfsmnt.
> 
> 
> [...]

Applied, thanks!

[1/1] fs: drop f_dentry
      https://git.pengutronix.de/cgit/barebox/commit/?id=1fede4e51311 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-06-27 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-25  8:35 [PATCH] fs: drop f_dentry Sascha Hauer
2025-06-27 14:41 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox