#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/fs.h>
-#include <linux/workqueue.h>
#include <linux/completion.h>
#include <linux/backing-dev.h>
#include <asm/kmap_types.h>
struct btrfs_path {
struct extent_buffer *nodes[BTRFS_MAX_LEVEL];
int slots[BTRFS_MAX_LEVEL];
+ /* if there is real range locking, this locks field will change */
+ int locks[BTRFS_MAX_LEVEL];
int reada;
+ /* keep some upper locks as we walk down */
+ int keep_locks;
+ int skip_locking;
int lowest_level;
};
struct backing_dev_info bdi;
spinlock_t hash_lock;
struct mutex trans_mutex;
- struct mutex fs_mutex;
+ struct mutex transaction_kthread_mutex;
+ struct mutex cleaner_mutex;
+ struct mutex alloc_mutex;
+ struct mutex chunk_mutex;
+ struct mutex drop_mutex;
+ struct mutex volume_mutex;
struct list_head trans_list;
struct list_head hashers;
struct list_head dead_roots;
- struct list_head end_io_work_list;
- struct work_struct end_io_work;
- spinlock_t end_io_work_lock;
atomic_t nr_async_submits;
/*
* can run with FS locks held, and the writers may be waiting for
* those locks. We don't want ordering in the pending list to cause
* deadlocks, and so the two are serviced separately.
+ *
+ * A third pool does submit_bio to avoid deadlocking with the other
+ * two
*/
struct btrfs_workers workers;
struct btrfs_workers endio_workers;
+ struct btrfs_workers submit_workers;
+ struct task_struct *transaction_kthread;
+ struct task_struct *cleaner_kthread;
+ int thread_pool_size;
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,18)
- struct work_struct trans_work;
-#else
- struct delayed_work trans_work;
-#endif
struct kobject super_kobj;
struct completion kobj_unregister;
int do_barriers;
int closing;
- unsigned long throttles;
+ atomic_t throttles;
u64 total_pinned;
struct list_head dirty_cowonly_roots;
*/
struct btrfs_root {
struct extent_buffer *node;
+
+ /* the node lock is held while changing the node pointer */
+ spinlock_t node_lock;
+
struct extent_buffer *commit_root;
struct btrfs_root_item root_item;
struct btrfs_key root_key;
struct inode *inode;
struct kobject root_kobj;
struct completion kobj_unregister;
+ struct mutex objectid_mutex;
u64 objectid;
u64 last_trans;
u64 last_inode_alloc;
int ref_cows;
int track_dirty;
+ u64 defrag_trans_start;
struct btrfs_key defrag_progress;
struct btrfs_key defrag_max;
int defrag_running;
struct btrfs_block_group_cache
*hint, u64 search_start,
int data, int owner);
-int btrfs_inc_root_ref(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u64 owner_objectid);
struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u32 size,
- u64 root_objectid,
- u64 hint, u64 empty_size);
-struct extent_buffer *__btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
u32 blocksize,
u64 root_objectid,
int level,
u64 hint,
u64 empty_size);
-int btrfs_grow_extent_tree(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u64 new_size);
int btrfs_shrink_extent_tree(struct btrfs_root *root, u64 new_size);
int btrfs_insert_extent_backref(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
int btrfs_previous_item(struct btrfs_root *root,
struct btrfs_path *path, u64 min_objectid,
int type);
+
+struct extent_buffer *btrfs_root_node(struct btrfs_root *root);
+struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root);
+int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path,
+ struct btrfs_key *key, int lowest_level,
+ int cache_only, u64 min_trans);
+int btrfs_search_forward(struct btrfs_root *root, struct btrfs_key *min_key,
+ struct btrfs_path *path, int cache_only,
+ u64 min_trans);
+
int btrfs_cow_block(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct extent_buffer *buf,
struct extent_buffer *parent, int parent_slot,
struct btrfs_root *root, struct btrfs_path *path,
u64 isize);
/* inode.c */
+int btrfs_create_subvol_root(struct btrfs_root *new_root,
+ struct btrfs_trans_handle *trans, u64 new_dirid,
+ struct btrfs_block_group_cache *block_group);
+
void btrfs_invalidate_dcache_root(struct btrfs_root *root, char *name,
int namelen);
int btrfs_init_cachep(void);
void btrfs_destroy_cachep(void);
long btrfs_ioctl_trans_end(struct file *file);
-long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
struct inode *btrfs_iget_locked(struct super_block *s, u64 objectid,
struct btrfs_root *root);
struct inode *btrfs_ilookup(struct super_block *s, u64 objectid,
int btrfs_update_inode(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct inode *inode);
+
+/* ioctl.c */
+long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
+
/* file.c */
int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end);
int btrfs_check_file(struct btrfs_root *root, struct inode *inode);