diff --git a/ctree.h b/ctree.h index fb1f5d51..5cf28be9 100644 --- a/ctree.h +++ b/ctree.h @@ -223,6 +223,7 @@ struct btrfs_file_extent_item { } __attribute__ ((__packed__)); struct btrfs_csum_item { + __le64 extent_offset; u8 csum[BTRFS_CSUM_SIZE]; } __attribute__ ((__packed__)); @@ -911,6 +912,17 @@ static inline void btrfs_set_file_extent_num_blocks(struct e->num_blocks = cpu_to_le64(val); } +static inline u64 btrfs_csum_extent_offset(struct btrfs_csum_item *c) +{ + return le64_to_cpu(c->extent_offset); +} + +static inline void btrfs_set_csum_extent_offset(struct btrfs_csum_item *c, + u64 val) +{ + c->extent_offset = cpu_to_le64(val); +} + static inline u16 btrfs_device_pathlen(struct btrfs_device_item *d) { return le16_to_cpu(d->pathlen); diff --git a/print-tree.c b/print-tree.c index 0250d333..2fac77ef 100644 --- a/print-tree.c +++ b/print-tree.c @@ -16,6 +16,7 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) struct btrfs_device_item *devi; struct btrfs_inode_item *ii; struct btrfs_file_extent_item *fi; + struct btrfs_csum_item *ci; char *p; u32 type; @@ -76,6 +77,11 @@ void btrfs_print_leaf(struct btrfs_root *root, struct btrfs_leaf *l) printf("\t\textent data refs %u\n", btrfs_extent_refs(ei)); break; + case BTRFS_CSUM_ITEM_KEY: + ci = btrfs_item_ptr(l, i, + struct btrfs_csum_item); + printf("\t\tcsum item\n"); + break; case BTRFS_EXTENT_DATA_KEY: fi = btrfs_item_ptr(l, i, struct btrfs_file_extent_item);