@@ -219,6 +219,7 @@ static void add_root_to_dirty_list(struct btrfs_root *root)
spin_lock(&root->fs_info->trans_lock);
if (!test_and_set_bit(BTRFS_ROOT_DIRTY, &root->state)) {
+ printk(KERN_ERR "dirtying root %llu\n", root->objectid);
/* Want the extent tree to be the last on the list */
if (root->objectid == BTRFS_EXTENT_TREE_OBJECTID)
list_move_tail(&root->dirty_list,
@@ -5369,6 +5369,8 @@ static int update_block_group(struct btrfs_trans_handle *trans,
spin_lock(&trans->transaction->dirty_bgs_lock);
if (list_empty(&cache->dirty_list)) {
+ printk(KERN_ERR "dirtying bg %llu\n",
+ cache->key.objectid);
list_add_tail(&cache->dirty_list,
&trans->transaction->dirty_bgs);
btrfs_get_block_group(cache);
@@ -1027,6 +1027,10 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans,
old_root_used = btrfs_root_used(&root->root_item);
+ printk(KERN_ERR "writing root %llu, dirty cowonly roots empty %d, "
+ "dirty bgs empty %d\n", root->objectid,
+ list_empty(&fs_info->dirty_cowonly_roots),
+ list_empty(&trans->transaction->dirty_bgs));
while (1) {
old_root_bytenr = btrfs_root_bytenr(&root->root_item);
@@ -1050,6 +1054,7 @@ static int update_cowonly_root(struct btrfs_trans_handle *trans,
old_root_used = btrfs_root_used(&root->root_item);
if (list_empty(&fs_info->dirty_cowonly_roots)) {
+ printk(KERN_ERR "writing dirty block groups\n");
ret = btrfs_write_dirty_block_groups(trans, root);
if (ret)
return ret;
@@ -1123,6 +1128,7 @@ static noinline int commit_cowonly_roots(struct btrfs_trans_handle *trans,
return ret;
}
+ printk(KERN_ERR "done writy dirty cowonly roots\n");
list_add_tail(&fs_info->extent_root->dirty_list,
&trans->transaction->switch_commits);
btrfs_after_dev_replace_commit(fs_info);
@@ -2000,6 +2006,14 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
switch_commit_roots(cur_trans, root->fs_info);
assert_qgroups_uptodate(trans);
+ if (!list_empty(&cur_trans->dirty_bgs)) {
+ struct btrfs_block_group_cache *cache;
+
+ cache = list_first_entry(&cur_trans->dirty_bgs,
+ struct btrfs_block_group_cache,
+ bg_list);
+ printk(KERN_ERR "bg %llu still dirty\n", cache->key.objectid);
+ }
ASSERT(list_empty(&cur_trans->dirty_bgs));
update_super_roots(root);