Skip to contentSkip to conversation

Ext4 case-insensitive support

PATCH In review Gabriel Krisman Bertazi 2 participants 11 messages Apr 13, 2019 – Apr 25, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v7 cover Ext4 case-insensitive support

Hi Ted,

This is the v7 of the case-insensitive support. It includes the design changes we discussed, unicode 12.0 support, and the Linus' request about the way we store the utf8data.h file.

* We no longer generate utf8data.h during build time. Instead, it is added to the tree with instructions on how to generate it.

* Integrate your modifications to README.utf8data.

* Directories without the Casefold inode attribute are no longer normalized.

* Update to Unicode 12.0

* Fixes 0day/sparse issues reported against the last version.

* Remove sign-off from Olaf Weber on patch 01 modified by me. I was thinking about this since the last series. I cannot assume Olaf's signoff on patch 01/10, since it changed too much, so make sure he keeps the credit and copyright for the script, but drop his signoff on the certificate of origin.

* i didn't commented ou t the normalization bits because it is being tested by utf8-selftest, so I'm not sure if we should remove everything already. Also, utf8data.h will not get much smaller without it.

I suspect the patches adding/modifying utf8data.h might bounce in the mailing list. If that is the case, you can find the series at:

https://gitlab.collabora.com/krisman/linux.git -b ext4-ci-directory-no-nls_v7

You can also find the e2fsprogs latest fixes, that I am proposing on a different thread, and which is required to support the current patchset at:

https://gitlab.collabora.com/krisman/e2fsprogs.git -b casefold-feature

As usual, I am testing this with xfstests:

https://gitlab.collabora.com/krisman/xfstests.git -b casefold-test

(generic/484 and generic/485 in that repository)

Please, let me know what you think.

Gabriel Krisman Bertazi (8):
unicode: Introduce UTF-8 character database
unicode: Implement higher level API for string handling
unicode: Introduce test module for normalized utf8 implementation
unicode: Update unicode database unicode version 12.0.0
MAINTAINERS: Add Unicode subsystem entry
ext4: Include encoding information in the superblock
ext4: Support case-insensitive file name lookups
docs: ext4.rst: Document case-insensitive directories

Olaf Weber (2):
unicode: Introduce code for UTF-8 normalization
unicode: reduce the size of utf8data[]

 Documentation/admin-guide/ext4.rst |   38 +
 MAINTAINERS                        |    6 +
 fs/Kconfig                         |    1 +
 fs/Makefile                        |    1 +
 fs/ext4/dir.c                      |   48 +
 fs/ext4/ext4.h                     |   42 +-
 fs/ext4/hash.c                     |   34 +-
 fs/ext4/ialloc.c                   |    2 +-
 fs/ext4/inline.c                   |    2 +-
 fs/ext4/inode.c                    |    4 +-
 fs/ext4/ioctl.c                    |   18 +
 fs/ext4/namei.c                    |  107 +-
 fs/ext4/super.c                    |   91 +
 fs/unicode/Kconfig                 |   13 +
 fs/unicode/Makefile                |   19 +
 fs/unicode/README.utf8data         |   57 +
 fs/unicode/utf8-core.c             |  187 ++
 fs/unicode/utf8-norm.c             |  799 ++++++
 fs/unicode/utf8-selftest.c         |  320 +++
 fs/unicode/utf8data.h              | 4106 ++++++++++++++++++++++++++++
 fs/unicode/utf8n.h                 |  117 +
 include/linux/fs.h                 |    2 +
 include/linux/unicode.h            |   30 +
 scripts/Makefile                   |    1 +
 scripts/mkutf8data.c               | 3418 +++++++++++++++++++++++
 25 files changed, 9441 insertions(+), 22 deletions(-)
 create mode 100644 fs/unicode/Kconfig
 create mode 100644 fs/unicode/Makefile
 create mode 100644 fs/unicode/README.utf8data
 create mode 100644 fs/unicode/utf8-core.c
 create mode 100644 fs/unicode/utf8-norm.c
 create mode 100644 fs/unicode/utf8-selftest.c
 create mode 100644 fs/unicode/utf8data.h
 create mode 100644 fs/unicode/utf8n.h
 create mode 100644 include/linux/unicode.h
 create mode 100644 scripts/mkutf8data.c
Signature · 1 line
2.20.1
#1 lore raw

PATCH v7 2/10 unicode: Introduce code for UTF-8 normalization

From: Olaf Weber <[email protected]>

Supporting functions for UTF-8 normalization are in utf8norm.c with the header utf8norm.h. Two normalization forms are supported: nfdi and nfdicf.

nfdi:
- Apply unicode normalization form NFD.
- Remove any Default_Ignorable_Code_Point.

nfdicf:
- Apply unicode normalization form NFD.
- Remove any Default_Ignorable_Code_Point.
- Apply a full casefold (C + F).

For the purposes of the code, a string is valid UTF-8 if:

- The values encoded are 0x1..0x10FFFF.
- The surrogate codepoints 0xD800..0xDFFFF are not encoded.
- The shortest possible encoding is used for all values.

The supporting functions work on null-terminated strings (utf8 prefix) and on length-limited strings (utf8n prefix).

From the original SGI patch and for conformity with coding standards, the utf8data_t typedef was dropped, since it was just masking the struct keyword. On other occasions, namely utf8leaf_t and utf8trie_t, I decided to keep it, since they are simple pointers to memory buffers, and using uchars here wouldn't provide any more meaningful information.

From the original submission, we also converted from the compatibility form to canonical.

Changes since v6:
- Fix potential null dereference (0day)

Changes since v4:
- Convert to canonical decomposition form.

Changes since RFC v1:
- utf8_version_is_supported receives maj, min and rev as separate arguments. (Olaf Weber)

[Rebase to Mainline]
[Fix up checkpatch.pl warnings]
[Drop typedefs]
[move out of libxfs]
[Convert from NFKD to NFD]
---
 fs/unicode/Makefile    |   2 +
 fs/unicode/utf8-norm.c | 642 +++++++++++++++++++++++++++++++++++++++++
 fs/unicode/utf8n.h     | 112 +++++++
 3 files changed, 756 insertions(+)
 create mode 100644 fs/unicode/utf8-norm.c
 create mode 100644 fs/unicode/utf8n.h
fs/unicode/Makefile +2 -0
index 764f8e5da4bb..16d43d180416 100644
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
+obj-$(CONFIG_UNICODE) += utf8-norm.o
+
 # This rule is not invoked during the kernel compilation.  It is used to
 # regenerate the utf8data.h header file.
 utf8data.h.new: *.txt $(objdir)/scripts/mkutf8data
