From a88b34fe120563967732b98326a9a35f2374a5c8 Mon Sep 17 00:00:00 2001 From: chas williams - CONTRACTOR Date: Fri, 10 Aug 2012 15:21:10 -0400 Subject: [PATCH] LU-1665 libcfs: alignment of hsb_head[0] can be suboptimal On ia64, hsb_head[0] of struct cfs_hash_bucket could be aligned to a 4-byte boundary. However, after allocating the hash bucket and casting, the first member of the struct pointed to by hsb_head[0] might prefer an 8-byte alignment. This causes a constant stream of unaligned access warnings from the kernel. For other cpus this might waste some small amount of space, but potentially produces more natural alignments (8 byte objects on 8 byte boundaries). Signed-off-by: chas williams - CONTRACTOR Change-Id: I4561ab3e6553b5dcef840b8e4e9aa3023b7c3586 Reviewed-on: http://review.whamcloud.com/4965 Reviewed-by: Andreas Dilger Tested-by: Hudson Reviewed-by: Keith Mannthey Tested-by: Maloo --- libcfs/include/libcfs/libcfs_hash.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libcfs/include/libcfs/libcfs_hash.h b/libcfs/include/libcfs/libcfs_hash.h index 4187d92..ab9d8a8 100644 --- a/libcfs/include/libcfs/libcfs_hash.h +++ b/libcfs/include/libcfs/libcfs_hash.h @@ -149,12 +149,12 @@ typedef union { * - some extra bytes (caller can require it while creating hash) */ typedef struct cfs_hash_bucket { - cfs_hash_lock_t hsb_lock; /**< bucket lock */ - __u32 hsb_count; /**< current entries */ - __u32 hsb_version; /**< change version */ - unsigned int hsb_index; /**< index of bucket */ - int hsb_depmax; /**< max depth on bucket */ - char hsb_head[0]; /**< hash-head array */ + cfs_hash_lock_t hsb_lock; /**< bucket lock */ + __u32 hsb_count; /**< current entries */ + __u32 hsb_version; /**< change version */ + unsigned int hsb_index; /**< index of bucket */ + int hsb_depmax; /**< max depth on bucket */ + long hsb_head[0]; /**< hash-head array */ } cfs_hash_bucket_t; /** -- 1.8.3.1