Commit f36f3042 authored by Chris Mason's avatar Chris Mason
Browse files

Btrfs: be more polite in the async caching threads

The semaphore used by the async caching threads can prevent a
transaction commit, which can make the FS appear to stall.  This
releases the semaphore more often when a transaction commit is
in progress.
Signed-off-by: default avatarChris Mason <>
parent 276e680d
......@@ -302,10 +302,11 @@ again:
else if (ret)
if (need_resched()) {
if (need_resched() ||
btrfs_transaction_in_commit(fs_info)) {
btrfs_release_path(fs_info->extent_root, path);
goto again;
......@@ -857,6 +857,16 @@ static void update_super_roots(struct btrfs_root *root)
super->root_level = root_item->level;
int btrfs_transaction_in_commit(struct btrfs_fs_info *info)
int ret = 0;
if (info->running_transaction)
ret = info->running_transaction->in_commit;
return ret;
int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
struct btrfs_root *root)
......@@ -107,4 +107,5 @@ int btrfs_record_root_in_trans(struct btrfs_trans_handle *trans,
struct btrfs_root *root);
int btrfs_write_and_wait_marked_extents(struct btrfs_root *root,
struct extent_io_tree *dirty_pages);
int btrfs_transaction_in_commit(struct btrfs_fs_info *info);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment