]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.suse/ocfs2-Calculate-EA-hash-only-by-its-suffix.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.suse / ocfs2-Calculate-EA-hash-only-by-its-suffix.patch
diff --git a/src/patches/suse-2.6.27.31/patches.suse/ocfs2-Calculate-EA-hash-only-by-its-suffix.patch b/src/patches/suse-2.6.27.31/patches.suse/ocfs2-Calculate-EA-hash-only-by-its-suffix.patch
new file mode 100644 (file)
index 0000000..b156134
--- /dev/null
@@ -0,0 +1,95 @@
+From: Tao Ma <tao.ma@oracle.com>
+Subject: ocfs2: Calculate EA hash only by its suffix.
+Patch-mainline: 2.6.28
+
+According to Christoph Hellwig's advice, the hash value of EA
+is only calculated by its suffix.
+
+Signed-off-by: Tao Ma <tao.ma@oracle.com>
+Signed-off-by: Mark Fasheh <mfasheh@suse.com>
+---
+ fs/ocfs2/xattr.c |   35 +++++------------------------------
+ 1 files changed, 5 insertions(+), 30 deletions(-)
+
+Index: linux-2.6.27/fs/ocfs2/xattr.c
+===================================================================
+--- linux-2.6.27.orig/fs/ocfs2/xattr.c
++++ linux-2.6.27/fs/ocfs2/xattr.c
+@@ -164,21 +164,13 @@ static inline struct xattr_handler *ocfs
+ }
+ static u32 ocfs2_xattr_name_hash(struct inode *inode,
+-                               char *prefix,
+-                               int prefix_len,
+-                               char *name,
++                               const char *name,
+                                int name_len)
+ {
+       /* Get hash value of uuid from super block */
+       u32 hash = OCFS2_SB(inode->i_sb)->uuid_hash;
+       int i;
+-      /* hash extended attribute prefix */
+-      for (i = 0; i < prefix_len; i++) {
+-              hash = (hash << OCFS2_HASH_SHIFT) ^
+-                     (hash >> (8*sizeof(hash) - OCFS2_HASH_SHIFT)) ^
+-                     *prefix++;
+-      }
+       /* hash extended attribute name */
+       for (i = 0; i < name_len; i++) {
+               hash = (hash << OCFS2_HASH_SHIFT) ^
+@@ -199,14 +191,9 @@ static void ocfs2_xattr_hash_entry(struc
+                                  struct ocfs2_xattr_entry *entry)
+ {
+       u32 hash = 0;
+-      struct xattr_handler *handler =
+-                      ocfs2_xattr_handler(ocfs2_xattr_get_type(entry));
+-      char *prefix = handler->prefix;
+       char *name = (char *)header + le16_to_cpu(entry->xe_name_offset);
+-      int prefix_len = strlen(handler->prefix);
+-      hash = ocfs2_xattr_name_hash(inode, prefix, prefix_len, name,
+-                                   entry->xe_name_len);
++      hash = ocfs2_xattr_name_hash(inode, name, entry->xe_name_len);
+       entry->xe_name_hash = cpu_to_le32(hash);
+       return;
+@@ -2109,18 +2096,6 @@ cleanup:
+       return ret;
+ }
+-static inline u32 ocfs2_xattr_hash_by_name(struct inode *inode,
+-                                         int name_index,
+-                                         const char *suffix_name)
+-{
+-      struct xattr_handler *handler = ocfs2_xattr_handler(name_index);
+-      char *prefix = handler->prefix;
+-      int prefix_len = strlen(handler->prefix);
+-
+-      return ocfs2_xattr_name_hash(inode, prefix, prefix_len,
+-                                   (char *)suffix_name, strlen(suffix_name));
+-}
+-
+ /*
+  * Find the xattr extent rec which may contains name_hash.
+  * e_cpos will be the first name hash of the xattr rec.
+@@ -2411,7 +2386,7 @@ static int ocfs2_xattr_index_block_find(
+       struct ocfs2_extent_list *el = &xb_root->xt_list;
+       u64 p_blkno = 0;
+       u32 first_hash, num_clusters = 0;
+-      u32 name_hash = ocfs2_xattr_hash_by_name(inode, name_index, name);
++      u32 name_hash = ocfs2_xattr_name_hash(inode, name, strlen(name));
+       if (le16_to_cpu(el->l_next_free_rec) == 0)
+               return -ENODATA;
+@@ -4451,8 +4426,8 @@ static int ocfs2_xattr_set_in_bucket(str
+       size_t value_len;
+       char *val = (char *)xi->value;
+       struct ocfs2_xattr_entry *xe = xs->here;
+-      u32 name_hash = ocfs2_xattr_hash_by_name(inode,
+-                                               xi->name_index, xi->name);
++      u32 name_hash = ocfs2_xattr_name_hash(inode, xi->name,
++                                            strlen(xi->name));
+       if (!xs->not_found && !ocfs2_xattr_is_local(xe)) {
+               /*