aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/dir-item.c
diff options
context:
space:
mode:
authorDavid Miller <davem@davemloft.net>2008-02-15 10:40:52 -0500
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:00 -0400
commitdf68b8a7ad4a18c9e63f1c12015a59c3b7031adb (patch)
treef2e6569b5f4843a01f23068fdfd3b450c8258459 /fs/btrfs/dir-item.c
parent39b5637f6f195852259004bb27b58e2dcf9fb378 (diff)
Btrfs: unaligned access fixes
Btrfs set/get macros lose type information needed to avoid unaligned accesses on sparc64. ere is a patch for the kernel bits which fixes most of the unaligned accesses on sparc64. btrfs_name_hash is modified to return the hash value instead of getting a return location via a (potentially unaligned) pointer. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/dir-item.c')
-rw-r--r--fs/btrfs/dir-item.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c
index 5247a9a41f08..7a73dc59dc4d 100644
--- a/fs/btrfs/dir-item.c
+++ b/fs/btrfs/dir-item.c
@@ -71,8 +71,7 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans,
71 71
72 key.objectid = dir; 72 key.objectid = dir;
73 btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY); 73 btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY);
74 ret = btrfs_name_hash(name, name_len, &key.offset); 74 key.offset = btrfs_name_hash(name, name_len);
75 BUG_ON(ret);
76 path = btrfs_alloc_path(); 75 path = btrfs_alloc_path();
77 if (!path) 76 if (!path)
78 return -ENOMEM; 77 return -ENOMEM;
@@ -125,8 +124,7 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
125 124
126 key.objectid = dir; 125 key.objectid = dir;
127 btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY); 126 btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY);
128 ret = btrfs_name_hash(name, name_len, &key.offset); 127 key.offset = btrfs_name_hash(name, name_len);
129 BUG_ON(ret);
130 path = btrfs_alloc_path(); 128 path = btrfs_alloc_path();
131 data_size = sizeof(*dir_item) + name_len; 129 data_size = sizeof(*dir_item) + name_len;
132 dir_item = insert_with_overflow(trans, root, path, &key, data_size, 130 dir_item = insert_with_overflow(trans, root, path, &key, data_size,
@@ -199,8 +197,7 @@ struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
199 key.objectid = dir; 197 key.objectid = dir;
200 btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY); 198 btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY);
201 199
202 ret = btrfs_name_hash(name, name_len, &key.offset); 200 key.offset = btrfs_name_hash(name, name_len);
203 BUG_ON(ret);
204 201
205 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow); 202 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
206 if (ret < 0) 203 if (ret < 0)
@@ -261,8 +258,7 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,
261 258
262 key.objectid = dir; 259 key.objectid = dir;
263 btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY); 260 btrfs_set_key_type(&key, BTRFS_XATTR_ITEM_KEY);
264 ret = btrfs_name_hash(name, name_len, &key.offset); 261 key.offset = btrfs_name_hash(name, name_len);
265 BUG_ON(ret);
266 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow); 262 ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow);
267 if (ret < 0) 263 if (ret < 0)
268 return ERR_PTR(ret); 264 return ERR_PTR(ret);