btrfs: introduce delayed_refs_rsv
[sfrench/cifs-2.6.git] / fs / btrfs / disk-io.c
index cbb7cf4a993ddc8747da37735f4849be18256073..2f934a0b2148e65598799308a150f0e72ef45880 100644 (file)
@@ -2678,6 +2678,9 @@ int open_ctree(struct super_block *sb,
        btrfs_init_block_rsv(&fs_info->empty_block_rsv, BTRFS_BLOCK_RSV_EMPTY);
        btrfs_init_block_rsv(&fs_info->delayed_block_rsv,
                             BTRFS_BLOCK_RSV_DELOPS);
+       btrfs_init_block_rsv(&fs_info->delayed_refs_rsv,
+                            BTRFS_BLOCK_RSV_DELREFS);
+
        atomic_set(&fs_info->async_delalloc_pages, 0);
        atomic_set(&fs_info->defrag_running, 0);
        atomic_set(&fs_info->qgroup_op_seq, 0);
@@ -4446,6 +4449,7 @@ void btrfs_cleanup_dirty_bgs(struct btrfs_transaction *cur_trans,
 
                spin_unlock(&cur_trans->dirty_bgs_lock);
                btrfs_put_block_group(cache);
+               btrfs_delayed_refs_rsv_release(fs_info, 1);
                spin_lock(&cur_trans->dirty_bgs_lock);
        }
        spin_unlock(&cur_trans->dirty_bgs_lock);