summaryrefslogtreecommitdiff
path: root/ctree.h
diff options
context:
space:
mode:
Diffstat (limited to 'ctree.h')
-rw-r--r--ctree.h69
1 files changed, 64 insertions, 5 deletions
diff --git a/ctree.h b/ctree.h
index 8d4ba19d..edd965f3 100644
--- a/ctree.h
+++ b/ctree.h
@@ -9,10 +9,11 @@ struct btrfs_trans_handle;
#define BTRFS_MAGIC "_BtRfS_M"
#define BTRFS_ROOT_TREE_OBJECTID 1ULL
-#define BTRFS_EXTENT_TREE_OBJECTID 2ULL
-#define BTRFS_FS_TREE_OBJECTID 3ULL
-#define BTRFS_ROOT_TREE_DIR_OBJECTID 4ULL
-#define BTRFS_FIRST_FREE_OBJECTID 5ULL
+#define BTRFS_DEV_TREE_OBJECTID 2ULL
+#define BTRFS_EXTENT_TREE_OBJECTID 3ULL
+#define BTRFS_FS_TREE_OBJECTID 4ULL
+#define BTRFS_ROOT_TREE_DIR_OBJECTID 5ULL
+#define BTRFS_FIRST_FREE_OBJECTID 6ULL
/*
* we can actually store much bigger names, but lets not confuse the rest
@@ -86,6 +87,10 @@ struct btrfs_super_block {
__le64 total_blocks;
__le64 blocks_used;
__le64 root_dir_objectid;
+ /* fields below here vary with the underlying disk */
+ __le64 device_block_start;
+ __le64 device_num_blocks;
+ __le64 device_root;
} __attribute__ ((__packed__));
/*
@@ -219,10 +224,15 @@ struct btrfs_csum_item {
u8 csum[BTRFS_CSUM_SIZE];
} __attribute__ ((__packed__));
+struct btrfs_device_item {
+ __le16 pathlen;
+} __attribute__ ((__packed__));
+
struct btrfs_fs_info {
struct btrfs_root *fs_root;
struct btrfs_root *extent_root;
struct btrfs_root *tree_root;
+ struct btrfs_root *dev_root;
struct btrfs_key current_insert;
struct btrfs_key last_insert;
struct radix_tree_root cache_radix;
@@ -301,10 +311,15 @@ struct btrfs_root {
#define BTRFS_EXTENT_ITEM_KEY 8
/*
+ * dev items list the devices that make up the FS
+ */
+#define BTRFS_DEV_ITEM_KEY 9
+
+/*
* string items are for debugging. They just store a short string of
* data in the FS
*/
-#define BTRFS_STRING_ITEM_KEY 9
+#define BTRFS_STRING_ITEM_KEY 10
static inline u64 btrfs_inode_generation(struct btrfs_inode_item *i)
{
@@ -770,6 +785,39 @@ static inline void btrfs_set_super_root_dir(struct btrfs_super_block *s, u64
s->root_dir_objectid = cpu_to_le64(val);
}
+static inline u64 btrfs_super_device_block_start(struct btrfs_super_block *s)
+{
+ return le64_to_cpu(s->device_block_start);
+}
+
+static inline void btrfs_set_super_device_block_start(struct btrfs_super_block
+ *s, u64 val)
+{
+ s->device_block_start = cpu_to_le64(val);
+}
+
+static inline u64 btrfs_super_device_num_blocks(struct btrfs_super_block *s)
+{
+ return le64_to_cpu(s->device_num_blocks);
+}
+
+static inline void btrfs_set_super_device_num_blocks(struct btrfs_super_block
+ *s, u64 val)
+{
+ s->device_num_blocks = cpu_to_le64(val);
+}
+
+static inline u64 btrfs_super_device_root(struct btrfs_super_block *s)
+{
+ return le64_to_cpu(s->device_root);
+}
+
+static inline void btrfs_set_super_device_root(struct btrfs_super_block
+ *s, u64 val)
+{
+ s->device_root = cpu_to_le64(val);
+}
+
static inline u8 *btrfs_leaf_data(struct btrfs_leaf *l)
{
return (u8 *)l->items;
@@ -837,6 +885,17 @@ static inline void btrfs_set_file_extent_num_blocks(struct
e->num_blocks = cpu_to_le64(val);
}
+static inline u16 btrfs_device_pathlen(struct btrfs_device_item *d)
+{
+ return le16_to_cpu(d->pathlen);
+}
+
+static inline void btrfs_set_device_pathlen(struct btrfs_device_item *d,
+ u16 val)
+{
+ d->pathlen = cpu_to_le16(val);
+}
+
/* helper function to cast into the data area of the leaf. */
#define btrfs_item_ptr(leaf, slot, type) \
((type *)(btrfs_leaf_data(leaf) + \