From 4f3bb22be2be4110f1dff8869c3bdf20dd5fdae3 Mon Sep 17 00:00:00 2001 From: Tao Ma Date: Thu, 9 Oct 2008 23:06:13 +0800 Subject: [PATCH] --- yaml --- r: 114411 b: refs/heads/master c: 2057e5c6780d86939a199031cdbafb81e6f88aac h: refs/heads/master i: 114409: 8703705738d83ab7c214f909009066c25ed06f62 114407: 7995cfb8eeff7f740e301c73a644ff974bfdfeb1 v: v3 --- [refs] | 2 +- trunk/fs/ocfs2/xattr.c | 35 +++++------------------------------ 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/[refs] b/[refs] index 0b5b9a4b4d82..2198448cc27a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 99219aea68b5bff4f182858372b43181ad3bdb34 +refs/heads/master: 2057e5c6780d86939a199031cdbafb81e6f88aac diff --git a/trunk/fs/ocfs2/xattr.c b/trunk/fs/ocfs2/xattr.c index 0f556b00235e..092a12318986 100644 --- a/trunk/fs/ocfs2/xattr.c +++ b/trunk/fs/ocfs2/xattr.c @@ -148,21 +148,13 @@ static inline struct xattr_handler *ocfs2_xattr_handler(int name_index) } 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) ^ @@ -183,14 +175,9 @@ static void ocfs2_xattr_hash_entry(struct inode *inode, 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; @@ -2093,18 +2080,6 @@ int ocfs2_xattr_set(struct inode *inode, 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. @@ -2395,7 +2370,7 @@ static int ocfs2_xattr_index_block_find(struct inode *inode, 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; @@ -4435,8 +4410,8 @@ static int ocfs2_xattr_set_in_bucket(struct inode *inode, 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)) { /*