fs/unicode/utf8-norm.c new file +642 -0

642 lines not on this page · raw message

fs/unicode/utf8n.h new file +112 -0

112 lines not on this page · raw message

Signature · 1 line
2.20.1
#2 lore raw

PATCH v7 4/10 unicode: Implement higher level API for string handling

In reply to Gabriel Krisman Bertazi

From: Gabriel Krisman Bertazi <[email protected]>

This patch integrates the utf8n patches with some higher level API to perform UTF-8 string comparison, normalization and casefolding operations. Implemented is a variation of NFD, and casefold is performed by doing full casefold on top of NFD. These algorithms are based on the core implemented by Olaf Weber from SGI.

Changes since v6:
- Fix sparse warnings (0-day)

Changes since v4:
- integrate in fs/unicode

Changes since RFC v1:
- Change error return code from EIO to EINVAL. (Olaf Weber)
- Fix issues with strncmp/strcmp. (Olaf Weber)
- Remove stack buffer in normalization/casefold. (Olaf Weber)
- Include length parameter for second string on comparison functions.
- Change length type to size_t.

---
 fs/unicode/Makefile     |   4 +-
 fs/unicode/utf8-core.c  | 187 ++++++++++++++++++++++++++++++++++++++++
 fs/unicode/utf8-norm.c  |   6 ++
 fs/unicode/utf8n.h      |   1 +
 include/linux/unicode.h |  30 +++++++
 5 files changed, 227 insertions(+), 1 deletion(-)
 create mode 100644 fs/unicode/utf8-core.c
 create mode 100644 include/linux/unicode.h
fs/unicode/Makefile +3 -1
index 16d43d180416..bfb0360687df 100644
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
-obj-$(CONFIG_UNICODE) += utf8-norm.o
+obj-$(CONFIG_UNICODE) += unicode.o
+
+unicode-y := utf8-norm.o utf8-core.o
 
 # This rule is not invoked during the kernel compilation.  It is used to
 # regenerate the utf8data.h header file.
fs/unicode/utf8-core.c new file +187 -0

187 lines not on this page · raw message

fs/unicode/utf8-norm.c +6 -0
index 848b93e97f50..20d440c3f2db 100644
@@ -38,6 +38,12 @@ int utf8version_is_supported(u8 maj, u8 min, u8 rev)
 }
 EXPORT_SYMBOL(utf8version_is_supported);
 
+int utf8version_latest(void)
+{
+	return utf8vers;
+}
+EXPORT_SYMBOL(utf8version_latest);
+
 /*
  * UTF-8 valid ranges.
  *
fs/unicode/utf8n.h +1 -0
index b63a9091dc39..a120638014c1 100644
@@ -32,6 +32,7 @@
 
 /* Highest unicode version supported by the data tables. */
 extern int utf8version_is_supported(u8 maj, u8 min, u8 rev);
+extern int utf8version_latest(void);
 
 /*
  * Look for the correct const struct utf8data for a unicode version.
include/linux/unicode.h new file +30 -0
new file mode 100644
index 000000000000..aec2c6d800aa
@@ -0,0 +1,30 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_UNICODE_H
+#define _LINUX_UNICODE_H
+
+#include <linux/init.h>
+#include <linux/dcache.h>
+
+struct unicode_map {
+	const char *charset;
+	int version;
+};
+
+int utf8_validate(const struct unicode_map *um, const struct qstr *str);
+
+int utf8_strncmp(const struct unicode_map *um,
+		 const struct qstr *s1, const struct qstr *s2);
+
+int utf8_strncasecmp(const struct unicode_map *um,
+		 const struct qstr *s1, const struct qstr *s2);
+
+int utf8_normalize(const struct unicode_map *um, const struct qstr *str,
+		   unsigned char *dest, size_t dlen);
+
+int utf8_casefold(const struct unicode_map *um, const struct qstr *str,
+		  unsigned char *dest, size_t dlen);
+
+struct unicode_map *utf8_load(const char *version);
+void utf8_unload(struct unicode_map *um);
+
+#endif /* _LINUX_UNICODE_H */
Signature · 1 line
2.20.1
#3 lore raw

PATCH v7 5/10 unicode: Introduce test module for normalized utf8 implementation

In reply to Gabriel Krisman Bertazi

From: Gabriel Krisman Bertazi <[email protected]>

This implements a in-kernel sanity test module for the utf8 normalization core. At probe time, it will run basic sequences through the utf8n core, to identify problems will equivalent sequences and normalization/casefold code. This is supposed to be useful for regression testing when adding support for a new version of utf8 to linux.

Changes since v4:
- integrate with fs/unicode

Changes since RFC v1:
- Include comparison tests for matching strings with different lengths.
- Include tests for characters included in unicode 8.0.0, 9.0.0 and 10.0.0.

---
 fs/unicode/Kconfig         |   5 +
 fs/unicode/Makefile        |   1 +
 fs/unicode/utf8-selftest.c | 320 +++++++++++++++++++++++++++++++++++++
 3 files changed, 326 insertions(+)
 create mode 100644 fs/unicode/utf8-selftest.c
fs/unicode/Kconfig +5 -0
index f41520f57dff..b560a879edf7 100644
@@ -6,3 +6,8 @@ config UNICODE
 	help
 	  Say Y here to enable UTF-8 NFD normalization and NFD+CF casefolding
 	  support.
+
+config UNICODE_NORMALIZATION_SELFTEST
+	tristate "Test UTF-8 normalization support"
+	depends on UNICODE
+	default n
fs/unicode/Makefile +1 -0
index bfb0360687df..671d31f83006 100644
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_UNICODE) += unicode.o
+obj-$(CONFIG_UNICODE_NORMALIZATION_SELFTEST) += utf8-selftest.o
 
 unicode-y := utf8-norm.o utf8-core.o
 
fs/unicode/utf8-selftest.c new file +320 -0

320 lines not on this page · raw message

Signature · 1 line
2.20.1
#4 lore raw

PATCH v7 7/10 MAINTAINERS: Add Unicode subsystem entry

In reply to Gabriel Krisman Bertazi
---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index 43b36dbed48e..6ad593f913cd 100644
@@ -15935,6 +15935,12 @@ F:	drivers/uwb/
 F:	include/linux/uwb.h
 F:	include/linux/uwb/
 
