Btrfs: node->blockptrs endian fixes

Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
Chris Mason
2007-03-13 09:28:32 -04:00
committed by David Woodhouse
parent 0783fcfc4d
commit 1d4f8a0c1e
4 changed files with 33 additions and 18 deletions

View File

@@ -128,7 +128,7 @@ struct leaf {
struct node {
struct btrfs_header header;
struct btrfs_disk_key keys[NODEPTRS_PER_BLOCK];
u64 blockptrs[NODEPTRS_PER_BLOCK];
__le64 blockptrs[NODEPTRS_PER_BLOCK];
} __attribute__ ((__packed__));
/*
@@ -153,6 +153,16 @@ struct ctree_path {
int slots[MAX_LEVEL];
};
static inline u64 btrfs_node_blockptr(struct node *n, int nr)
{
return le64_to_cpu(n->blockptrs[nr]);
}
static inline void btrfs_set_node_blockptr(struct node *n, int nr, u64 val)
{
n->blockptrs[nr] = cpu_to_le64(val);
}
static inline u16 btrfs_item_offset(struct btrfs_item *item)
{
return le16_to_cpu(item->offset);