summaryrefslogtreecommitdiff
path: root/fs/jfs/jfs_xtree.h
diff options
context:
space:
mode:
authorAl Viro <viro@ZenIV.linux.org.uk>2014-12-19 06:51:26 +0000
committerDave Kleikamp <dave.kleikamp@oracle.com>2014-12-23 17:01:24 -0600
commite1f1fe798d2f2eab904624125ba924d08205f960 (patch)
tree7da293aa0c88034b38b03afeb7e46823a7f87751 /fs/jfs/jfs_xtree.h
parent53262d12d1658669029ab39a63e3d314108abe66 (diff)
jfs: get rid of homegrown endianness helpers
Get rid of le24 stuff, along with the bitfields use - all that stuff can be done with standard stuff, in sparse-verifiable manner. Moreover, that way (shift-and-mask) often generates better code - gcc optimizer sucks on bitfields... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com> ----
Diffstat (limited to 'fs/jfs/jfs_xtree.h')
-rw-r--r--fs/jfs/jfs_xtree.h25
1 files changed, 9 insertions, 16 deletions
diff --git a/fs/jfs/jfs_xtree.h b/fs/jfs/jfs_xtree.h
index 08c0c749b986..1e0987986d5f 100644
--- a/fs/jfs/jfs_xtree.h
+++ b/fs/jfs/jfs_xtree.h
@@ -29,13 +29,11 @@
* extent allocation descriptor (xad)
*/
typedef struct xad {
- unsigned flag:8; /* 1: flag */
- unsigned rsvrd:16; /* 2: reserved */
- unsigned off1:8; /* 1: offset in unit of fsblksize */
- __le32 off2; /* 4: offset in unit of fsblksize */
- unsigned len:24; /* 3: length in unit of fsblksize */
- unsigned addr1:8; /* 1: address in unit of fsblksize */
- __le32 addr2; /* 4: address in unit of fsblksize */
+ __u8 flag; /* 1: flag */
+ __u8 rsvrd[2]; /* 2: reserved */
+ __u8 off1; /* 1: offset in unit of fsblksize */
+ __le32 off2; /* 4: offset in unit of fsblksize */
+ pxd_t loc; /* 8: length and address in unit of fsblksize */
} xad_t; /* (16) */
#define MAXXLEN ((1 << 24) - 1)
@@ -49,19 +47,14 @@ typedef struct xad {
(xad)->off1 = ((u64)offset64) >> 32;\
(xad)->off2 = __cpu_to_le32((offset64) & 0xffffffff);\
}
-#define XADaddress(xad, address64)\
-{\
- (xad)->addr1 = ((u64)address64) >> 32;\
- (xad)->addr2 = __cpu_to_le32((address64) & 0xffffffff);\
-}
-#define XADlength(xad, length32) (xad)->len = __cpu_to_le24(length32)
+#define XADaddress(xad, address64) PXDaddress(&(xad)->loc, address64)
+#define XADlength(xad, length32) PXDlength(&(xad)->loc, length32)
/* xad_t field extraction */
#define offsetXAD(xad)\
( ((s64)((xad)->off1)) << 32 | __le32_to_cpu((xad)->off2))
-#define addressXAD(xad)\
- ( ((s64)((xad)->addr1)) << 32 | __le32_to_cpu((xad)->addr2))
-#define lengthXAD(xad) __le24_to_cpu((xad)->len)
+#define addressXAD(xad) addressPXD(&(xad)->loc)
+#define lengthXAD(xad) lengthPXD(&(xad)->loc)
/* xad list */
struct xadlist {