Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 165900
b: refs/heads/master
c: 11833d6
h: refs/heads/master
v: v3
  • Loading branch information
Yan Zheng authored and Chris Mason committed Sep 17, 2009
1 parent b99cf3f commit ebdcd44
Show file tree
Hide file tree
Showing 6 changed files with 383 additions and 260 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6e74057c4686dc12ea767b4bdc50a63876056e1c
refs/heads/master: 11833d66be94b514652466802100378046c16b72
29 changes: 20 additions & 9 deletions trunk/fs/btrfs/ctree.h
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,15 @@ enum btrfs_caching_type {
BTRFS_CACHE_FINISHED = 2,
};

struct btrfs_caching_control {
struct list_head list;
struct mutex mutex;
wait_queue_head_t wait;
struct btrfs_block_group_cache *block_group;
u64 progress;
atomic_t count;
};

struct btrfs_block_group_cache {
struct btrfs_key key;
struct btrfs_block_group_item item;
Expand All @@ -742,8 +751,9 @@ struct btrfs_block_group_cache {
int dirty;

/* cache tracking stuff */
wait_queue_head_t caching_q;
int cached;
struct btrfs_caching_control *caching_ctl;
u64 last_byte_to_unpin;

struct btrfs_space_info *space_info;

Expand Down Expand Up @@ -788,7 +798,8 @@ struct btrfs_fs_info {
spinlock_t block_group_cache_lock;
struct rb_root block_group_cache_tree;

struct extent_io_tree pinned_extents;
struct extent_io_tree freed_extents[2];
struct extent_io_tree *pinned_extents;

/* logical->physical extent mapping */
struct btrfs_mapping_tree mapping_tree;
Expand Down Expand Up @@ -825,8 +836,6 @@ struct btrfs_fs_info {
struct mutex drop_mutex;
struct mutex volume_mutex;
struct mutex tree_reloc_mutex;
struct rw_semaphore extent_commit_sem;

/*
* this protects the ordered operations list only while we are
* processing all of the entries on it. This way we make
Expand All @@ -835,10 +844,12 @@ struct btrfs_fs_info {
* before jumping into the main commit.
*/
struct mutex ordered_operations_mutex;
struct rw_semaphore extent_commit_sem;

struct list_head trans_list;
struct list_head hashers;
struct list_head dead_roots;
struct list_head caching_block_groups;

atomic_t nr_async_submits;
atomic_t async_submit_draining;
Expand Down Expand Up @@ -1920,8 +1931,8 @@ void btrfs_put_block_group(struct btrfs_block_group_cache *cache);
int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
struct btrfs_root *root, unsigned long count);
int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len);
int btrfs_update_pinned_extents(struct btrfs_root *root,
u64 bytenr, u64 num, int pin);
int btrfs_pin_extent(struct btrfs_root *root,
u64 bytenr, u64 num, int reserved);
int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct extent_buffer *leaf);
int btrfs_cross_ref_exist(struct btrfs_trans_handle *trans,
Expand Down Expand Up @@ -1971,9 +1982,10 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans,
u64 root_objectid, u64 owner, u64 offset);

int btrfs_free_reserved_extent(struct btrfs_root *root, u64 start, u64 len);
int btrfs_prepare_extent_commit(struct btrfs_trans_handle *trans,
struct btrfs_root *root);
int btrfs_finish_extent_commit(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct extent_io_tree *unpin);
struct btrfs_root *root);
int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
u64 bytenr, u64 num_bytes, u64 parent,
Expand Down Expand Up @@ -2006,7 +2018,6 @@ void btrfs_delalloc_reserve_space(struct btrfs_root *root, struct inode *inode,
u64 bytes);
void btrfs_delalloc_free_space(struct btrfs_root *root, struct inode *inode,
u64 bytes);
void btrfs_free_pinned_extents(struct btrfs_fs_info *info);
/* ctree.c */
int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key,
int level, int *slot);
Expand Down
7 changes: 5 additions & 2 deletions trunk/fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
INIT_LIST_HEAD(&fs_info->hashers);
INIT_LIST_HEAD(&fs_info->delalloc_inodes);
INIT_LIST_HEAD(&fs_info->ordered_operations);
INIT_LIST_HEAD(&fs_info->caching_block_groups);
spin_lock_init(&fs_info->delalloc_lock);
spin_lock_init(&fs_info->new_trans_lock);
spin_lock_init(&fs_info->ref_cache_lock);
Expand Down Expand Up @@ -1621,8 +1622,11 @@ struct btrfs_root *open_ctree(struct super_block *sb,
spin_lock_init(&fs_info->block_group_cache_lock);
fs_info->block_group_cache_tree.rb_node = NULL;

extent_io_tree_init(&fs_info->pinned_extents,
extent_io_tree_init(&fs_info->freed_extents[0],
fs_info->btree_inode->i_mapping, GFP_NOFS);
extent_io_tree_init(&fs_info->freed_extents[1],
fs_info->btree_inode->i_mapping, GFP_NOFS);
fs_info->pinned_extents = &fs_info->freed_extents[0];
fs_info->do_barriers = 1;

BTRFS_I(fs_info->btree_inode)->root = tree_root;
Expand Down Expand Up @@ -2359,7 +2363,6 @@ int close_ctree(struct btrfs_root *root)
free_extent_buffer(root->fs_info->csum_root->commit_root);

btrfs_free_block_groups(root->fs_info);
btrfs_free_pinned_extents(root->fs_info);

del_fs_roots(fs_info);

Expand Down
Loading

0 comments on commit ebdcd44

Please sign in to comment.