aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 8a329d3901a2..f1800008be34 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -73,6 +73,9 @@ struct btrfs_header {
73 (sizeof(struct btrfs_disk_key) + sizeof(u64))) 73 (sizeof(struct btrfs_disk_key) + sizeof(u64)))
74#define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header)) 74#define __BTRFS_LEAF_DATA_SIZE(bs) ((bs) - sizeof(struct btrfs_header))
75#define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->blocksize)) 75#define BTRFS_LEAF_DATA_SIZE(r) (__BTRFS_LEAF_DATA_SIZE(r->blocksize))
76#define BTRFS_MAX_INLINE_DATA_SIZE(r) (BTRFS_LEAF_DATA_SIZE(r) - \
77 sizeof(struct btrfs_item) - \
78 sizeof(struct btrfs_file_extent_item))
76 79
77struct buffer_head; 80struct buffer_head;
78/* 81/*
@@ -204,8 +207,12 @@ struct btrfs_root_item {
204 __le32 refs; 207 __le32 refs;
205} __attribute__ ((__packed__)); 208} __attribute__ ((__packed__));
206 209
210#define BTRFS_FILE_EXTENT_REG 0
211#define BTRFS_FILE_EXTENT_INLINE 1
212
207struct btrfs_file_extent_item { 213struct btrfs_file_extent_item {
208 __le64 generation; 214 __le64 generation;
215 u8 type;
209 /* 216 /*
210 * disk space consumed by the extent, checksum blocks are included 217 * disk space consumed by the extent, checksum blocks are included
211 * in these numbers 218 * in these numbers
@@ -862,6 +869,34 @@ static inline u8 *btrfs_leaf_data(struct btrfs_leaf *l)
862 return (u8 *)l->items; 869 return (u8 *)l->items;
863} 870}
864 871
872static inline int btrfs_file_extent_type(struct btrfs_file_extent_item *e)
873{
874 return e->type;
875}
876static inline void btrfs_set_file_extent_type(struct btrfs_file_extent_item *e,
877 u8 val)
878{
879 e->type = val;
880}
881
882static inline char *btrfs_file_extent_inline_start(struct
883 btrfs_file_extent_item *e)
884{
885 return (char *)(&e->disk_blocknr);
886}
887
888static inline u32 btrfs_file_extent_calc_inline_size(u32 datasize)
889{
890 return (unsigned long)(&((struct
891 btrfs_file_extent_item *)NULL)->disk_blocknr) + datasize;
892}
893
894static inline u32 btrfs_file_extent_inline_len(struct btrfs_item *e)
895{
896 struct btrfs_file_extent_item *fe = NULL;
897 return btrfs_item_size(e) - (unsigned long)(&fe->disk_blocknr);
898}
899
865static inline u64 btrfs_file_extent_disk_blocknr(struct btrfs_file_extent_item 900static inline u64 btrfs_file_extent_disk_blocknr(struct btrfs_file_extent_item
866 *e) 901 *e)
867{ 902{