+UNICODE SUBSYSTEM:
+M:	Gabriel Krisman Bertazi <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	fs/unicode/
+
 UNICORE32 ARCHITECTURE:
 M:	Guan Xuetao <[email protected]>
 W:	http://mprc.pku.edu.cn/~guanxuetao/linux
Signature · 1 line
2.20.1
#5 lore raw

PATCH v7 8/10 ext4: Include encoding information in the superblock

In reply to Gabriel Krisman Bertazi

From: Gabriel Krisman Bertazi <[email protected]>

Support for encoding is considered an incompatible feature, since it has potential to create collisions of file names in existing filesystems. If the feature flag is not enabled, the entire filesystem will operate on opaque byte sequences, respecting the original behavior.

The s_encoding field stores a magic number indicating the encoding format and version used globally by file and directory names in the filesystem. The s_encoding_flags defines policies for using the charset encoding, like how to handle invalid sequences. The magic number is mapped to the exact charset table, but the mapping is specific to ext4. Since we don't have any commitment to support old encodings, the only encoding I am supporting right now is utf8-12.0.0.

The current implementation prevents the user from enabling encoding and per-directory encryption on the same filesystem at the same time. The incompatibility between these features lies in how we do efficient directory searches when we cannot be sure the encryption of the user provided fname will match the actual hash stored in the disk without decrypting every directory entry, because of normalization cases. My quickest solution is to simply block the concurrent use of these features for now, and enable it later, once we have a better solution.

Changes since v6:
- update to unicode 12.0

Changes since v4:
- Move from fs/nls to fs/unicode

Changes since v2:
- Split superblock bitfield reservation into another patch.
- Rename s_ioencoding -> s_encoding
- Remove encoding_info from in-memory superblock.

Changes since v1:
- Guard code with CONFIG_NLS.
- Use 16 bits for s_ioencoding.
- Split mount option from this patch

---
 fs/ext4/ext4.h  | 21 +++++++++++-
 fs/ext4/super.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+), 1 deletion(-)
fs/ext4/ext4.h +20 -1
index 82ffdacdc7fa..45f6b4119ffc 100644
@@ -1313,7 +1313,9 @@ struct ext4_super_block {
 	__u8	s_first_error_time_hi;
 	__u8	s_last_error_time_hi;
 	__u8	s_pad[2];
-	__le32	s_reserved[96];		/* Padding to the end of the block */
+	__le16  s_encoding;		/* Filename charset encoding */
+	__le16  s_encoding_flags;	/* Filename charset encoding flags */
+	__le32	s_reserved[95];		/* Padding to the end of the block */
 	__le32	s_checksum;		/* crc32c(superblock) */
 };
 
