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.h45
1 files changed, 42 insertions, 3 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 681b23933d9b..78248d577290 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -62,6 +62,7 @@ struct btrfs_header {
62 u8 fsid[16]; /* FS specific uuid */ 62 u8 fsid[16]; /* FS specific uuid */
63 __le64 blocknr; /* which block this node is supposed to live in */ 63 __le64 blocknr; /* which block this node is supposed to live in */
64 __le64 generation; 64 __le64 generation;
65 __le64 owner;
65 __le16 nritems; 66 __le16 nritems;
66 __le16 flags; 67 __le16 flags;
67 u8 level; 68 u8 level;
@@ -151,12 +152,17 @@ struct btrfs_path {
151 int slots[BTRFS_MAX_LEVEL]; 152 int slots[BTRFS_MAX_LEVEL];
152}; 153};
153 154
155/* values for the type field in btrfs_extent_item */
156#define BTRFS_EXTENT_TREE 1
157#define BTRFS_EXTENT_FILE 2
154/* 158/*
155 * items in the extent btree are used to record the objectid of the 159 * items in the extent btree are used to record the objectid of the
156 * owner of the block and the number of references 160 * owner of the block and the number of references
157 */ 161 */
158struct btrfs_extent_item { 162struct btrfs_extent_item {
159 __le32 refs; 163 __le32 refs;
164 __le64 owner;
165 u8 type;
160} __attribute__ ((__packed__)); 166} __attribute__ ((__packed__));
161 167
162struct btrfs_inode_timespec { 168struct btrfs_inode_timespec {
@@ -473,11 +479,32 @@ static inline void btrfs_set_extent_refs(struct btrfs_extent_item *ei, u32 val)
473 ei->refs = cpu_to_le32(val); 479 ei->refs = cpu_to_le32(val);
474} 480}
475 481
482static inline u64 btrfs_extent_owner(struct btrfs_extent_item *ei)
483{
484 return le64_to_cpu(ei->owner);
485}
486
487static inline void btrfs_set_extent_owner(struct btrfs_extent_item *ei, u64 val)
488{
489 ei->owner = cpu_to_le64(val);
490}
491
492static inline u8 btrfs_extent_type(struct btrfs_extent_item *ei)
493{
494 return ei->type;
495}
496
497static inline void btrfs_set_extent_type(struct btrfs_extent_item *ei, u8 val)
498{
499 ei->type = val;
500}
501
476static inline u64 btrfs_node_blockptr(struct btrfs_node *n, int nr) 502static inline u64 btrfs_node_blockptr(struct btrfs_node *n, int nr)
477{ 503{
478 return le64_to_cpu(n->ptrs[nr].blockptr); 504 return le64_to_cpu(n->ptrs[nr].blockptr);
479} 505}
480 506
507
481static inline void btrfs_set_node_blockptr(struct btrfs_node *n, int nr, 508static inline void btrfs_set_node_blockptr(struct btrfs_node *n, int nr,
482 u64 val) 509 u64 val)
483{ 510{
@@ -636,6 +663,17 @@ static inline void btrfs_set_header_generation(struct btrfs_header *h,
636 h->generation = cpu_to_le64(val); 663 h->generation = cpu_to_le64(val);
637} 664}
638 665
666static inline u64 btrfs_header_owner(struct btrfs_header *h)
667{
668 return le64_to_cpu(h->owner);
669}
670
671static inline void btrfs_set_header_owner(struct btrfs_header *h,
672 u64 val)
673{
674 h->owner = cpu_to_le64(val);
675}
676
639static inline u16 btrfs_header_nritems(struct btrfs_header *h) 677static inline u16 btrfs_header_nritems(struct btrfs_header *h)
640{ 678{
641 return le16_to_cpu(h->nritems); 679 return le16_to_cpu(h->nritems);
@@ -996,9 +1034,10 @@ int btrfs_inc_root_ref(struct btrfs_trans_handle *trans,
996 struct btrfs_root *root); 1034 struct btrfs_root *root);
997struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans, 1035struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
998 struct btrfs_root *root); 1036 struct btrfs_root *root);
999int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root 1037int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
1000 *root, u64 num_blocks, u64 search_start, u64 1038 struct btrfs_root *root, u64 owner,
1001 search_end, struct btrfs_key *ins); 1039 u8 type, u64 num_blocks, u64 search_start,
1040 u64 search_end, struct btrfs_key *ins);
1002int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root, 1041int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
1003 struct buffer_head *buf); 1042 struct buffer_head *buf);
1004int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root 1043int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root