Commit ad693af6 authored by Chris Mason's avatar Chris Mason Committed by David Woodhouse

Btrfs: reap dead roots right after commit

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent facda1e7
...@@ -371,13 +371,6 @@ void btrfs_transaction_cleaner(struct work_struct *work) ...@@ -371,13 +371,6 @@ void btrfs_transaction_cleaner(struct work_struct *work)
int ret; int ret;
INIT_LIST_HEAD(&dirty_roots); INIT_LIST_HEAD(&dirty_roots);
mutex_lock(&root->fs_info->trans_mutex);
list_splice_init(&root->fs_info->dead_roots, &dirty_roots);
mutex_unlock(&root->fs_info->trans_mutex);
if (!list_empty(&dirty_roots)) {
drop_dirty_roots(root, &dirty_roots);
}
mutex_lock(&root->fs_info->fs_mutex); mutex_lock(&root->fs_info->fs_mutex);
mutex_lock(&root->fs_info->trans_mutex); mutex_lock(&root->fs_info->trans_mutex);
cur = root->fs_info->running_transaction; cur = root->fs_info->running_transaction;
...@@ -396,6 +389,14 @@ void btrfs_transaction_cleaner(struct work_struct *work) ...@@ -396,6 +389,14 @@ void btrfs_transaction_cleaner(struct work_struct *work)
ret = btrfs_commit_transaction(trans, root); ret = btrfs_commit_transaction(trans, root);
out: out:
mutex_unlock(&root->fs_info->fs_mutex); mutex_unlock(&root->fs_info->fs_mutex);
mutex_lock(&root->fs_info->trans_mutex);
list_splice_init(&root->fs_info->dead_roots, &dirty_roots);
mutex_unlock(&root->fs_info->trans_mutex);
if (!list_empty(&dirty_roots)) {
drop_dirty_roots(root, &dirty_roots);
}
btrfs_transaction_queue_work(root, delay); btrfs_transaction_queue_work(root, delay);
} }
......
Markdown is supported
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