@@ -1338,6 +1340,16 @@ struct ext4_super_block {
 /* Number of quota types we support */
 #define EXT4_MAXQUOTAS 3
 
+#define EXT4_ENC_UTF8_12_0	1
+
+/*
+ * Flags for ext4_sb_info.s_encoding_flags.
+ */
+#define EXT4_ENC_STRICT_MODE_FL	(1 << 0)
+
+#define ext4_has_strict_mode(sbi) \
+	(sbi->s_encoding_flags & EXT4_ENC_STRICT_MODE_FL)
+
 /*
  * fourth extended-fs super-block data in memory
  */
@@ -1387,6 +1399,10 @@ struct ext4_sb_info {
 	struct kobject s_kobj;
 	struct completion s_kobj_unregister;
 	struct super_block *s_sb;
+#ifdef CONFIG_UNICODE
+	struct unicode_map *s_encoding;
+	__u16 s_encoding_flags;
+#endif
 
 	/* Journaling */
 	struct journal_s *s_journal;
@@ -1663,6 +1679,7 @@ static inline void ext4_clear_state_flags(struct ext4_inode_info *ei)
 #define EXT4_FEATURE_INCOMPAT_LARGEDIR		0x4000 /* >2GB or 3-lvl htree */
 #define EXT4_FEATURE_INCOMPAT_INLINE_DATA	0x8000 /* data in inode */
 #define EXT4_FEATURE_INCOMPAT_ENCRYPT		0x10000
+#define EXT4_FEATURE_INCOMPAT_FNAME_ENCODING	0x20000
 
 extern void ext4_update_dynamic_rev(struct super_block *sb);
 
@@ -1756,6 +1773,7 @@ EXT4_FEATURE_INCOMPAT_FUNCS(csum_seed,		CSUM_SEED)
 EXT4_FEATURE_INCOMPAT_FUNCS(largedir,		LARGEDIR)
 EXT4_FEATURE_INCOMPAT_FUNCS(inline_data,	INLINE_DATA)
 EXT4_FEATURE_INCOMPAT_FUNCS(encrypt,		ENCRYPT)
+EXT4_FEATURE_INCOMPAT_FUNCS(fname_encoding,	FNAME_ENCODING)
 
 #define EXT2_FEATURE_COMPAT_SUPP	EXT4_FEATURE_COMPAT_EXT_ATTR
 #define EXT2_FEATURE_INCOMPAT_SUPP	(EXT4_FEATURE_INCOMPAT_FILETYPE| \
@@ -1783,6 +1801,7 @@ EXT4_FEATURE_INCOMPAT_FUNCS(encrypt,		ENCRYPT)
 					 EXT4_FEATURE_INCOMPAT_MMP | \
 					 EXT4_FEATURE_INCOMPAT_INLINE_DATA | \
 					 EXT4_FEATURE_INCOMPAT_ENCRYPT | \
+					 EXT4_FEATURE_INCOMPAT_FNAME_ENCODING | \
 					 EXT4_FEATURE_INCOMPAT_CSUM_SEED | \
 					 EXT4_FEATURE_INCOMPAT_LARGEDIR)
 #define EXT4_FEATURE_RO_COMPAT_SUPP	(EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \
fs/ext4/super.c +85 -0

121 lines not on this page · raw message

Signature · 1 line
2.20.1
#6 lore raw

PATCH v7 9/10 ext4: Support case-insensitive file name lookups

In reply to Gabriel Krisman Bertazi

From: Gabriel Krisman Bertazi <[email protected]>

This patch implements the actual support for case-insensitive file name lookups in ext4, based on the feature bit and the encoding stored in the superblock.

A filesystem that has the fname_encoding feature set is able to configure directories with the +F (EXT4_CASEFOLD_FL) attribute, enabling lookups to succeed in that directory in a case-insensitive fashion, i.e:
match a directory entry even if the name used by userspace is not a byte per byte match with the disk name, but is an equivalent case-insensitive version of the Unicode string. This operation is called a case-insensitive file name lookup.

The feature is configured as an inode attribute applied to directories and inherited by its children. This attribute can only be enabled on empty directories for filesystems that support the encoding feature, thus preventing collision of file names that only differ by case.

* dcache handling:

For a +F directory, Ext4 only stores the first equivalent name dentry used in the dcache. This is done to prevent unintentional duplication of dentries in the dcache, while also allowing the VFS code to quickly find the right entry in the cache despite which equivalent string was used in a previous lookup, without having to resort to ->lookup().

d_hash() of casefolded directories is implemented as the hash of the casefolded string, such that we always have a well-known bucket for all the equivalencies of the same string. d_compare() uses the utf8_strncasecmp() infrastructure, which handles the comparison of equivalent, same case, names as well.

For now, negative lookups are not inserted in the dcache, since they would need to be invalidated anyway, because we can't trust missing file dentries. This is bad for performance but requires some leveraging of the vfs layer to fix. We can live without that for now, and so does everyone else.

* on-disk data:

Despite using a specific version of the name as the internal representation within the dcache, the name stored and fetched from the disk is a byte-per-byte match with what the user requested, making this implementation 'name-preserving'. i.e. no actual information is lost when writing to storage.

DX is supported by modifying the hashes used in +F directories to make them case/encoding-aware. The new disk hashes are calculated as the hash of the full casefolded string, instead of the string directly. This allows us to efficiently search for file names in the htree without requiring the user to provide an exact name.

* Dealing with invalid sequences:

By default, when a invalid UTF-8 sequence is identified, ext4 will treat it as an opaque byte sequence, ignoring the encoding and reverting to the old behavior for that unique file. This means that case-insensitive file name lookup will not work only for that file. An optional bit can be set in the superblock telling the filesystem code and userspace tools to enforce the encoding. When that optional bit is set, any attempt to create a file name using an invalid UTF-8 sequence will fail and return an error to userspace.

* Normalization algorithm:

The UTF-8 algorithms used to compare strings in ext4 is implemented lives in fs/unicode, and is based on a previous version developed by SGI. It implements the Canonical decomposition (NFD) algorithm described by the Unicode specification 12.0, or higher, combined with the elimination of ignorable code points (NFDi) and full case-folding (CF) as documented in fs/unicode/utf8_norm.c.

NFD seems to be the best normalization method for EXT4 because:

- It has a lower cost than NFC/NFKC (which requires decomposing to NFD as an intermediary step)
- It doesn't eliminate important semantic meaning like compatibility decompositions.

Although:

- This implementation is not completely linguistic accurate, because different languages have conflicting rules, which would require the specialization of the filesystem to a given locale, which brings all sorts of problems for removable media and for users who use more than one language.

Changes since v6:
- Return -ENOMEM in ext4fs_dirhash allocation failure. (0-day)
- Treat -F directories in the original way, as opaque sequences (tytso)
- Update to Unicode 12.0.0
Changes since v4:
- Migrate NFKD -> NFD

Changes since v2:
- Don't use d_add_ci.
- Squash the dcache hooks into this patch.
- Rename sbi->encoding -> sbi->s_encoding.

Changes since v1:
- Support normalized htree hashes.
- Guard code with CONFIG_NLS.
- Use qstr->len instead of strlen in dcache hookups.
- Moved the CASEFOLD_FL to prevent collision with reserved verity flag.

---
 fs/ext4/dir.c      |  48 ++++++++++++++++++++
 fs/ext4/ext4.h     |  21 ++++++---
 fs/ext4/hash.c     |  34 +++++++++++++-
 fs/ext4/ialloc.c   |   2 +-
 fs/ext4/inline.c   |   2 +-
 fs/ext4/inode.c    |   4 +-
 fs/ext4/ioctl.c    |  18 ++++++++
 fs/ext4/namei.c    | 107 ++++++++++++++++++++++++++++++++++++++++-----
 fs/ext4/super.c    |   6 +++
 include/linux/fs.h |   2 +
 10 files changed, 223 insertions(+), 21 deletions(-)
fs/ext4/dir.c +48 -0
index 0ccd51f72048..884a6e776809 100644
@@ -26,6 +26,7 @@
 #include <linux/buffer_head.h>
 #include <linux/slab.h>
 #include <linux/iversion.h>
+#include <linux/unicode.h>
 #include "ext4.h"
 #include "xattr.h"
 
@@ -660,3 +661,50 @@ const struct file_operations ext4_dir_operations = {
 	.open		= ext4_dir_open,
 	.release	= ext4_release_dir,
 };
+
+#ifdef CONFIG_UNICODE
+static int ext4_d_compare(const struct dentry *dentry, unsigned int len,
+			  const char *str, const struct qstr *name)
+{
+	struct qstr qstr = {.name = str, .len = len };
+
+	if (!IS_CASEFOLDED(dentry->d_parent->d_inode)) {
+		if (len != name->len)
+			return -1;
+		return !memcmp(str, name, len);
+	}
+
+	return ext4_ci_compare(dentry->d_parent->d_inode, name, &qstr);
+}
+
+static int ext4_d_hash(const struct dentry *dentry, struct qstr *str)
+{
+	const struct ext4_sb_info *sbi = EXT4_SB(dentry->d_sb);
+	const struct unicode_map *um = sbi->s_encoding;
+	unsigned char *norm;
+	int len, ret = 0;
+
+	if (!IS_CASEFOLDED(dentry->d_inode))
+		return 0;
+
+	norm = kmalloc(PATH_MAX, GFP_ATOMIC);
+	if (!norm)
+		return -ENOMEM;
+
+	len = utf8_casefold(um, str, norm, PATH_MAX);
+	if (len < 0) {
+		if (ext4_has_strict_mode(sbi))
+			ret = -EINVAL;
+		goto out;
+	}
+	str->hash = full_name_hash(dentry, norm, len);
+out:
+	kfree(norm);
+	return ret;
+}
+
+const struct dentry_operations ext4_dentry_ops = {
+	.d_hash = ext4_d_hash,
+	.d_compare = ext4_d_compare,
+};
+#endif
fs/ext4/ext4.h +15 -6
index 45f6b4119ffc..c0b98e882b33 100644
@@ -399,10 +399,11 @@ struct flex_groups {
 #define EXT4_EOFBLOCKS_FL		0x00400000 /* Blocks allocated beyond EOF */
 #define EXT4_INLINE_DATA_FL		0x10000000 /* Inode has inline data. */
 #define EXT4_PROJINHERIT_FL		0x20000000 /* Create with parents projid */
+#define EXT4_CASEFOLD_FL		0x40000000 /* Casefolded file */
 #define EXT4_RESERVED_FL		0x80000000 /* reserved for ext4 lib */
 
-#define EXT4_FL_USER_VISIBLE		0x304BDFFF /* User visible flags */
-#define EXT4_FL_USER_MODIFIABLE		0x204BC0FF /* User modifiable flags */
+#define EXT4_FL_USER_VISIBLE		0x704BDFFF /* User visible flags */
+#define EXT4_FL_USER_MODIFIABLE		0x604BC0FF /* User modifiable flags */
 
 /* Flags we can manipulate with through EXT4_IOC_FSSETXATTR */
 #define EXT4_FL_XFLAG_VISIBLE		(EXT4_SYNC_FL | \
@@ -417,10 +418,10 @@ struct flex_groups {
 			   EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\
 			   EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\
 			   EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL |\
-			   EXT4_PROJINHERIT_FL)
+			   EXT4_PROJINHERIT_FL | EXT4_CASEFOLD_FL)
 
 /* Flags that are appropriate for regular files (all but dir-specific ones). */
-#define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL))
+#define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL | EXT4_CASEFOLD_FL))
 
 /* Flags that are appropriate for non-directories/regular files. */
 #define EXT4_OTHER_FLMASK (EXT4_NODUMP_FL | EXT4_NOATIME_FL)
@@ -2396,8 +2397,8 @@ extern int ext4_check_all_de(struct inode *dir, struct buffer_head *bh,
 extern int ext4_sync_file(struct file *, loff_t, loff_t, int);
 
 /* hash.c */
-extern int ext4fs_dirhash(const char *name, int len, struct
-			  dx_hash_info *hinfo);
+extern int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
+			  struct dx_hash_info *hinfo);
 
 /* ialloc.c */
 extern struct inode *__ext4_new_inode(handle_t *, struct inode *, umode_t,
@@ -2993,6 +2994,10 @@ static inline void ext4_unlock_group(struct super_block *sb,
 /* dir.c */
 extern const struct file_operations ext4_dir_operations;
 
+#ifdef CONFIG_UNICODE
+extern const struct dentry_operations ext4_dentry_ops;
+#endif
+
 /* file.c */
 extern const struct inode_operations ext4_file_inode_operations;
 extern const struct file_operations ext4_file_operations;
@@ -3085,6 +3090,10 @@ extern void initialize_dirent_tail(struct ext4_dir_entry_tail *t,
 extern int ext4_handle_dirty_dirent_node(handle_t *handle,
 					 struct inode *inode,
 					 struct buffer_head *bh);
+extern int ext4_ci_compare(const struct inode *parent,
+			   const struct qstr *name,
+			   const struct qstr *entry);
+
 #define S_SHIFT 12
 static const unsigned char ext4_type_by_mode[(S_IFMT >> S_SHIFT) + 1] = {
 	[S_IFREG >> S_SHIFT]	= EXT4_FT_REG_FILE,
fs/ext4/hash.c +33 -1
index 46b24da33a28..d358bfcb6b3f 100644
@@ -6,6 +6,7 @@
  */
 
 #include <linux/fs.h>
+#include <linux/unicode.h>
 #include <linux/compiler.h>
 #include <linux/bitops.h>
 #include "ext4.h"
@@ -196,7 +197,8 @@ static void str2hashbuf_unsigned(const char *msg, int len, __u32 *buf, int num)
  * represented, and whether or not the returned hash is 32 bits or 64
  * bits.  32 bit hashes will return 0 for the minor hash.
  */
-int ext4fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo)
+static int __ext4fs_dirhash(const char *name, int len,
+			    struct dx_hash_info *hinfo)
 {
 	__u32	hash;
 	__u32	minor_hash = 0;
@@ -268,3 +270,33 @@ int ext4fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo)
 	hinfo->minor_hash = minor_hash;
 	return 0;
 }
+
+int ext4fs_dirhash(const struct inode *dir, const char *name, int len,
+		   struct dx_hash_info *hinfo)
+{
+#ifdef CONFIG_UNICODE
+	const struct unicode_map *um = EXT4_SB(dir->i_sb)->s_encoding;
+	int r, dlen;
+	unsigned char *buff;
+	struct qstr qstr = {.name = name, .len = len };
+
+	if (len && IS_CASEFOLDED(dir)) {
+		buff = kzalloc(sizeof(char) * PATH_MAX, GFP_KERNEL);
+		if (!buff)
+			return -ENOMEM;
+
+		dlen = utf8_casefold(um, &qstr, buff, PATH_MAX);
+		if (dlen < 0) {
+			kfree(buff);
+			goto opaque_seq;
+		}
+
+		r = __ext4fs_dirhash(buff, dlen, hinfo);
+
+		kfree(buff);
+		return r;
+	}
+opaque_seq:
+#endif
+	return __ext4fs_dirhash(name, len, hinfo);
+}
fs/ext4/ialloc.c +1 -1
index f3e17a8c84b4..764ff4c56233 100644
@@ -455,7 +455,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent,
 		if (qstr) {
 			hinfo.hash_version = DX_HASH_HALF_MD4;
 			hinfo.seed = sbi->s_hash_seed;
-			ext4fs_dirhash(qstr->name, qstr->len, &hinfo);
+			ext4fs_dirhash(parent, qstr->name, qstr->len, &hinfo);
 			grp = hinfo.hash;
 		} else
 			grp = prandom_u32();
fs/ext4/inline.c +1 -1
index 56f6e1782d5f..f73bc3925282 100644
@@ -1407,7 +1407,7 @@ int htree_inlinedir_to_tree(struct file *dir_file,
 			}
 		}
 
-		ext4fs_dirhash(de->name, de->name_len, hinfo);
+		ext4fs_dirhash(dir, de->name, de->name_len, hinfo);
 		if ((hinfo->hash < start_hash) ||
 		    ((hinfo->hash == start_hash) &&
 		     (hinfo->minor_hash < start_minor_hash)))
fs/ext4/inode.c +3 -1
index b32a57bc5d5d..1d7259b5f7ad 100644
@@ -4738,9 +4738,11 @@ void ext4_set_inode_flags(struct inode *inode)
 		new_fl |= S_DAX;
 	if (flags & EXT4_ENCRYPT_FL)
 		new_fl |= S_ENCRYPTED;
+	if (flags & EXT4_CASEFOLD_FL)
+		new_fl |= S_CASEFOLD;
 	inode_set_flags(inode, new_fl,
 			S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX|
-			S_ENCRYPTED);
+			S_ENCRYPTED|S_CASEFOLD);
 }
 
 static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode,
