diff options
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r-- | fs/btrfs/ctree.c | 7 |
1 files changed, 1 insertions, 6 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? |