aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.c
diff options
context:
space:
mode:
authorZheng Yan <zheng.yan@oracle.com>2008-09-26 10:05:38 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-26 10:05:38 -0400
commit5b21f2ed3f2947b5195b65c9fdbdd9e52904cc03 (patch)
tree9af8f539ac487c163f3207bc065767c3c8b37ae7 /fs/btrfs/ctree.c
parente465768938f95388723b0fd3c50a0ae48173edb9 (diff)
Btrfs: extent_map and data=ordered fixes for space balancing
* Add an EXTENT_BOUNDARY state bit to keep the writepage code from merging data extents that are in the process of being relocated. This allows us to do accounting for them properly. * The balancing code relocates data extents indepdent of the underlying inode. The extent_map code was modified to properly account for things moving around (invalidating extent_map caches in the inode). * Don't take the drop_mutex in the create_subvol ioctl. It isn't required. * Fix walking of the ordered extent list to avoid races with sys_unlink * Change the lock ordering rules. Transaction start goes outside the drop_mutex. This allows btrfs_commit_transaction to directly drop the relocation trees. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.c')
-rw-r--r--fs/btrfs/ctree.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 50aea8cb653a..f9cd40967d04 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -290,7 +290,6 @@ int noinline btrfs_cow_block(struct btrfs_trans_handle *trans,
290 struct extent_buffer **cow_ret, u64 prealloc_dest) 290 struct extent_buffer **cow_ret, u64 prealloc_dest)
291{ 291{
292 u64 search_start; 292 u64 search_start;
293 u64 header_trans;
294 int ret; 293 int ret;
295 294
296 if (trans->transaction != root->fs_info->running_transaction) { 295 if (trans->transaction != root->fs_info->running_transaction) {
@@ -304,9 +303,9 @@ int noinline btrfs_cow_block(struct btrfs_trans_handle *trans,
304 WARN_ON(1); 303 WARN_ON(1);
305 } 304 }
306 305
307 header_trans = btrfs_header_generation(buf);
308 spin_lock(&root->fs_info->hash_lock); 306 spin_lock(&root->fs_info->hash_lock);
309 if (header_trans == trans->transid && 307 if (btrfs_header_generation(buf) == trans->transid &&
308 btrfs_header_owner(buf) == root->root_key.objectid &&
310 !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) { 309 !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) {
311 *cow_ret = buf; 310 *cow_ret = buf;
312 spin_unlock(&root->fs_info->hash_lock); 311 spin_unlock(&root->fs_info->hash_lock);
@@ -1300,6 +1299,7 @@ again:
1300 /* is a cow on this block not required */ 1299 /* is a cow on this block not required */
1301 spin_lock(&root->fs_info->hash_lock); 1300 spin_lock(&root->fs_info->hash_lock);
1302 if (btrfs_header_generation(b) == trans->transid && 1301 if (btrfs_header_generation(b) == trans->transid &&
1302 btrfs_header_owner(b) == root->root_key.objectid &&
1303 !btrfs_header_flag(b, BTRFS_HEADER_FLAG_WRITTEN)) { 1303 !btrfs_header_flag(b, BTRFS_HEADER_FLAG_WRITTEN)) {
1304 spin_unlock(&root->fs_info->hash_lock); 1304 spin_unlock(&root->fs_info->hash_lock);
1305 goto cow_done; 1305 goto cow_done;
@@ -1396,7 +1396,8 @@ cow_done:
1396 1396
1397 /* this is only true while dropping a snapshot */ 1397 /* this is only true while dropping a snapshot */
1398 if (level == lowest_level) { 1398 if (level == lowest_level) {
1399 break; 1399 ret = 0;
1400 goto done;
1400 } 1401 }
1401 1402
1402 blocknr = btrfs_node_blockptr(b, slot); 1403 blocknr = btrfs_node_blockptr(b, slot);