Whamcloud - gitweb
LU-13550 osd-zfs: snapshot with incompatible clients
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_iam_lvar.c
index 031cd33..2511176 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * iam_lvar.c
  *
@@ -166,6 +165,25 @@ static inline struct lvar_leaf_entry *e_next(const struct iam_leaf *leaf,
 #define LVAR_HASH_R5        (0)
 #define LVAR_HASH_PREFIX    (0)
 
+#ifdef HAVE_LDISKFSFS_GETHASH_INODE_ARG
+/*
+ * NOTE: doing this breaks on file systems configured with
+ *       case-insensitive file name lookups
+ *
+ * kernel 5.2 commit b886ee3e778ec2ad43e276fd378ab492cf6819b7
+ * ext4: Support case-insensitive file name lookups
+ *
+ * FUTURE:
+ *  We need to pass the struct inode *dir down to hash_build0
+ *  to enable case-insensitive file name support ext4/ldiskfs
+ */
+#define e_ldiskfsfs_dirhash(name, len, info) \
+               __ldiskfsfs_dirhash(name, len, info)
+#else
+#define e_ldiskfsfs_dirhash(name, len, info) \
+               ldiskfsfs_dirhash(name, len, info)
+#endif
+
 static u32 hash_build0(const char *name, int namelen)
 {
        u32 result;
@@ -186,14 +204,14 @@ static u32 hash_build0(const char *name, int namelen)
 
                hinfo.hash_version = LDISKFS_DX_HASH_TEA;
                hinfo.seed = NULL;
-               ldiskfsfs_dirhash(name, namelen, &hinfo);
+               e_ldiskfsfs_dirhash(name, namelen, &hinfo);
                result = hinfo.hash;
                if (LVAR_HASH_SANDWICH) {
                        u32 result2;
 
                        hinfo.hash_version = LDISKFS_DX_HASH_TEA;
                        hinfo.seed = NULL;
-                       ldiskfsfs_dirhash(name, namelen, &hinfo);
+                       e_ldiskfsfs_dirhash(name, namelen, &hinfo);
                        result2 = hinfo.hash;
                        result = (0xfc000000 & result2) | (0x03ffffff & result);
                }
@@ -751,7 +769,7 @@ static int lvar_leaf_empty(struct iam_leaf *leaf)
        return h_used(n_head(leaf)) == sizeof(struct lvar_leaf_header);
 }
 
-static struct iam_leaf_operations lvar_leaf_ops = {
+static const struct iam_leaf_operations lvar_leaf_ops = {
        .init           = lvar_init,
        .init_new       = lvar_init_new,
        .fini           = lvar_fini,
@@ -1025,7 +1043,7 @@ out:
        return result;
 }
 
-static struct iam_operations lvar_ops = {
+static const struct iam_operations lvar_ops = {
        .id_root_ptr    = lvar_root_ptr,
        .id_node_read   = iam_node_read,
        .id_node_init   = lvar_node_init,
@@ -1038,7 +1056,7 @@ static struct iam_operations lvar_ops = {
        .id_name        = "lvar"
 };
 
-static int lvar_guess(struct iam_container *c)
+int iam_lvar_guess(struct iam_container *c)
 {
        int result;
        struct buffer_head *bh;
@@ -1070,13 +1088,3 @@ static int lvar_guess(struct iam_container *c)
        }
        return result;
 }
-
-static struct iam_format lvar_format = {
-       .if_guess = lvar_guess
-};
-
-void iam_lvar_format_init(void)
-{
-       iam_format_register(&lvar_format);
-}
-