]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/btrfs/ctree.h
Btrfs: get forced transaction commits via workqueue
[mv-sheeva.git] / fs / btrfs / ctree.h
index 086e7dea3c92bb0aee92f2ccf12a7ec428c1fa98..e93ba1a5c812ced98c089a21b0347f9e4c2f6a3e 100644 (file)
@@ -3,7 +3,7 @@
 
 #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;
@@ -30,6 +30,19 @@ extern struct kmem_cache *btrfs_path_cachep;
 
 /* 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)
@@ -235,7 +248,7 @@ struct btrfs_file_extent_item {
 } __attribute__ ((__packed__));
 
 struct btrfs_csum_item {
-       u8 csum[BTRFS_CSUM_SIZE];
+       u8 csum;
 } __attribute__ ((__packed__));
 
 struct btrfs_device_item {
@@ -246,23 +259,31 @@ 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;
@@ -272,6 +293,7 @@ struct btrfs_fs_info {
        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;
@@ -287,10 +309,11 @@ struct btrfs_fs_info {
        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;
 };
 
 /*
@@ -1075,7 +1098,7 @@ static inline void btrfs_mark_buffer_dirty(struct buffer_head *bh)
 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,
@@ -1173,6 +1196,7 @@ int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root
 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,
@@ -1190,7 +1214,8 @@ struct btrfs_csum_item *btrfs_lookup_csum(struct btrfs_trans_handle *trans,
                                          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