Btrfs: change around extent-tree prealloc
[deliverable/linux.git] / fs / btrfs / ctree.h
index f1800008be34d1b29b4116d39288268eff2d8250..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 {
@@ -185,11 +187,6 @@ struct btrfs_inode_item {
        struct btrfs_inode_timespec otime;
 } __attribute__ ((__packed__));
 
-/* inline data is just a blob of bytes */
-struct btrfs_inline_data_item {
-       u8 data;
-} __attribute__ ((__packed__));
-
 struct btrfs_dir_item {
        struct btrfs_disk_key location;
        __le16 flags;
@@ -247,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;
@@ -261,15 +263,16 @@ struct btrfs_fs_info {
        struct inode *btree_inode;
        struct mutex trans_mutex;
        struct mutex fs_mutex;
+       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;
@@ -293,9 +296,6 @@ struct btrfs_root {
 #define BTRFS_KEY_TYPE_MASK    (((u32)BTRFS_KEY_TYPE_MAX - 1) << \
                                  BTRFS_KEY_TYPE_SHIFT)
 
-#define BTRFS_KEY_OVERFLOW_MAX 128
-#define BTRFS_KEY_OVERFLOW_MASK ((u32)BTRFS_KEY_OVERFLOW_MAX - 1)
-
 /*
  * inode items have the data typically returned from stat and store other
  * info about object characteristics.  There is one for every file and dir in
@@ -479,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)
 {
@@ -621,31 +632,6 @@ static inline void btrfs_set_key_type(struct btrfs_key *key, u32 val)
        key->flags = (key->flags & ~(BTRFS_KEY_TYPE_MASK)) | val;
 }
 
-static inline u32 btrfs_key_overflow(struct btrfs_key *key)
-{
-       return key->flags & BTRFS_KEY_OVERFLOW_MASK;
-}
-
-static inline void btrfs_set_key_overflow(struct btrfs_key *key, u32 over)
-{
-       BUG_ON(over >= BTRFS_KEY_OVERFLOW_MAX);
-       key->flags = (key->flags & ~BTRFS_KEY_OVERFLOW_MASK) | over;
-}
-
-static inline u32 btrfs_disk_key_overflow(struct btrfs_disk_key *key)
-{
-       return le32_to_cpu(key->flags) & BTRFS_KEY_OVERFLOW_MASK;
-}
-
-static inline void btrfs_set_disk_key_overflow(struct btrfs_disk_key *key,
-                                              u32 over)
-{
-       u32 flags = btrfs_disk_key_flags(key);
-       BUG_ON(over >= BTRFS_KEY_OVERFLOW_MAX);
-       flags = (flags & ~BTRFS_KEY_OVERFLOW_MASK) | over;
-       btrfs_set_disk_key_flags(key, flags);
-}
-
 static inline u64 btrfs_header_blocknr(struct btrfs_header *h)
 {
        return le64_to_cpu(h->blocknr);
@@ -667,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);
@@ -1027,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
@@ -1079,15 +1077,24 @@ int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct
 int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
                          *root, const char *name, int name_len, u64 dir,
                          struct btrfs_key *location, u8 type);
-int btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
-                         *root, struct btrfs_path *path, u64 dir,
-                         const char *name, int name_len, int mod);
-int btrfs_lookup_dir_index_item(struct btrfs_trans_handle *trans,
-                               struct btrfs_root *root,
-                               struct btrfs_path *path, u64 dir,
-                               u64 objectid, int mod);
-int btrfs_match_dir_item_name(struct btrfs_root *root, struct btrfs_path *path,
+struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans,
+                                            struct btrfs_root *root,
+                                            struct btrfs_path *path, u64 dir,
+                                            const char *name, int name_len,
+                                            int mod);
+struct btrfs_dir_item *
+btrfs_lookup_dir_index_item(struct btrfs_trans_handle *trans,
+                           struct btrfs_root *root,
+                           struct btrfs_path *path, u64 dir,
+                           u64 objectid, const char *name, int name_len,
+                           int mod);
+struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root,
+                             struct btrfs_path *path,
                              const char *name, int name_len);
+int btrfs_delete_one_dir_name(struct btrfs_trans_handle *trans,
+                             struct btrfs_root *root,
+                             struct btrfs_path *path,
+                             struct btrfs_dir_item *di);
 /* inode-map.c */
 int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
                             struct btrfs_root *fs_root,
This page took 0.031233 seconds and 5 git commands to generate.