[PATCH 3/6] fs: SB_CASEFOLD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a new flag indicating that a filesystem supports casefolding.

This is better than overlayfs's current method of checking for
sb->s_encoding, which isn't reliable - XFS implements ASCII casefolding,
so it won't be set there.

It's needed for overlayfs and the new dcache exclusion code to check
"should we allow union mounts on this filesystem even though the dcache
hash/compare ops are set? and do we need the new exclusion?".

Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>
Cc: Christian Brauner <brauner@xxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx>
---
 fs/libfs.c         | 1 +
 include/linux/fs.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/fs/libfs.c b/fs/libfs.c
index 6393d7c49ee6..d9f6ed6ec4ea 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1952,6 +1952,7 @@ void generic_set_sb_d_ops(struct super_block *sb)
 {
 #if IS_ENABLED(CONFIG_UNICODE)
 	if (sb->s_encoding) {
+		sb->s_flags |= SB_CASEFOLD;
 		sb->s_d_op = &generic_ci_dentry_ops;
 		return;
 	}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 016b0fe1536e..ba942cd2fea1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1228,6 +1228,7 @@ extern int send_sigurg(struct file *file);
 #define SB_SYNCHRONOUS  BIT(4)	/* Writes are synced at once */
 #define SB_MANDLOCK     BIT(6)	/* Allow mandatory locks on an FS */
 #define SB_DIRSYNC      BIT(7)	/* Directory modifications are synchronous */
+#define SB_CASEFOLD	BIT(8)	/* Superblock supports casefolding */
 #define SB_NOATIME      BIT(10)	/* Do not update access times. */
 #define SB_NODIRATIME   BIT(11)	/* Do not update directory access times */
 #define SB_SILENT       BIT(15)
-- 
2.49.0





[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux