aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/ctree.c7
-rw-r--r--fs/btrfs/ctree.h1
-rw-r--r--fs/btrfs/disk-io.c4
3 files changed, 1 insertions, 11 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 2603ee539b7a..3b6e35aafc9e 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -388,16 +388,14 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans,
388 WARN_ON(1); 388 WARN_ON(1);
389 } 389 }
390 390
391 spin_lock(&root->fs_info->hash_lock);
392 if (btrfs_header_generation(buf) == trans->transid && 391 if (btrfs_header_generation(buf) == trans->transid &&
393 btrfs_header_owner(buf) == root->root_key.objectid && 392 btrfs_header_owner(buf) == root->root_key.objectid &&
394 !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) { 393 !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) {
395 *cow_ret = buf; 394 *cow_ret = buf;
396 spin_unlock(&root->fs_info->hash_lock);
397 WARN_ON(prealloc_dest); 395 WARN_ON(prealloc_dest);
398 return 0; 396 return 0;
399 } 397 }
400 spin_unlock(&root->fs_info->hash_lock); 398
401 search_start = buf->start & ~((u64)(1024 * 1024 * 1024) - 1); 399 search_start = buf->start & ~((u64)(1024 * 1024 * 1024) - 1);
402 ret = __btrfs_cow_block(trans, root, buf, parent, 400 ret = __btrfs_cow_block(trans, root, buf, parent,
403 parent_slot, cow_ret, search_start, 0, 401 parent_slot, cow_ret, search_start, 0,
@@ -1376,14 +1374,11 @@ again:
1376 int wret; 1374 int wret;
1377 1375
1378 /* is a cow on this block not required */ 1376 /* is a cow on this block not required */
1379 spin_lock(&root->fs_info->hash_lock);
1380 if (btrfs_header_generation(b) == trans->transid && 1377 if (btrfs_header_generation(b) == trans->transid &&
1381 btrfs_header_owner(b) == root->root_key.objectid && 1378 btrfs_header_owner(b) == root->root_key.objectid &&
1382 !btrfs_header_flag(b, BTRFS_HEADER_FLAG_WRITTEN)) { 1379 !btrfs_header_flag(b, BTRFS_HEADER_FLAG_WRITTEN)) {
1383 spin_unlock(&root->fs_info->hash_lock);
1384 goto cow_done; 1380 goto cow_done;
1385 } 1381 }
1386 spin_unlock(&root->fs_info->hash_lock);
1387 1382
1388 /* ok, we have to cow, is our old prealloc the right 1383 /* ok, we have to cow, is our old prealloc the right
1389 * size? 1384 * size?
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index de103a8a815e..f2b8d26b0472 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -703,7 +703,6 @@ struct btrfs_fs_info {
703 struct super_block *sb; 703 struct super_block *sb;
704 struct inode *btree_inode; 704 struct inode *btree_inode;
705 struct backing_dev_info bdi; 705 struct backing_dev_info bdi;
706 spinlock_t hash_lock;
707 struct mutex trans_mutex; 706 struct mutex trans_mutex;
708 struct mutex tree_log_mutex; 707 struct mutex tree_log_mutex;
709 struct mutex transaction_kthread_mutex; 708 struct mutex transaction_kthread_mutex;
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 9c3810047976..549271607c17 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1503,7 +1503,6 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1503 INIT_LIST_HEAD(&fs_info->dead_roots); 1503 INIT_LIST_HEAD(&fs_info->dead_roots);
1504 INIT_LIST_HEAD(&fs_info->hashers); 1504 INIT_LIST_HEAD(&fs_info->hashers);
1505 INIT_LIST_HEAD(&fs_info->delalloc_inodes); 1505 INIT_LIST_HEAD(&fs_info->delalloc_inodes);
1506 spin_lock_init(&fs_info->hash_lock);
1507 spin_lock_init(&fs_info->delalloc_lock); 1506 spin_lock_init(&fs_info->delalloc_lock);
1508 spin_lock_init(&fs_info->new_trans_lock); 1507 spin_lock_init(&fs_info->new_trans_lock);
1509 spin_lock_init(&fs_info->ref_cache_lock); 1508 spin_lock_init(&fs_info->ref_cache_lock);
@@ -2361,7 +2360,6 @@ int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid)
2361int btree_lock_page_hook(struct page *page) 2360int btree_lock_page_hook(struct page *page)
2362{ 2361{
2363 struct inode *inode = page->mapping->host; 2362 struct inode *inode = page->mapping->host;
2364 struct btrfs_root *root = BTRFS_I(inode)->root;
2365 struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; 2363 struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
2366 struct extent_buffer *eb; 2364 struct extent_buffer *eb;
2367 unsigned long len; 2365 unsigned long len;
@@ -2376,9 +2374,7 @@ int btree_lock_page_hook(struct page *page)
2376 goto out; 2374 goto out;
2377 2375
2378 btrfs_tree_lock(eb); 2376 btrfs_tree_lock(eb);
2379 spin_lock(&root->fs_info->hash_lock);
2380 btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN); 2377 btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
2381 spin_unlock(&root->fs_info->hash_lock);
2382 btrfs_tree_unlock(eb); 2378 btrfs_tree_unlock(eb);
2383 free_extent_buffer(eb); 2379 free_extent_buffer(eb);
2384out: 2380out: