* [PATCH] fs: consolidate duplicate dt_type helpers
@ 2023-03-30 10:41 Jeff Layton
2023-03-30 10:48 ` Greg Kroah-Hartman
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Jeff Layton @ 2023-03-30 10:41 UTC (permalink / raw)
To: Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Joel Becker, Christoph Hellwig, Greg Kroah-Hartman, Tejun Heo,
Alexander Viro, Christian Brauner
Cc: v9fs-developer, Chuck Lever, Phillip Potter, linux-kernel, linux-fsdevel
There are three copies of the same dt_type helper sprinkled around the
tree. Convert them to use the common fs_umode_to_dtype function instead,
which has the added advantage of properly returning DT_UNKNOWN when
given a mode that contains an unrecognized type.
Cc: Chuck Lever <chuck.lever@oracle.com>
Cc: Phillip Potter <phil@philpotter.co.uk>
Suggested-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/configfs/dir.c | 9 ++-------
fs/kernfs/dir.c | 8 +-------
fs/libfs.c | 9 ++-------
3 files changed, 5 insertions(+), 21 deletions(-)
v2: consolidate S_DT helper as well
v3: switch existing dt_type helpers to use fs_umode_to_dtype
drop v9fs hunks since they're no longer needed
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 4afcbbe63e68..18677cd4e62f 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -1599,12 +1599,6 @@ static int configfs_dir_close(struct inode *inode, struct file *file)
return 0;
}
-/* Relationship between s_mode and the DT_xxx types */
-static inline unsigned char dt_type(struct configfs_dirent *sd)
-{
- return (sd->s_mode >> 12) & 15;
-}
-
static int configfs_readdir(struct file *file, struct dir_context *ctx)
{
struct dentry *dentry = file->f_path.dentry;
@@ -1654,7 +1648,8 @@ static int configfs_readdir(struct file *file, struct dir_context *ctx)
name = configfs_get_name(next);
len = strlen(name);
- if (!dir_emit(ctx, name, len, ino, dt_type(next)))
+ if (!dir_emit(ctx, name, len, ino,
+ fs_umode_to_dtype(next->s_mode)))
return 0;
spin_lock(&configfs_dirent_lock);
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index ef00b5fe8cee..90de0e498371 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -1748,12 +1748,6 @@ int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
return error;
}
-/* Relationship between mode and the DT_xxx types */
-static inline unsigned char dt_type(struct kernfs_node *kn)
-{
- return (kn->mode >> 12) & 15;
-}
-
static int kernfs_dir_fop_release(struct inode *inode, struct file *filp)
{
kernfs_put(filp->private_data);
@@ -1831,7 +1825,7 @@ static int kernfs_fop_readdir(struct file *file, struct dir_context *ctx)
pos;
pos = kernfs_dir_next_pos(ns, parent, ctx->pos, pos)) {
const char *name = pos->name;
- unsigned int type = dt_type(pos);
+ unsigned int type = fs_umode_to_dtype(pos->mode);
int len = strlen(name);
ino_t ino = kernfs_ino(pos);
diff --git a/fs/libfs.c b/fs/libfs.c
index 4eda519c3002..89cf614a3271 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -174,12 +174,6 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence)
}
EXPORT_SYMBOL(dcache_dir_lseek);
-/* Relationship between i_mode and the DT_xxx types */
-static inline unsigned char dt_type(struct inode *inode)
-{
- return (inode->i_mode >> 12) & 15;
-}
-
/*
* Directory is locked and all positive dentries in it are safe, since
* for ramfs-type trees they can't go away without unlink() or rmdir(),
@@ -206,7 +200,8 @@ int dcache_readdir(struct file *file, struct dir_context *ctx)
while ((next = scan_positives(cursor, p, 1, next)) != NULL) {
if (!dir_emit(ctx, next->d_name.name, next->d_name.len,
- d_inode(next)->i_ino, dt_type(d_inode(next))))
+ d_inode(next)->i_ino,
+ fs_umode_to_dtype(d_inode(next)->i_mode)))
break;
ctx->pos++;
p = &next->d_child;
--
2.39.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] fs: consolidate duplicate dt_type helpers
2023-03-30 10:41 [PATCH] fs: consolidate duplicate dt_type helpers Jeff Layton
@ 2023-03-30 10:48 ` Greg Kroah-Hartman
2023-03-30 11:15 ` Jeff Layton
2023-03-30 12:41 ` [PATCH v3] " Christian Brauner
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2023-03-30 10:48 UTC (permalink / raw)
To: Jeff Layton
Cc: Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Joel Becker, Christoph Hellwig, Tejun Heo, Alexander Viro,
Christian Brauner, v9fs-developer, Chuck Lever, Phillip Potter,
linux-kernel, linux-fsdevel
On Thu, Mar 30, 2023 at 06:41:43AM -0400, Jeff Layton wrote:
> There are three copies of the same dt_type helper sprinkled around the
> tree. Convert them to use the common fs_umode_to_dtype function instead,
> which has the added advantage of properly returning DT_UNKNOWN when
> given a mode that contains an unrecognized type.
>
> Cc: Chuck Lever <chuck.lever@oracle.com>
> Cc: Phillip Potter <phil@philpotter.co.uk>
> Suggested-by: Christian Brauner <brauner@kernel.org>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/configfs/dir.c | 9 ++-------
> fs/kernfs/dir.c | 8 +-------
> fs/libfs.c | 9 ++-------
> 3 files changed, 5 insertions(+), 21 deletions(-)
>
> v2: consolidate S_DT helper as well
> v3: switch existing dt_type helpers to use fs_umode_to_dtype
> drop v9fs hunks since they're no longer needed
You forgot the "v3" in the subject line :(
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fs: consolidate duplicate dt_type helpers
2023-03-30 10:48 ` Greg Kroah-Hartman
@ 2023-03-30 11:15 ` Jeff Layton
2023-03-30 11:50 ` Christian Brauner
0 siblings, 1 reply; 8+ messages in thread
From: Jeff Layton @ 2023-03-30 11:15 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Joel Becker, Christoph Hellwig, Tejun Heo, Alexander Viro,
Christian Brauner, v9fs-developer, Chuck Lever, Phillip Potter,
linux-kernel, linux-fsdevel
On Thu, 2023-03-30 at 12:48 +0200, Greg Kroah-Hartman wrote:
> On Thu, Mar 30, 2023 at 06:41:43AM -0400, Jeff Layton wrote:
> > There are three copies of the same dt_type helper sprinkled around the
> > tree. Convert them to use the common fs_umode_to_dtype function instead,
> > which has the added advantage of properly returning DT_UNKNOWN when
> > given a mode that contains an unrecognized type.
> >
> > Cc: Chuck Lever <chuck.lever@oracle.com>
> > Cc: Phillip Potter <phil@philpotter.co.uk>
> > Suggested-by: Christian Brauner <brauner@kernel.org>
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
> > fs/configfs/dir.c | 9 ++-------
> > fs/kernfs/dir.c | 8 +-------
> > fs/libfs.c | 9 ++-------
> > 3 files changed, 5 insertions(+), 21 deletions(-)
> >
> > v2: consolidate S_DT helper as well
> > v3: switch existing dt_type helpers to use fs_umode_to_dtype
> > drop v9fs hunks since they're no longer needed
>
> You forgot the "v3" in the subject line :(
>
Yeah, I noticed, sorry. It's the attention to detail that makes me such
a successful kernel developer! ;)
--
Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fs: consolidate duplicate dt_type helpers
2023-03-30 11:15 ` Jeff Layton
@ 2023-03-30 11:50 ` Christian Brauner
0 siblings, 0 replies; 8+ messages in thread
From: Christian Brauner @ 2023-03-30 11:50 UTC (permalink / raw)
To: Jeff Layton
Cc: Greg Kroah-Hartman, Eric Van Hensbergen, Latchesar Ionkov,
Dominique Martinet, Joel Becker, Christoph Hellwig, Tejun Heo,
Alexander Viro, v9fs-developer, Chuck Lever, Phillip Potter,
linux-kernel, linux-fsdevel
On Thu, Mar 30, 2023 at 07:15:36AM -0400, Jeff Layton wrote:
> On Thu, 2023-03-30 at 12:48 +0200, Greg Kroah-Hartman wrote:
> > On Thu, Mar 30, 2023 at 06:41:43AM -0400, Jeff Layton wrote:
> > > There are three copies of the same dt_type helper sprinkled around the
> > > tree. Convert them to use the common fs_umode_to_dtype function instead,
> > > which has the added advantage of properly returning DT_UNKNOWN when
> > > given a mode that contains an unrecognized type.
> > >
> > > Cc: Chuck Lever <chuck.lever@oracle.com>
> > > Cc: Phillip Potter <phil@philpotter.co.uk>
> > > Suggested-by: Christian Brauner <brauner@kernel.org>
> > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > > ---
> > > fs/configfs/dir.c | 9 ++-------
> > > fs/kernfs/dir.c | 8 +-------
> > > fs/libfs.c | 9 ++-------
> > > 3 files changed, 5 insertions(+), 21 deletions(-)
> > >
> > > v2: consolidate S_DT helper as well
> > > v3: switch existing dt_type helpers to use fs_umode_to_dtype
> > > drop v9fs hunks since they're no longer needed
> >
> > You forgot the "v3" in the subject line :(
> >
>
> Yeah, I noticed, sorry. It's the attention to detail that makes me such
> a successful kernel developer! ;)
/me hides from his own syzbot "good morning" message from earlier today...
But honestly, I don't think it's worth resending just to add v3.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] fs: consolidate duplicate dt_type helpers
2023-03-30 10:41 [PATCH] fs: consolidate duplicate dt_type helpers Jeff Layton
2023-03-30 10:48 ` Greg Kroah-Hartman
@ 2023-03-30 12:41 ` Christian Brauner
2023-03-31 8:16 ` [PATCH] " Christian Brauner
2023-04-03 7:28 ` Christian Brauner
3 siblings, 0 replies; 8+ messages in thread
From: Christian Brauner @ 2023-03-30 12:41 UTC (permalink / raw)
To: Jeff Layton
Cc: Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Joel Becker, Christoph Hellwig, Greg Kroah-Hartman, Tejun Heo,
Alexander Viro, v9fs-developer, Chuck Lever, Phillip Potter,
linux-kernel, linux-fsdevel
On Thu, Mar 30, 2023 at 06:41:43AM -0400, Jeff Layton wrote:
> There are three copies of the same dt_type helper sprinkled around the
> tree. Convert them to use the common fs_umode_to_dtype function instead,
> which has the added advantage of properly returning DT_UNKNOWN when
> given a mode that contains an unrecognized type.
>
> Cc: Chuck Lever <chuck.lever@oracle.com>
> Cc: Phillip Potter <phil@philpotter.co.uk>
> Suggested-by: Christian Brauner <brauner@kernel.org>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
Looks good to me,
Reviewed-by: Christian Brauner <brauner@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fs: consolidate duplicate dt_type helpers
2023-03-30 10:41 [PATCH] fs: consolidate duplicate dt_type helpers Jeff Layton
2023-03-30 10:48 ` Greg Kroah-Hartman
2023-03-30 12:41 ` [PATCH v3] " Christian Brauner
@ 2023-03-31 8:16 ` Christian Brauner
2023-03-31 9:42 ` Greg Kroah-Hartman
2023-04-03 7:28 ` Christian Brauner
3 siblings, 1 reply; 8+ messages in thread
From: Christian Brauner @ 2023-03-31 8:16 UTC (permalink / raw)
To: Greg Kroah-Hartman, Christoph Hellwig
Cc: Eric Van Hensbergen, Latchesar Ionkov, Dominique Martinet,
Joel Becker, Christoph Hellwig, Greg Kroah-Hartman, Tejun Heo,
Alexander Viro, v9fs-developer, Chuck Lever, Phillip Potter,
linux-kernel, linux-fsdevel
On Thu, Mar 30, 2023 at 06:41:43AM -0400, Jeff Layton wrote:
> There are three copies of the same dt_type helper sprinkled around the
> tree. Convert them to use the common fs_umode_to_dtype function instead,
> which has the added advantage of properly returning DT_UNKNOWN when
> given a mode that contains an unrecognized type.
>
> Cc: Chuck Lever <chuck.lever@oracle.com>
> Cc: Phillip Potter <phil@philpotter.co.uk>
> Suggested-by: Christian Brauner <brauner@kernel.org>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
Greg, Christoph, if you have a minute could you please take a look
again and re-add your acks?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fs: consolidate duplicate dt_type helpers
2023-03-31 8:16 ` [PATCH] " Christian Brauner
@ 2023-03-31 9:42 ` Greg Kroah-Hartman
0 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2023-03-31 9:42 UTC (permalink / raw)
To: Christian Brauner
Cc: Christoph Hellwig, Eric Van Hensbergen, Latchesar Ionkov,
Dominique Martinet, Joel Becker, Tejun Heo, Alexander Viro,
v9fs-developer, Chuck Lever, Phillip Potter, linux-kernel,
linux-fsdevel
On Fri, Mar 31, 2023 at 10:16:20AM +0200, Christian Brauner wrote:
> On Thu, Mar 30, 2023 at 06:41:43AM -0400, Jeff Layton wrote:
> > There are three copies of the same dt_type helper sprinkled around the
> > tree. Convert them to use the common fs_umode_to_dtype function instead,
> > which has the added advantage of properly returning DT_UNKNOWN when
> > given a mode that contains an unrecognized type.
> >
> > Cc: Chuck Lever <chuck.lever@oracle.com>
> > Cc: Phillip Potter <phil@philpotter.co.uk>
> > Suggested-by: Christian Brauner <brauner@kernel.org>
> > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > ---
>
> Greg, Christoph, if you have a minute could you please take a look
> again and re-add your acks?
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] fs: consolidate duplicate dt_type helpers
2023-03-30 10:41 [PATCH] fs: consolidate duplicate dt_type helpers Jeff Layton
` (2 preceding siblings ...)
2023-03-31 8:16 ` [PATCH] " Christian Brauner
@ 2023-04-03 7:28 ` Christian Brauner
3 siblings, 0 replies; 8+ messages in thread
From: Christian Brauner @ 2023-04-03 7:28 UTC (permalink / raw)
To: Jeff Layton
Cc: Christian Brauner, v9fs-developer, Chuck Lever, Phillip Potter,
linux-kernel, linux-fsdevel, Eric Van Hensbergen,
Latchesar Ionkov, Dominique Martinet, Joel Becker,
Christoph Hellwig, Greg Kroah-Hartman, Tejun Heo, Alexander Viro
On Thu, 30 Mar 2023 06:41:43 -0400, Jeff Layton wrote:
> There are three copies of the same dt_type helper sprinkled around the
> tree. Convert them to use the common fs_umode_to_dtype function instead,
> which has the added advantage of properly returning DT_UNKNOWN when
> given a mode that contains an unrecognized type.
>
>
I've picked this up now,
tree: git://git.kernel.org/pub/scm/linux/kernel/git/vfs/idmapping.git
branch: fs.misc
[1/1] fs: consolidate duplicate dt_type helpers
commit: 364595a6851bf64e1c38224ae68f5dd6651906d1
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-04-03 7:29 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30 10:41 [PATCH] fs: consolidate duplicate dt_type helpers Jeff Layton
2023-03-30 10:48 ` Greg Kroah-Hartman
2023-03-30 11:15 ` Jeff Layton
2023-03-30 11:50 ` Christian Brauner
2023-03-30 12:41 ` [PATCH v3] " Christian Brauner
2023-03-31 8:16 ` [PATCH] " Christian Brauner
2023-03-31 9:42 ` Greg Kroah-Hartman
2023-04-03 7:28 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).