aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@www.linux.org.uk>2005-05-01 11:59:17 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 11:59:17 -0400
commit6a3a16f2ef6f335286e2b2bf8284b0ab4ff38ec0 (patch)
treeae559ba5915bf0ca29d6d5dfbd9f44e666f388ea
parentd46aa455dd5457fdbebad17db4ff4df655cbfbae (diff)
[PATCH] reiserfs endianness: clone struct reiserfs_key
struct reiserfs_key cloned; (currently) identical struct in_core_key added. Places that expect host-endian data in reiserfs_key switched to in_core_key. Basically, we get annotation of reiserfs_key users and keep the resulting tree obviously equivalent to original. Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk> Cc: <reiserfs-dev@namesys.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/reiserfs/bitmap.c4
-rw-r--r--fs/reiserfs/stree.c1
-rw-r--r--fs/reiserfs/super.c4
-rw-r--r--include/linux/reiserfs_fs.h32
4 files changed, 34 insertions, 7 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c
index a4e2ed544bbe..f4f16fada14c 100644
--- a/fs/reiserfs/bitmap.c
+++ b/fs/reiserfs/bitmap.c
@@ -736,7 +736,7 @@ static inline int this_blocknr_allocation_would_make_it_a_large_file(reiserfs_bl
736#ifdef DISPLACE_NEW_PACKING_LOCALITIES 736#ifdef DISPLACE_NEW_PACKING_LOCALITIES
737static inline void displace_new_packing_locality (reiserfs_blocknr_hint_t *hint) 737static inline void displace_new_packing_locality (reiserfs_blocknr_hint_t *hint)
738{ 738{
739 struct reiserfs_key * key = &hint->key; 739 struct in_core_key * key = &hint->key;
740 740
741 hint->th->displace_new_blocks = 0; 741 hint->th->displace_new_blocks = 0;
742 hint->search_start = hint->beg + keyed_hash((char*)(&key->k_objectid),4) % (hint->end - hint->beg); 742 hint->search_start = hint->beg + keyed_hash((char*)(&key->k_objectid),4) % (hint->end - hint->beg);
@@ -777,7 +777,7 @@ static inline int old_way (reiserfs_blocknr_hint_t * hint)
777 777
778static inline void hundredth_slices (reiserfs_blocknr_hint_t * hint) 778static inline void hundredth_slices (reiserfs_blocknr_hint_t * hint)
779{ 779{
780 struct reiserfs_key * key = &hint->key; 780 struct in_core_key * key = &hint->key;
781 b_blocknr_t slice_start; 781 b_blocknr_t slice_start;
782 782
783 slice_start = (keyed_hash((char*)(&key->k_dir_id),4) % 100) * (hint->end / 100); 783 slice_start = (keyed_hash((char*)(&key->k_dir_id),4) % 100) * (hint->end / 100);
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 73ec5212178b..1d380a5da39c 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -229,6 +229,7 @@ const struct reiserfs_key MIN_KEY = {0, 0, {{0, 0},}};
229 229
230/* Maximal possible key. It is never in the tree. */ 230/* Maximal possible key. It is never in the tree. */
231const struct reiserfs_key MAX_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}}; 231const struct reiserfs_key MAX_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}};
232const struct in_core_key MAX_IN_CORE_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}};
232 233
233 234
234/* Get delimiting key of the buffer by looking for it in the buffers in the path, starting from the bottom 235/* Get delimiting key of the buffer by looking for it in the buffers in the path, starting from the bottom
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index bc5e8893b5d5..d6d1d7e2801f 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -110,7 +110,7 @@ static void reiserfs_unlockfs(struct super_block *s) {
110 reiserfs_allow_writes(s) ; 110 reiserfs_allow_writes(s) ;
111} 111}
112 112
113extern const struct reiserfs_key MAX_KEY; 113extern const struct in_core_key MAX_IN_CORE_KEY;
114 114
115 115
116/* this is used to delete "save link" when there are no items of a 116/* this is used to delete "save link" when there are no items of a
@@ -164,7 +164,7 @@ static int finish_unfinished (struct super_block * s)
164 164
165 /* compose key to look for "save" links */ 165 /* compose key to look for "save" links */
166 max_cpu_key.version = KEY_FORMAT_3_5; 166 max_cpu_key.version = KEY_FORMAT_3_5;
167 max_cpu_key.on_disk_key = MAX_KEY; 167 max_cpu_key.on_disk_key = MAX_IN_CORE_KEY;
168 max_cpu_key.key_length = 3; 168 max_cpu_key.key_length = 3;
169 169
170#ifdef CONFIG_QUOTA 170#ifdef CONFIG_QUOTA
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index bccff8b17dc4..d0867873a1b5 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -433,6 +433,23 @@ static inline void set_offset_v2_k_offset( struct offset_v2 *v2, loff_t offset )
433# define set_offset_v2_k_offset(v2,val) (offset_v2_k_offset(v2) = (val)) 433# define set_offset_v2_k_offset(v2,val) (offset_v2_k_offset(v2) = (val))
434#endif 434#endif
435 435
436struct in_core_offset_v1 {
437 __u32 k_offset;
438 __u32 k_uniqueness;
439} __attribute__ ((__packed__));
440
441struct in_core_offset_v2 {
442#ifdef __LITTLE_ENDIAN
443 /* little endian version */
444 __u64 k_offset:60;
445 __u64 k_type: 4;
446#else
447 /* big endian version */
448 __u64 k_type: 4;
449 __u64 k_offset:60;
450#endif
451} __attribute__ ((__packed__));
452
436/* Key of an item determines its location in the S+tree, and 453/* Key of an item determines its location in the S+tree, and
437 is composed of 4 components */ 454 is composed of 4 components */
438struct reiserfs_key { 455struct reiserfs_key {
@@ -445,9 +462,18 @@ struct reiserfs_key {
445 } __attribute__ ((__packed__)) u; 462 } __attribute__ ((__packed__)) u;
446} __attribute__ ((__packed__)); 463} __attribute__ ((__packed__));
447 464
465struct in_core_key {
466 __u32 k_dir_id; /* packing locality: by default parent
467 directory object id */
468 __u32 k_objectid; /* object identifier */
469 union {
470 struct in_core_offset_v1 k_offset_v1;
471 struct in_core_offset_v2 k_offset_v2;
472 } __attribute__ ((__packed__)) u;
473} __attribute__ ((__packed__));
448 474
449struct cpu_key { 475struct cpu_key {
450 struct reiserfs_key on_disk_key; 476 struct in_core_key on_disk_key;
451 int version; 477 int version;
452 int key_length; /* 3 in all cases but direct2indirect and 478 int key_length; /* 3 in all cases but direct2indirect and
453 indirect2direct conversion */ 479 indirect2direct conversion */
@@ -1476,7 +1502,7 @@ struct tree_balance
1476 int fs_gen; /* saved value of `reiserfs_generation' counter 1502 int fs_gen; /* saved value of `reiserfs_generation' counter
1477 see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */ 1503 see FILESYSTEM_CHANGED() macro in reiserfs_fs.h */
1478#ifdef DISPLACE_NEW_PACKING_LOCALITIES 1504#ifdef DISPLACE_NEW_PACKING_LOCALITIES
1479 struct reiserfs_key key; /* key pointer, to pass to block allocator or 1505 struct in_core_key key; /* key pointer, to pass to block allocator or
1480 another low-level subsystem */ 1506 another low-level subsystem */
1481#endif 1507#endif
1482} ; 1508} ;
@@ -2117,7 +2143,7 @@ struct buffer_head * get_FEB (struct tree_balance *);
2117 struct __reiserfs_blocknr_hint { 2143 struct __reiserfs_blocknr_hint {
2118 struct inode * inode; /* inode passed to allocator, if we allocate unf. nodes */ 2144 struct inode * inode; /* inode passed to allocator, if we allocate unf. nodes */
2119 long block; /* file offset, in blocks */ 2145 long block; /* file offset, in blocks */
2120 struct reiserfs_key key; 2146 struct in_core_key key;
2121 struct path * path; /* search path, used by allocator to deternine search_start by 2147 struct path * path; /* search path, used by allocator to deternine search_start by
2122 * various ways */ 2148 * various ways */
2123 struct reiserfs_transaction_handle * th; /* transaction handle is needed to log super blocks and 2149 struct reiserfs_transaction_handle * th; /* transaction handle is needed to log super blocks and