diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-07-04 08:19:21 -0700 | 
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-07-04 08:19:21 -0700 | 
| commit | c318a821b9828ef3be97d5d896d146e7daa43c86 (patch) | |
| tree | 7ed40911ffebcbabf87ec4be692f6fb154053687 /fs/btrfs/extent-tree.c | |
| parent | 322832f2f19e04c866a0ce4bdac8cff8e695f2b3 (diff) | |
| parent | a99cde438de0c4c0cecc1d1af1a55a75b10bfdef (diff) | |
Merge 4.7-rc6 into usb-next
We want the USB fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/btrfs/extent-tree.c')
| -rw-r--r-- | fs/btrfs/extent-tree.c | 15 | 
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 29e5d000bbee..82b912a293ab 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -2835,6 +2835,7 @@ int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,  struct async_delayed_refs {  	struct btrfs_root *root; +	u64 transid;  	int count;  	int error;  	int sync; @@ -2850,6 +2851,10 @@ static void delayed_ref_async_start(struct btrfs_work *work)  	async = container_of(work, struct async_delayed_refs, work); +	/* if the commit is already started, we don't need to wait here */ +	if (btrfs_transaction_blocked(async->root->fs_info)) +		goto done; +  	trans = btrfs_join_transaction(async->root);  	if (IS_ERR(trans)) {  		async->error = PTR_ERR(trans); @@ -2861,10 +2866,15 @@ static void delayed_ref_async_start(struct btrfs_work *work)  	 * wait on delayed refs  	 */  	trans->sync = true; + +	/* Don't bother flushing if we got into a different transaction */ +	if (trans->transid > async->transid) +		goto end; +  	ret = btrfs_run_delayed_refs(trans, async->root, async->count);  	if (ret)  		async->error = ret; - +end:  	ret = btrfs_end_transaction(trans, async->root);  	if (ret && !async->error)  		async->error = ret; @@ -2876,7 +2886,7 @@ done:  }  int btrfs_async_run_delayed_refs(struct btrfs_root *root, -				 unsigned long count, int wait) +				 unsigned long count, u64 transid, int wait)  {  	struct async_delayed_refs *async;  	int ret; @@ -2888,6 +2898,7 @@ int btrfs_async_run_delayed_refs(struct btrfs_root *root,  	async->root = root->fs_info->tree_root;  	async->count = count;  	async->error = 0; +	async->transid = transid;  	if (wait)  		async->sync = 1;  	else  | 
