diff options
Diffstat (limited to 'fs/btrfs/delayed-ref.h')
| -rw-r--r-- | fs/btrfs/delayed-ref.h | 50 | 
1 files changed, 14 insertions, 36 deletions
diff --git a/fs/btrfs/delayed-ref.h b/fs/btrfs/delayed-ref.h index 70b962cc177..a764e2340d4 100644 --- a/fs/btrfs/delayed-ref.h +++ b/fs/btrfs/delayed-ref.h @@ -52,6 +52,7 @@ struct btrfs_delayed_ref_node {  	unsigned int action:8;  	unsigned int type:8; +	unsigned int no_quota:1;  	/* is this node still in the rbtree? */  	unsigned int is_head:1;  	unsigned int in_tree:1; @@ -81,7 +82,10 @@ struct btrfs_delayed_ref_head {  	 */  	struct mutex mutex; -	struct list_head cluster; +	spinlock_t lock; +	struct rb_root ref_root; + +	struct rb_node href_node;  	struct btrfs_delayed_extent_op *extent_op;  	/* @@ -98,6 +102,7 @@ struct btrfs_delayed_ref_head {  	 */  	unsigned int must_insert_reserved:1;  	unsigned int is_data:1; +	unsigned int processing:1;  };  struct btrfs_delayed_tree_ref { @@ -116,7 +121,8 @@ struct btrfs_delayed_data_ref {  };  struct btrfs_delayed_ref_root { -	struct rb_root root; +	/* head ref rbtree */ +	struct rb_root href_root;  	/* this spin lock protects the rbtree and the entries inside */  	spinlock_t lock; @@ -124,7 +130,7 @@ struct btrfs_delayed_ref_root {  	/* how many delayed ref updates we've queued, used by the  	 * throttling code  	 */ -	unsigned long num_entries; +	atomic_t num_entries;  	/* total number of head nodes in tree */  	unsigned long num_heads; @@ -133,15 +139,6 @@ struct btrfs_delayed_ref_root {  	unsigned long num_heads_ready;  	/* -	 * bumped when someone is making progress on the delayed -	 * refs, so that other procs know they are just adding to -	 * contention intead of helping -	 */ -	atomic_t procs_running_refs; -	atomic_t ref_seq; -	wait_queue_head_t wait; - -	/*  	 * set when the tree is flushing before a transaction commit,  	 * used by the throttling code to decide if new updates need  	 * to be run right away @@ -200,14 +197,14 @@ int btrfs_add_delayed_tree_ref(struct btrfs_fs_info *fs_info,  			       u64 bytenr, u64 num_bytes, u64 parent,  			       u64 ref_root, int level, int action,  			       struct btrfs_delayed_extent_op *extent_op, -			       int for_cow); +			       int no_quota);  int btrfs_add_delayed_data_ref(struct btrfs_fs_info *fs_info,  			       struct btrfs_trans_handle *trans,  			       u64 bytenr, u64 num_bytes,  			       u64 parent, u64 ref_root,  			       u64 owner, u64 offset, int action,  			       struct btrfs_delayed_extent_op *extent_op, -			       int for_cow); +			       int no_quota);  int btrfs_add_delayed_extent_op(struct btrfs_fs_info *fs_info,  				struct btrfs_trans_handle *trans,  				u64 bytenr, u64 num_bytes, @@ -226,34 +223,15 @@ static inline void btrfs_delayed_ref_unlock(struct btrfs_delayed_ref_head *head)  	mutex_unlock(&head->mutex);  } -int btrfs_find_ref_cluster(struct btrfs_trans_handle *trans, -			   struct list_head *cluster, u64 search_start); -void btrfs_release_ref_cluster(struct list_head *cluster); + +struct btrfs_delayed_ref_head * +btrfs_select_ref_head(struct btrfs_trans_handle *trans);  int btrfs_check_delayed_seq(struct btrfs_fs_info *fs_info,  			    struct btrfs_delayed_ref_root *delayed_refs,  			    u64 seq);  /* - * delayed refs with a ref_seq > 0 must be held back during backref walking. - * this only applies to items in one of the fs-trees. for_cow items never need - * to be held back, so they won't get a ref_seq number. - */ -static inline int need_ref_seq(int for_cow, u64 rootid) -{ -	if (for_cow) -		return 0; - -	if (rootid == BTRFS_FS_TREE_OBJECTID) -		return 1; - -	if ((s64)rootid >= (s64)BTRFS_FIRST_FREE_OBJECTID) -		return 1; - -	return 0; -} - -/*   * a node might live in a head or a regular ref, this lets you   * test for the proper type to use.   */  | 
