Skip to content

Commit

Permalink
Merge branch 'for-chris-4.4' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/git/fdmanana/linux into for-linus-4.4
  • Loading branch information
Chris Mason committed Dec 15, 2015
2 parents bb1591b + 9435688 commit 1d3a5a8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
10 changes: 7 additions & 3 deletions fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -10480,11 +10480,15 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info)
* until transaction commit to do the actual discard.
*/
if (trimming) {
WARN_ON(!list_empty(&block_group->bg_list));
spin_lock(&trans->transaction->deleted_bgs_lock);
spin_lock(&fs_info->unused_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,
&trans->transaction->deleted_bgs);
spin_unlock(&trans->transaction->deleted_bgs_lock);
spin_unlock(&fs_info->unused_bgs_lock);
btrfs_get_block_group(block_group);
}
end_trans:
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/free-space-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
spin_unlock(&block_group->lock);
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);
}

Expand Down
1 change: 0 additions & 1 deletion fs/btrfs/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ static noinline int join_transaction(struct btrfs_root *root, unsigned int type)
cur_trans->num_dirty_bgs = 0;
spin_lock_init(&cur_trans->dirty_bgs_lock);
INIT_LIST_HEAD(&cur_trans->deleted_bgs);
spin_lock_init(&cur_trans->deleted_bgs_lock);
spin_lock_init(&cur_trans->dropped_roots_lock);
list_add_tail(&cur_trans->list, &fs_info->trans_list);
extent_io_tree_init(&cur_trans->dirty_pages,
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ struct btrfs_transaction {
*/
struct mutex cache_write_mutex;
spinlock_t dirty_bgs_lock;
/* Protected by spin lock fs_info->unused_bgs_lock. */
struct list_head deleted_bgs;
spinlock_t deleted_bgs_lock;
spinlock_t dropped_roots_lock;
struct btrfs_delayed_ref_root delayed_refs;
int aborted;
Expand Down
3 changes: 1 addition & 2 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -3548,12 +3548,11 @@ static int __btrfs_balance(struct btrfs_fs_info *fs_info)

ret = btrfs_force_chunk_alloc(trans, chunk_root,
BTRFS_BLOCK_GROUP_DATA);
btrfs_end_transaction(trans, chunk_root);
if (ret < 0) {
mutex_unlock(&fs_info->delete_unused_bgs_mutex);
goto error;
}

btrfs_end_transaction(trans, chunk_root);
chunk_reserved = 1;
}

Expand Down

0 comments on commit 1d3a5a8

Please sign in to comment.