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;
*/
struct btrfs_extent_item {
__le32 refs;
+ __le64 owner;
} __attribute__ ((__packed__));
struct btrfs_inode_timespec {
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;
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;
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;
#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
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)
{
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);
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);
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
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,