[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ4uxj4AvR851vZ7d_QZm1Grg2aa0hefP0-bywRXamHFXyP5A@mail.gmail.com>
Date: Thu, 14 Aug 2025 14:19:18 +0200
From: Amir Goldstein <amir73il@...il.com>
To: André Almeida <andrealmeid@...lia.com>
Cc: Miklos Szeredi <miklos@...redi.hu>, Theodore Tso <tytso@....edu>,
Gabriel Krisman Bertazi <krisman@...nel.org>, 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 v4 4/9] fs: Create sb_same_encoding() helper
On Thu, Aug 14, 2025 at 12:37 AM André Almeida <andrealmeid@...lia.com> wrote:
>
> For cases where a file lookup can look in different filesystems (like in
> overlayfs), both super blocks must have the same encoding and the same
> flags. To help with that, create a sb_same_encoding() function.
>
> Reviewed-by: Amir Goldstein <amir73il@...il.com>
> Signed-off-by: André Almeida <andrealmeid@...lia.com>
please reorder vfs patches before ovl patches
> Changes from v3:
> - Improve wording
>
> Changes from v2:
> - Simplify the code. Instead of `if (cond) return true`, just do `return
> cond`;
> ---
> include/linux/fs.h | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 20102d81e18a59d5daaed06855d1f168979b4fa7..64d24e89bc5593915158b40f0442e6d8ef3d968d 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -3753,6 +3753,24 @@ static inline bool sb_has_encoding(const struct super_block *sb)
> return !!sb_encoding(sb);
> }
>
> +/*
> + * Compare if two super blocks have the same encoding and flags
> + */
> +static inline bool sb_same_encoding(const struct super_block *sb1,
> + const struct super_block *sb2)
> +{
> +#if IS_ENABLED(CONFIG_UNICODE)
> + if (sb1->s_encoding == sb2->s_encoding)
> + return true;
> +
> + return (sb1->s_encoding && sb2->s_encoding &&
> + (sb1->s_encoding->version == sb2->s_encoding->version) &&
> + (sb1->s_encoding_flags == sb2->s_encoding_flags));
> +#else
> + return true;
> +#endif
> +}
> +
> int may_setattr(struct mnt_idmap *idmap, struct inode *inode,
> unsigned int ia_valid);
> int setattr_prepare(struct mnt_idmap *, struct dentry *, struct iattr *);
>
> --
> 2.50.1
>
Powered by blists - more mailing lists