From: Christoph Hellwig <hch@lst.de>
To: Gabriel Krisman Bertazi <krisman@collabora.com>
Cc: linux-fsdevel@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
linux-ext4@vger.kernel.org,
Shreeya Patel <shreeya.patel@collabora.com>,
linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 01/11] ext4: simplify ext4_sb_read_encoding
Date: Wed, 15 Sep 2021 08:59:56 +0200 [thread overview]
Message-ID: <20210915070006.954653-2-hch@lst.de> (raw)
In-Reply-To: <20210915070006.954653-1-hch@lst.de>
Return the encoding table as the return value instead of as an argument,
and don't bother with the encoding flags as the caller can handle that
trivially.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Acked-by: Theodore Ts'o <tytso@mit.edu>
---
fs/ext4/super.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0775950ee84e3..7401a181878e5 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2017,24 +2017,17 @@ static const struct ext4_sb_encodings {
{EXT4_ENC_UTF8_12_1, "utf8", "12.1.0"},
};
-static int ext4_sb_read_encoding(const struct ext4_super_block *es,
- const struct ext4_sb_encodings **encoding,
- __u16 *flags)
+static const struct ext4_sb_encodings *
+ext4_sb_read_encoding(const struct ext4_super_block *es)
{
__u16 magic = le16_to_cpu(es->s_encoding);
int i;
for (i = 0; i < ARRAY_SIZE(ext4_sb_encoding_map); i++)
if (magic == ext4_sb_encoding_map[i].magic)
- break;
-
- if (i >= ARRAY_SIZE(ext4_sb_encoding_map))
- return -EINVAL;
+ return &ext4_sb_encoding_map[i];
- *encoding = &ext4_sb_encoding_map[i];
- *flags = le16_to_cpu(es->s_encoding_flags);
-
- return 0;
+ return NULL;
}
#endif
@@ -4155,10 +4148,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
if (ext4_has_feature_casefold(sb) && !sb->s_encoding) {
const struct ext4_sb_encodings *encoding_info;
struct unicode_map *encoding;
- __u16 encoding_flags;
+ __u16 encoding_flags = le16_to_cpu(es->s_encoding_flags);
- if (ext4_sb_read_encoding(es, &encoding_info,
- &encoding_flags)) {
+ encoding_info = ext4_sb_read_encoding(es);
+ if (!encoding_info) {
ext4_msg(sb, KERN_ERR,
"Encoding requested by superblock is unknown");
goto failed_mount;
--
2.30.2
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2021-09-15 7:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-15 6:59 [f2fs-dev] unicode cleanups, and split the data table into a separate module v2 Christoph Hellwig
2021-09-15 6:59 ` Christoph Hellwig [this message]
2021-09-15 6:59 ` [f2fs-dev] [PATCH 02/11] f2fs: simplify f2fs_sb_read_encoding Christoph Hellwig
2021-09-15 6:59 ` [f2fs-dev] [PATCH 03/11] unicode: remove the charset field from struct unicode_map Christoph Hellwig
2021-09-15 6:59 ` [f2fs-dev] [PATCH 04/11] unicode: mark the version field in struct unicode_map unsigned Christoph Hellwig
2021-09-15 7:00 ` [f2fs-dev] [PATCH 05/11] unicode: pass a UNICODE_AGE() tripple to utf8_load Christoph Hellwig
2021-09-15 7:00 ` [f2fs-dev] [PATCH 06/11] unicode: remove the unused utf8{, n}age{min, max} functions Christoph Hellwig
2021-09-15 7:00 ` [f2fs-dev] [PATCH 07/11] unicode: simplify utf8len Christoph Hellwig
2021-09-15 7:00 ` [f2fs-dev] [PATCH 08/11] unicode: move utf8cursor to utf8-selftest.c Christoph Hellwig
2021-09-15 7:00 ` [f2fs-dev] [PATCH 09/11] unicode: cache the normalization tables in struct unicode_map Christoph Hellwig
2021-09-15 7:00 ` [f2fs-dev] [PATCH 10/11] unicode: Add utf8-data module Christoph Hellwig
2021-10-12 11:25 ` Gabriel Krisman Bertazi
2021-10-12 12:49 ` Christoph Hellwig
2021-10-12 14:40 ` Gabriel Krisman Bertazi
2021-10-26 7:45 ` Christoph Hellwig
2021-10-26 13:56 ` Gabriel Krisman Bertazi
[not found] ` <20211027090208.70e88aab@canb.auug.org.au>
2021-10-28 2:00 ` [f2fs-dev] Track unicode tree in linux-next (was Re: [PATCH 10/11] unicode: Add utf8-data module) Gabriel Krisman Bertazi
2021-09-15 7:00 ` [f2fs-dev] [PATCH 11/11] unicode: only export internal symbols for the selftests Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2021-08-18 14:06 [f2fs-dev] unicode cleanups, and split the data table into a separate module Christoph Hellwig
2021-08-18 14:06 ` [f2fs-dev] [PATCH 01/11] ext4: simplify ext4_sb_read_encoding Christoph Hellwig
2021-08-23 14:51 ` Gabriel Krisman Bertazi
2021-09-08 20:53 ` Theodore Ts'o
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=20210915070006.954653-2-hch@lst.de \
--to=hch@lst.de \
--cc=krisman@collabora.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=shreeya.patel@collabora.com \
--cc=tytso@mit.edu \
/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).