#include <linux/fs.h>
#include <linux/buffer_head.h>
-#include <linux/kobject.h>
+#include <linux/workqueue.h>
#include "bit-radix.h"
struct btrfs_trans_handle;
/* 32 bytes in various csum fields */
#define BTRFS_CSUM_SIZE 32
+/* four bytes for CRC32 */
+#define BTRFS_CRC32_SIZE 4
+#define BTRFS_EMPTY_DIR_SIZE 6
+
+#define BTRFS_FT_UNKNOWN 0
+#define BTRFS_FT_REG_FILE 1
+#define BTRFS_FT_DIR 2
+#define BTRFS_FT_CHRDEV 3
+#define BTRFS_FT_BLKDEV 4
+#define BTRFS_FT_FIFO 5
+#define BTRFS_FT_SOCK 6
+#define BTRFS_FT_SYMLINK 7
+#define BTRFS_FT_MAX 8
/*
* the key defines the order in the tree, and so it also defines (optimal)
} __attribute__ ((__packed__));
struct btrfs_csum_item {
- u8 csum[BTRFS_CSUM_SIZE];
+ u8 csum;
} __attribute__ ((__packed__));
struct btrfs_device_item {
/* tag for the radix tree of block groups in ram */
#define BTRFS_BLOCK_GROUP_DIRTY 0
#define BTRFS_BLOCK_GROUP_AVAIL 1
-#define BTRFS_BLOCK_GROUP_HINTS 8
#define BTRFS_BLOCK_GROUP_SIZE (256 * 1024 * 1024)
+
+
+#define BTRFS_BLOCK_GROUP_DATA 1
struct btrfs_block_group_item {
__le64 used;
+ u8 flags;
} __attribute__ ((__packed__));
struct btrfs_block_group_cache {
struct btrfs_key key;
struct btrfs_block_group_item item;
+ struct radix_tree_root *radix;
u64 first_free;
u64 last_alloc;
u64 pinned;
+ u64 last_prealloc;
int data;
+ int cached;
};
struct crypto_hash;
+
struct btrfs_fs_info {
+ spinlock_t hash_lock;
struct btrfs_root *extent_root;
struct btrfs_root *tree_root;
struct btrfs_root *dev_root;
struct radix_tree_root dev_radix;
struct radix_tree_root block_group_radix;
struct radix_tree_root block_group_data_radix;
+ struct radix_tree_root extent_map_radix;
u64 extent_tree_insert[BTRFS_MAX_LEVEL * 3];
int extent_tree_insert_nr;
struct mutex trans_mutex;
struct mutex fs_mutex;
struct list_head trans_list;
+ struct list_head dead_roots;
struct crypto_hash *hash_tfm;
- spinlock_t hash_lock;
+ struct delayed_work trans_work;
int do_barriers;
- struct kobject kobj;
+ int closing;
};
/*
struct btrfs_block_group_cache *btrfs_find_block_group(struct btrfs_root *root,
struct btrfs_block_group_cache
*hint, u64 search_start,
- int data);
+ int data, int owner);
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,
int btrfs_insert_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
u64 objectid, u64 pos, u64 offset,
+ u64 disk_num_blocks,
u64 num_blocks);
int btrfs_lookup_file_extent(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_path *path,
u64 objectid, u64 offset,
int cow);
+int btrfs_csum_truncate(struct btrfs_trans_handle *trans,
+ struct btrfs_root *root, struct btrfs_path *path,
+ u64 isize);
/* super.c */
-extern struct subsystem btrfs_subsys;
-
#endif