linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: "André Almeida" <andrealmeid@igalia.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>, Theodore Tso <tytso@mit.edu>,
	 Gabriel Krisman Bertazi <krisman@kernel.org>,
	linux-unionfs@vger.kernel.org,  linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	 Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	 kernel-dev@igalia.com
Subject: Re: [PATCH v4 4/9] fs: Create sb_same_encoding() helper
Date: Thu, 14 Aug 2025 14:19:18 +0200	[thread overview]
Message-ID: <CAOQ4uxj4AvR851vZ7d_QZm1Grg2aa0hefP0-bywRXamHFXyP5A@mail.gmail.com> (raw)
In-Reply-To: <20250813-tonyk-overlayfs-v4-4-357ccf2e12ad@igalia.com>

On Thu, Aug 14, 2025 at 12:37 AM André Almeida <andrealmeid@igalia.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@gmail.com>
> Signed-off-by: André Almeida <andrealmeid@igalia.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
>

  reply	other threads:[~2025-08-14 12:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13 22:36 [PATCH v4 0/9] ovl: Enable support for casefold filesystems André Almeida
2025-08-13 22:36 ` [PATCH v4 1/9] ovl: Support mounting case-insensitive enabled filesystems André Almeida
2025-08-14  8:35   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 2/9] fs: Create new helper sb_encoding() André Almeida
2025-08-14 12:18   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 3/9] ovl: Create ovl_casefold() to support casefolded strncmp() André Almeida
2025-08-14 12:53   ` Amir Goldstein
2025-08-14 13:02     ` André Almeida
2025-08-14 13:20       ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 4/9] fs: Create sb_same_encoding() helper André Almeida
2025-08-14 12:19   ` Amir Goldstein [this message]
2025-08-13 22:36 ` [PATCH v4 5/9] ovl: Ensure that all layers have the same encoding André Almeida
2025-08-14 12:56   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 6/9] ovl: Set case-insensitive dentry operations for ovl sb André Almeida
2025-08-14 12:57   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 7/9] ovl: Add S_CASEFOLD as part of the inode flag to be copied André Almeida
2025-08-14 13:00   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 8/9] ovl: Check for casefold consistency when creating new dentries André Almeida
2025-08-14 13:06   ` Amir Goldstein
2025-08-13 22:36 ` [PATCH v4 9/9] ovl: Allow case-insensitive lookup André Almeida
2025-08-14  8:44   ` Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOQ4uxj4AvR851vZ7d_QZm1Grg2aa0hefP0-bywRXamHFXyP5A@mail.gmail.com \
    --to=amir73il@gmail.com \
    --cc=andrealmeid@igalia.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=kernel-dev@igalia.com \
    --cc=krisman@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).