Btrfs: node->blockptrs endian fixes
Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index b03df15..a8454c4 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -128,7 +128,7 @@
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 @@
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);