aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-07-17 12:54:14 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:04 -0400
commitf9295749388f82c8d2f485e99c72cd7c7876a99b (patch)
tree5089b0f723583d262116775b8b9fb5b4b8d291e0 /fs/btrfs/inode.c
parentdbe674a99c8af088faa4c95eddaeb271a3140ab6 (diff)
btrfs_start_transaction: wait for commits in progress to finish
btrfs_commit_transaction has to loop waiting for any writers in the transaction to finish before it can proceed. btrfs_start_transaction should be polite and not join a transaction that is in the process of being finished off. There are a few places that can't wait, basically the ones doing IO that might be needed to finish the transaction. For them, btrfs_join_transaction is added. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index baf46017d0d3..0a687326c0b0 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -116,7 +116,7 @@ static int cow_file_range(struct inode *inode, u64 start, u64 end)
116 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; 116 struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
117 int ret = 0; 117 int ret = 0;
118 118
119 trans = btrfs_start_transaction(root, 1); 119 trans = btrfs_join_transaction(root, 1);
120 BUG_ON(!trans); 120 BUG_ON(!trans);
121 btrfs_set_trans_block_group(trans, inode); 121 btrfs_set_trans_block_group(trans, inode);
122 122
@@ -502,7 +502,7 @@ int btrfs_writepage_end_io_hook(struct page *page, u64 start, u64 end,
502 return 0; 502 return 0;
503 } 503 }
504 504
505 trans = btrfs_start_transaction(root, 1); 505 trans = btrfs_join_transaction(root, 1);
506 506
507 ordered_extent = btrfs_lookup_ordered_extent(inode, start); 507 ordered_extent = btrfs_lookup_ordered_extent(inode, start);
508 BUG_ON(!ordered_extent); 508 BUG_ON(!ordered_extent);
@@ -1812,7 +1812,7 @@ int btrfs_write_inode(struct inode *inode, int wait)
1812 int ret = 0; 1812 int ret = 0;
1813 1813
1814 if (wait) { 1814 if (wait) {
1815 trans = btrfs_start_transaction(root, 1); 1815 trans = btrfs_join_transaction(root, 1);
1816 btrfs_set_trans_block_group(trans, inode); 1816 btrfs_set_trans_block_group(trans, inode);
1817 ret = btrfs_commit_transaction(trans, root); 1817 ret = btrfs_commit_transaction(trans, root);
1818 } 1818 }
@@ -1830,7 +1830,7 @@ void btrfs_dirty_inode(struct inode *inode)
1830 struct btrfs_root *root = BTRFS_I(inode)->root; 1830 struct btrfs_root *root = BTRFS_I(inode)->root;
1831 struct btrfs_trans_handle *trans; 1831 struct btrfs_trans_handle *trans;
1832 1832
1833 trans = btrfs_start_transaction(root, 1); 1833 trans = btrfs_join_transaction(root, 1);
1834 btrfs_set_trans_block_group(trans, inode); 1834 btrfs_set_trans_block_group(trans, inode);
1835 btrfs_update_inode(trans, root, inode); 1835 btrfs_update_inode(trans, root, inode);
1836 btrfs_end_transaction(trans, root); 1836 btrfs_end_transaction(trans, root);
@@ -2395,7 +2395,7 @@ again:
2395 free_extent_map(em); 2395 free_extent_map(em);
2396 em = NULL; 2396 em = NULL;
2397 btrfs_release_path(root, path); 2397 btrfs_release_path(root, path);
2398 trans = btrfs_start_transaction(root, 1); 2398 trans = btrfs_join_transaction(root, 1);
2399 goto again; 2399 goto again;
2400 } 2400 }
2401 write_extent_buffer(leaf, map + pg_offset, ptr, 2401 write_extent_buffer(leaf, map + pg_offset, ptr,