Commit 1d3a5a82 authored by Chris Mason's avatar Chris Mason

Merge branch 'for-chris-4.4' of...

Merge branch 'for-chris-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/fdmanana/linux into for-linus-4.4
parents bb1591b4 94356889
...@@ -10480,11 +10480,15 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) ...@@ -10480,11 +10480,15 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
* until transaction commit to do the actual discard. * until transaction commit to do the actual discard.
*/ */
if (trimming) { if (trimming) {
WARN_ON(!list_empty(&block_group->bg_list)); spin_lock(&fs_info->unused_bgs_lock);
spin_lock(&trans->transaction->deleted_bgs_lock); /*
* A concurrent scrub might have added us to the list
* fs_info->unused_bgs, so use a list_move operation
* to add the block group to the deleted_bgs list.
*/
list_move(&block_group->bg_list, list_move(&block_group->bg_list,
&trans->transaction->deleted_bgs); &trans->transaction->deleted_bgs);
spin_unlock(&trans->transaction->deleted_bgs_lock); spin_unlock(&fs_info->unused_bgs_lock);
btrfs_get_block_group(block_group); btrfs_get_block_group(block_group);
} }
end_trans: end_trans:
......
...@@ -891,7 +891,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, ...@@ -891,7 +891,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
spin_unlock(&block_group->lock); spin_unlock(&block_group->lock);
ret = 0; ret = 0;
btrfs_warn(fs_info, "failed to load free space cache for block group %llu, rebuild it now", btrfs_warn(fs_info, "failed to load free space cache for block group %llu, rebuilding it now",
block_group->key.objectid); block_group->key.objectid);
} }
......
...@@ -274,7 +274,6 @@ static noinline int join_transaction(struct btrfs_root *root, unsigned int type) ...@@ -274,7 +274,6 @@ static noinline int join_transaction(struct btrfs_root *root, unsigned int type)
cur_trans->num_dirty_bgs = 0; cur_trans->num_dirty_bgs = 0;
spin_lock_init(&cur_trans->dirty_bgs_lock); spin_lock_init(&cur_trans->dirty_bgs_lock);
INIT_LIST_HEAD(&cur_trans->deleted_bgs); INIT_LIST_HEAD(&cur_trans->deleted_bgs);
spin_lock_init(&cur_trans->deleted_bgs_lock);
spin_lock_init(&cur_trans->dropped_roots_lock); spin_lock_init(&cur_trans->dropped_roots_lock);
list_add_tail(&cur_trans->list, &fs_info->trans_list); list_add_tail(&cur_trans->list, &fs_info->trans_list);
extent_io_tree_init(&cur_trans->dirty_pages, extent_io_tree_init(&cur_trans->dirty_pages,
......
...@@ -77,8 +77,8 @@ struct btrfs_transaction { ...@@ -77,8 +77,8 @@ struct btrfs_transaction {
*/ */
struct mutex cache_write_mutex; struct mutex cache_write_mutex;
spinlock_t dirty_bgs_lock; spinlock_t dirty_bgs_lock;
/* Protected by spin lock fs_info->unused_bgs_lock. */
struct list_head deleted_bgs; struct list_head deleted_bgs;
spinlock_t deleted_bgs_lock;
spinlock_t dropped_roots_lock; spinlock_t dropped_roots_lock;
struct btrfs_delayed_ref_root delayed_refs; struct btrfs_delayed_ref_root delayed_refs;
int aborted; int aborted;
......
...@@ -3548,12 +3548,11 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info) ...@@ -3548,12 +3548,11 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)
ret = btrfs_force_chunk_alloc(trans, chunk_root, ret = btrfs_force_chunk_alloc(trans, chunk_root,
BTRFS_BLOCK_GROUP_DATA); BTRFS_BLOCK_GROUP_DATA);
btrfs_end_transaction(trans, chunk_root);
if (ret < 0) { if (ret < 0) {
mutex_unlock(&fs_info->delete_unused_bgs_mutex); mutex_unlock(&fs_info->delete_unused_bgs_mutex);
goto error; goto error;
} }
btrfs_end_transaction(trans, chunk_root);
chunk_reserved = 1; chunk_reserved = 1;
} }
......
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