Btrfs: change around extent-tree prealloc
[deliverable/linux.git] / fs / btrfs / ctree.h
index 047a84762d93035cc47db73dc10874473b4c11ec..26d0cdd46f49b0a647109797caeaf5162b1da563 100644 (file)
@@ -62,6 +62,7 @@ struct btrfs_header {
        u8 fsid[16]; /* FS specific uuid */
        __le64 blocknr; /* which block this node is supposed to live in */
        __le64 generation;
+       __le64 owner;
        __le16 nritems;
        __le16 flags;
        u8 level;
@@ -157,6 +158,7 @@ struct btrfs_path {
  */
 struct btrfs_extent_item {
        __le32 refs;
+       __le64 owner;
 } __attribute__ ((__packed__));
 
 struct btrfs_inode_timespec {
@@ -242,12 +244,17 @@ struct btrfs_fs_info {
        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 fs_roots_radix;
        struct radix_tree_root pending_del_radix;
        struct radix_tree_root pinned_radix;
        struct radix_tree_root dev_radix;
+
+       u64 extent_tree_insert[BTRFS_MAX_LEVEL * 3];
+       int extent_tree_insert_nr;
+       u64 extent_tree_prealloc[BTRFS_MAX_LEVEL * 3];
+       int extent_tree_prealloc_nr;
+
        u64 generation;
        struct btrfs_transaction *running_transaction;
        struct btrfs_super_block *disk_super;
@@ -259,13 +266,13 @@ struct btrfs_fs_info {
        struct list_head trans_list;
        struct crypto_hash *hash_tfm;
        spinlock_t hash_lock;
+       int do_barriers;
        struct kobject kobj;
 };
 
 /*
  * in ram representation of the tree.  extent_root is used for all allocations
- * and for the extent tree extent_root root.  current_insert is used
- * only for the extent tree.
+ * and for the extent tree extent_root root.
  */
 struct btrfs_root {
        struct buffer_head *node;
@@ -472,11 +479,22 @@ static inline void btrfs_set_extent_refs(struct btrfs_extent_item *ei, u32 val)
        ei->refs = cpu_to_le32(val);
 }
 
+static inline u64 btrfs_extent_owner(struct btrfs_extent_item *ei)
+{
+       return le64_to_cpu(ei->owner);
+}
+
+static inline void btrfs_set_extent_owner(struct btrfs_extent_item *ei, u64 val)
+{
+       ei->owner = cpu_to_le64(val);
+}
+
 static inline u64 btrfs_node_blockptr(struct btrfs_node *n, int nr)
 {
        return le64_to_cpu(n->ptrs[nr].blockptr);
 }
 
+
 static inline void btrfs_set_node_blockptr(struct btrfs_node *n, int nr,
                                           u64 val)
 {
@@ -635,6 +653,17 @@ static inline void btrfs_set_header_generation(struct btrfs_header *h,
        h->generation = cpu_to_le64(val);
 }
 
+static inline u64 btrfs_header_owner(struct btrfs_header *h)
+{
+       return le64_to_cpu(h->owner);
+}
+
+static inline void btrfs_set_header_owner(struct btrfs_header *h,
+                                              u64 val)
+{
+       h->owner = cpu_to_le64(val);
+}
+
 static inline u16 btrfs_header_nritems(struct btrfs_header *h)
 {
        return le16_to_cpu(h->nritems);
@@ -995,9 +1024,10 @@ int btrfs_inc_root_ref(struct btrfs_trans_handle *trans,
                       struct btrfs_root *root);
 struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
                                            struct btrfs_root *root);
-int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root
-                       *root, u64 num_blocks, u64 search_start, u64
-                       search_end, struct btrfs_key *ins);
+int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
+                      struct btrfs_root *root, u64 owner,
+                      u64 num_blocks, u64 search_start,
+                      u64 search_end, struct btrfs_key *ins);
 int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                  struct buffer_head *buf);
 int btrfs_free_extent(struct btrfs_trans_handle *trans, struct btrfs_root
This page took 0.031519 seconds and 5 git commands to generate.