[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ4uxgF8zuEbzWerj+Gz1BhJCVtGNmLE6gYTmvEw-vv0yEmYQ@mail.gmail.com>
Date: Mon, 25 Aug 2025 17:28:23 +0200
From: Amir Goldstein <amir73il@...il.com>
To: Gabriel Krisman Bertazi <krisman@...e.de>
Cc: André Almeida <andrealmeid@...lia.com>,
Miklos Szeredi <miklos@...redi.hu>, Theodore Tso <tytso@....edu>, linux-unionfs@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
kernel-dev@...lia.com
Subject: Re: [PATCH v6 1/9] fs: Create sb_encoding() helper
On Mon, Aug 25, 2025 at 2:38 PM Gabriel Krisman Bertazi <krisman@...e.de> wrote:
>
> André Almeida <andrealmeid@...lia.com> writes:
>
> > Filesystems that need to deal with the super block encoding need to use
> > a if IS_ENABLED(CONFIG_UNICODE) around it because this struct member is
> > not declared otherwise. In order to move this if/endif guards outside of
> > the filesytem code and make it simpler, create a new function that
> > returns the s_encoding member of struct super_block if Unicode is
> > enabled, and return NULL otherwise.
> >
> > Suggested-by: Amir Goldstein <amir73il@...il.com>
> > Reviewed-by: Amir Goldstein <amir73il@...il.com>
> > Signed-off-by: André Almeida <andrealmeid@...lia.com>
> > ---
> > include/linux/fs.h | 11 ++++++++---
> > 1 file changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index e1d4fef5c181d291a7c685e5897b2c018df439ae..a4d353a871b094b562a87ddcffe8336a26c5a3e2 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -3733,15 +3733,20 @@ static inline bool generic_ci_validate_strict_name(struct inode *dir, struct qst
> > }
> > #endif
> >
> > -static inline bool sb_has_encoding(const struct super_block *sb)
> > +static inline struct unicode_map *sb_encoding(const struct super_block *sb)
> > {
> > #if IS_ENABLED(CONFIG_UNICODE)
> > - return !!sb->s_encoding;
> > + return sb->s_encoding;
> > #else
> > - return false;
> > + return NULL;
> > #endif
> > }
> >
> > +static inline bool sb_has_encoding(const struct super_block *sb)
> > +{
> > + return !!sb_encoding(sb);
> > +}
> > +
>
> FWIW, sb_has_encoding is completely superfluous now. It is also only
> used by overlayfs itself, so it should be easy to drop in favor of your
> new helper in the following patches. It even has a smaller function
> name :)
Heh. ok maybe we should.
I'll wait for Christian to decide how he would like to funnel those helpers
and maybe he has an opinion.
Thanks,
Amir.
Powered by blists - more mailing lists