fs/ext4/ioctl.c +18 -0
index bab3da4f1e0d..b856b326cb21 100644
@@ -278,6 +278,7 @@ static int ext4_ioctl_setflags(struct inode *inode,
 	struct ext4_iloc iloc;
 	unsigned int oldflags, mask, i;
 	unsigned int jflag;
+	struct super_block *sb = inode->i_sb;
 
 	/* Is it quota file? Do not allow user to mess with it */
 	if (ext4_is_quota_file(inode))
@@ -322,6 +323,23 @@ static int ext4_ioctl_setflags(struct inode *inode,
 			goto flags_out;
 	}
 
+	if ((flags ^ oldflags) & EXT4_CASEFOLD_FL) {
+		if (!ext4_has_feature_fname_encoding(sb)) {
+			err = -EOPNOTSUPP;
+			goto flags_out;
+		}
+
+		if (!S_ISDIR(inode->i_mode)) {
+			err = -ENOTDIR;
+			goto flags_out;
+		}
+
+		if (!ext4_empty_dir(inode)) {
+			err = -ENOTEMPTY;
+			goto flags_out;
+		}
+	}
+
 	handle = ext4_journal_start(inode, EXT4_HT_INODE, 1);
 	if (IS_ERR(handle)) {
 		err = PTR_ERR(handle);
fs/ext4/namei.c +96 -11

221 lines not on this page · raw message

fs/ext4/super.c +6 -0
index 7caba9d98bdf..3870866840f9 100644
@@ -4453,6 +4453,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 		iput(root);
 		goto failed_mount4;
 	}
+
+#ifdef CONFIG_UNICODE
+	if (sbi->s_encoding)
+		sb->s_d_op = &ext4_dentry_ops;
+#endif
+
 	sb->s_root = d_make_root(root);
 	if (!sb->s_root) {
 		ext4_msg(sb, KERN_ERR, "get root dentry failed");
include/linux/fs.h +2 -0
index 8b42df09b04c..6261090e605b 100644
@@ -1953,6 +1953,7 @@ struct super_operations {
 #define S_DAX		0	/* Make all the DAX code disappear */
 #endif
 #define S_ENCRYPTED	16384	/* Encrypted file (using fs/crypto/) */
+#define S_CASEFOLD	32768	/* Casefolded file */
 
 /*
  * Note that nosuid etc flags are inode-specific: setting some file-system
@@ -1993,6 +1994,7 @@ static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags
 #define IS_NOSEC(inode)		((inode)->i_flags & S_NOSEC)
 #define IS_DAX(inode)		((inode)->i_flags & S_DAX)
 #define IS_ENCRYPTED(inode)	((inode)->i_flags & S_ENCRYPTED)
+#define IS_CASEFOLDED(inode)	((inode)->i_flags & S_CASEFOLD)
 
 #define IS_WHITEOUT(inode)	(S_ISCHR(inode->i_mode) && \
 				 (inode)->i_rdev == WHITEOUT_DEV)
Signature · 1 line
2.20.1
#7 lore raw

PATCH v7 10/10 docs: ext4.rst: Document case-insensitive directories

In reply to Gabriel Krisman Bertazi

From: Gabriel Krisman Bertazi <[email protected]>

Introduces the case-insensitive features on ext4 for system administrators. Explain the minimum of design decisions that are important for sysadmins wanting to enable this feature.

---
 Documentation/admin-guide/ext4.rst | 38 ++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
Documentation/admin-guide/ext4.rst +38 -0
index e506d3dae510..9e8b35ed7cd9 100644
@@ -91,10 +91,48 @@ Currently Available
 * large block (up to pagesize) support
 * efficient new ordered mode in JBD2 and ext4 (avoid using buffer head to force
   the ordering)
+* Case-insensitive file name lookups
 
 [1] Filesystems with a block size of 1k may see a limit imposed by the
 directory hash tree having a maximum depth of two.
 
+case-insensitive file name lookups
+======================================================
+
+The case-insensitive file name lookup feature is supported on a
+per-directory basis, allowing the user to mix case-insensitive and
+case-sensitive directories in the same filesystem.  It is enabled by
+flipping the +F inode attribute of an empty directory.  The
+case-insensitive string match operation is only defined when we know how
+text in encoded in a byte sequence.  For that reason, in order to enable
+case-insensitive directories, the filesystem must have the
+fname_encoding feature, which stores the filesystem-wide encoding
+model used.  By default, the charset adopted is the latest version of
+Unicode (12.0.0, by the time of this writing), encoded in the UTF-8
+form.  The comparison algorithm is implemented by normalizing the
+strings to the Canonical decomposition form, as defined by Unicode,
+followed by a byte per byte comparison.
+
+The case-awareness is name-preserving on the disk, meaning that the file
+name provided by userspace is a byte-per-byte match to what is actually
+written in the disk.  The Unicode normalization format used by the
+kernel is thus an internal representation, and not exposed to the
+userspace nor to the disk, with the important exception of disk hashes,
+used on large case-insensitive directories with DX feature.  On DX
+directories, the hash must be calculated using the casefolded version of
+the filename, meaning that the normalization format used actually has an
+impact on where the directory entry is stored.
+
+When we change from viewing filenames as opaque byte sequences to seeing
+them as encoded strings we need to address what happens when a program
+tries to create a file with an invalid name.  The Unicode subsystem
+within the kernel leaves the decision of what to do in this case to the
+filesystem, which select its preferred behavior by enabling/disabling
+the strict mode.  When Ext4 encounters one of those strings and the
+filesystem did not require strict mode, it falls back to considering the
+entire string as an opaque byte sequence, which still allows the user to
+operate on that file, but the case-insensitive lookups won't work.
+
 Options
 =======
 
Signature · 1 line
2.20.1
#8 lore raw

PATCH 1/2 unicode: Update unicode database unicode version 12.1.0

In reply to Gabriel Krisman Bertazi

Unicode 12.1.0 adds the character U+32FF (SQUARE ERA NAME REIWA), only. It's decomposition in NFD is identity, so there isn't much change here. In fact, the only behavior alteration would be strict mode allowing a file with this character.

Feel free to squash these two into the respective patches of the previous seriessubmitted it separately to make review easier.

---
 fs/unicode/README.utf8data | 49 +++++++++++++++++++-------------------
 fs/unicode/utf8-selftest.c |  4 ++--
 fs/unicode/utf8data.h      | 17 +++++++------
 3 files changed, 37 insertions(+), 33 deletions(-)
fs/unicode/README.utf8data +25 -24
index cbcdb56832ed..eeb7561526d9 100644
@@ -1,39 +1,40 @@
 The utf8data.h file in this directory is generated from the Unicode
-Character Database for version 12.0.0 of the Unicode standard.
+Character Database for version 12.1.0 of the Unicode standard.
 
 The full set of files can be found here:
 
-  http://www.unicode.org/Public/12.0.0/ucd/
+  http://www.unicode.org/Public/12.1.0/ucd/
 
 Individual source links:
 
-  http://www.unicode.org/Public/12.0.0/ucd/CaseFolding.txt
-  http://www.unicode.org/Public/12.0.0/ucd/DerivedAge.txt
-  http://www.unicode.org/Public/12.0.0/ucd/extracted/DerivedCombiningClass.txt
-  http://www.unicode.org/Public/12.0.0/ucd/DerivedCoreProperties.txt
-  http://www.unicode.org/Public/12.0.0/ucd/NormalizationCorrections.txt
-  http://www.unicode.org/Public/12.0.0/ucd/NormalizationTest.txt
-  http://www.unicode.org/Public/12.0.0/ucd/UnicodeData.txt
+  https://www.unicode.org/Public/12.1.0/ucd/CaseFolding-12.1.0d2.txt
+  https://www.unicode.org/Public/12.1.0/ucd/DerivedAge-12.1.0d3.txt
+  https://www.unicode.org/Public/12.1.0/ucd/extracted/DerivedCombiningClass-12.1.0d2.txt
+  https://www.unicode.org/Public/12.1.0/ucd/DerivedCoreProperties-12.1.0d2.txt
+  https://www.unicode.org/Public/12.1.0/ucd/NormalizationCorrections-12.1.0d1.txt
+  https://www.unicode.org/Public/12.1.0/ucd/NormalizationTest-12.1.0d3.txt
+  https://www.unicode.org/Public/12.1.0/ucd/UnicodeData-12.1.0d2.txt
 
 md5sums (verify by running "md5sum -c README.utf8data"):
 
-  a794be08c28f90853003c9bdf8826509  CaseFolding.txt
-  6b4750a2ff1a19ce7f28b6a6528457e8  DerivedAge.txt
-  fae28c468eb7017785ecf21fdc6c5835  DerivedCombiningClass.txt
-  efb8b829abd2a0aaa617e3d66211440d  DerivedCoreProperties.txt
-  4c662a8f228506aea5e8a6e2e06e15d8  NormalizationCorrections.txt
-  35866dad08e10d658c344808b48ac01d  NormalizationTest.txt
-  6221effa1dd15524745a467f7366233d  UnicodeData.txt
+  900e76da1d822a160fd6b8c0b1d70094  CaseFolding-12.1.0d2.txt
+  131256380bff4fea8ad4a851616f2f10  DerivedAge-12.1.0d3.txt
+  e731a4089b30002144e107e3d6f8d1fa  DerivedCombiningClass-12.1.0d2.txt
+  a47c9fbd7ff92a9b261ba9831e68778a  DerivedCoreProperties-12.1.0d2.txt
+  fcab6dad15e440879d92f315978f93d3  NormalizationCorrections-12.1.0d1.txt
+  f9ff1c55a60decf436100f791b44aa98  NormalizationTest-12.1.0d3.txt
+  755f6af699f8c8d2d958da411f78f6c6  UnicodeData-12.1.0d2.txt
 
 sha1sums (verify by running "sha1sum -c README.utf8data"):
 
-  404fc6a0a80a64ecece059fa9a1e342152d58db3  CaseFolding.txt
-  cb18ee0677d6054b7e1b87946f6d566a8c0feebe  DerivedAge.txt
-  79226de6bf7d8fde525120634a9177d9b2a55e13  DerivedCombiningClass.txt
-  8cc194267f90d5c4ba4118236f9d6df28b4db425  DerivedCoreProperties.txt
-  48104614d353e9962fe5b074e4348cd0f95104df  NormalizationCorrections.txt
-  7e7806e4579f0a481b3677969675f63aec08feba  NormalizationTest.txt
-  0a309cf58fe2a5d0d904c9bf2c1a89b2666c413a  UnicodeData.txt
+  dc9245f6803c4ac99555c361f5052e0b13eb779b  CaseFolding-12.1.0d2.txt
+  3281104f237184cdb5d869e86eb8573678ada7da  DerivedAge-12.1.0d3.txt
+  2f5f995ccb96e0fa84b15151b35d5e2681535175  DerivedCombiningClass-12.1.0d2.txt
+  5b8698a3fcd5018e1987f296b02e2c17e696415e  DerivedCoreProperties-12.1.0d2.txt
+  cd83935fbc012345d8792d2c704f69497e753835  NormalizationCorrections-12.1.0d1.txt
+  ea419aae505b337b0d99a83fa83fe58ddff7c19f  NormalizationTest-12.1.0d3.txt
+  dc973c0fc93d6f09d9ab9f70d1c9f89c447f0526  UnicodeData-12.1.0d2.txt
+
 
 To update to the newer version of the Unicode standard, the latest
 released version of the UCD can be found here:
@@ -46,7 +47,7 @@ cd to this directory (fs/unicode) and run this command:
 	make C=../.. objdir=../.. utf8data.h.new
 
 After sanity checking the newly generated utf8data.h.new file (the
-version generated from the 12.0.0 UCD should be 4,106 lines long, and
+version generated from the 12.1.0 UCD should be 4,109 lines long, and
 have a total size of 324k) and/or comparing it with the older version
 of utf8data.h, rename it to utf8data.h.
 
fs/unicode/utf8-selftest.c +2 -2
index 6964553c0132..80752013fce0 100644
@@ -27,7 +27,7 @@ unsigned int total_tests;
 
 /* Tests will be based on this version. */
 #define latest_maj 12
-#define latest_min 0
+#define latest_min 1
 #define latest_rev 0
 
 #define _test(cond, func, line, fmt, ...) do {				\
@@ -243,7 +243,7 @@ static void check_utf8_nfdicf(void)
 static void check_utf8_comparisons(void)
 {
 	int i;
-	struct unicode_map *table = utf8_load("11.0.0");
+	struct unicode_map *table = utf8_load("12.1.0");
 
 	if (IS_ERR(table)) {
 		pr_err("%s: Unable to load utf8 %d.%d.%d. Skipping.\n",
fs/unicode/utf8data.h +10 -7
index 4d65c04e0786..76e4f0e1b089 100644
@@ -3,7 +3,7 @@
 #error Only nls_utf8-norm.c should include this file.
 #endif
 
-static const unsigned int utf8vers = 0xc0000;
+static const unsigned int utf8vers = 0xc0100;
 
 static const unsigned int utf8agetab[] = {
 	0,
@@ -27,7 +27,8 @@ static const unsigned int utf8agetab[] = {
 	0x90000,
 	0xa0000,
 	0xb0000,
-	0xc0000
+	0xc0000,
+	0xc0100
 };
 
 static const struct utf8data utf8nfdicfdata[] = {
@@ -52,7 +53,8 @@ static const struct utf8data utf8nfdicfdata[] = {
 	{ 0x90000, 3200 },
 	{ 0xa0000, 3200 },
 	{ 0xb0000, 3200 },
-	{ 0xc0000, 3200 }
+	{ 0xc0000, 3200 },
+	{ 0xc0100, 3200 }
 };
 
 static const struct utf8data utf8nfdidata[] = {
@@ -77,7 +79,8 @@ static const struct utf8data utf8nfdidata[] = {
 	{ 0x90000, 20736 },
 	{ 0xa0000, 20736 },
 	{ 0xb0000, 20736 },
-	{ 0xc0000, 20736 }
+	{ 0xc0000, 20736 },
+	{ 0xc0100, 20736 }
 };
 
 static const unsigned char utf8data[64256] = {
@@ -285,7 +288,7 @@ static const unsigned char utf8data[64256] = {
 	0xe8,0x9a,0x88,0x00,0x05,0xff,0xe8,0x9c,0x8e,0x00,0xd1,0x10,0x10,0x08,0x05,0xff,
 	0xe8,0x9c,0xa8,0x00,0x05,0xff,0xe8,0x9d,0xab,0x00,0x10,0x08,0x05,0xff,0xe8,0x9e,
 	0x86,0x00,0x05,0xff,0xe4,0xb5,0x97,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	/* nfdicf_c0000 */
+	/* nfdicf_c0100 */
 	0xd7,0xb0,0x56,0x04,0x01,0x00,0x95,0xa8,0xd4,0x5e,0xd3,0x2e,0xd2,0x16,0xd1,0x0a,
 	0x10,0x04,0x01,0x00,0x01,0xff,0x61,0x00,0x10,0x06,0x01,0xff,0x62,0x00,0x01,0xff,
 	0x63,0x00,0xd1,0x0c,0x10,0x06,0x01,0xff,0x64,0x00,0x01,0xff,0x65,0x00,0x10,0x06,
@@ -1382,7 +1385,7 @@ static const unsigned char utf8data[64256] = {
 	0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-	/* nfdi_c0000 */
+	/* nfdi_c0100 */
 	0x57,0x04,0x01,0x00,0xc6,0xe5,0xac,0x13,0xe4,0x41,0x0c,0xe3,0x7a,0x07,0xe2,0xf3,
 	0x01,0xc1,0xd0,0x1f,0xcf,0x86,0x55,0x04,0x01,0x00,0x94,0x15,0x53,0x04,0x01,0x00,
 	0x52,0x04,0x01,0x00,0x91,0x09,0x10,0x04,0x01,0x00,0x01,0xff,0x00,0x01,0x00,0x01,
@@ -2698,7 +2701,7 @@ static const unsigned char utf8data[64256] = {
 	0x04,0x01,0x00,0x54,0x04,0x01,0x00,0x93,0x10,0x92,0x0c,0x91,0x08,0x10,0x04,0x01,
 	0x00,0x06,0x00,0x06,0x00,0x06,0x00,0x06,0x00,0xcf,0x86,0xd5,0x10,0x94,0x0c,0x53,
 	0x04,0x01,0x00,0x12,0x04,0x01,0x00,0x07,0x00,0x01,0x00,0x54,0x04,0x01,0x00,0x53,
-	0x04,0x01,0x00,0x52,0x04,0x01,0x00,0x51,0x04,0x01,0x00,0x10,0x04,0x01,0x00,0x00,
+	0x04,0x01,0x00,0x52,0x04,0x01,0x00,0x51,0x04,0x01,0x00,0x10,0x04,0x01,0x00,0x16,
 	0x00,0xd1,0x30,0xd0,0x06,0xcf,0x06,0x01,0x00,0xcf,0x86,0x55,0x04,0x01,0x00,0x54,
 	0x04,0x01,0x00,0xd3,0x10,0x52,0x04,0x01,0x00,0x51,0x04,0x01,0x00,0x10,0x04,0x01,
 	0x00,0x07,0x00,0x92,0x0c,0x51,0x04,0x07,0x00,0x10,0x04,0x07,0x00,0x01,0x00,0x01,
Signature · 1 line
2.20.1
#9 lore raw

PATCH 2/2 ext4: Update to use unicode 12.1

---
 fs/ext4/ext4.h  | 2 +-
 fs/ext4/super.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
fs/ext4/ext4.h +1 -1
index c0b98e882b33..7bc3859458f0 100644
@@ -1341,7 +1341,7 @@ struct ext4_super_block {
 /* Number of quota types we support */
 #define EXT4_MAXQUOTAS 3
 
-#define EXT4_ENC_UTF8_12_0	1
+#define EXT4_ENC_UTF8_12_1	1
 
 /*
  * Flags for ext4_sb_info.s_encoding_flags.
fs/ext4/super.c +1 -1
index 3870866840f9..44d22955afa6 100644
@@ -1760,7 +1760,7 @@ static const struct ext4_sb_encodings {
 	char *name;
 	char *version;
 } ext4_sb_encoding_map[] = {
-	{EXT4_ENC_UTF8_12_0, "utf8", "12.0.0"},
+	{EXT4_ENC_UTF8_12_1, "utf8", "12.1.0"},
 };
 
 static int ext4_sb_read_encoding(const struct ext4_super_block *es,
Signature · 1 line
2.20.1
maintainer
#10 lore raw
In reply to Gabriel Krisman Bertazi
Quoted 4 lines · Gabriel Krisman Bertazi

This is the v7 of the case-insensitive support. It includes the design changes we discussed, unicode 12.0 support, and the Linus' request about the way we store the utf8data.h file.

The V7 case insensitive support is now in the ext4.git tree. So it should be in Linux-next tomorrow.

Cheers,

- Ted