int btrfs_block_rsv_check(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_block_rsv *block_rsv,
- u64 min_reserved, int min_factor);
+ u64 min_reserved, int min_factor, int flush);
int btrfs_block_rsv_migrate(struct btrfs_block_rsv *src_rsv,
struct btrfs_block_rsv *dst_rsv,
u64 num_bytes);
int btrfs_block_rsv_check(struct btrfs_trans_handle *trans,
struct btrfs_root *root,
struct btrfs_block_rsv *block_rsv,
- u64 min_reserved, int min_factor)
+ u64 min_reserved, int min_factor, int flush)
{
u64 num_bytes = 0;
int ret = -ENOSPC;
if (!ret)
return 0;
- ret = reserve_metadata_bytes(trans, root, block_rsv, num_bytes, 0);
+ ret = reserve_metadata_bytes(trans, root, block_rsv, num_bytes, flush);
if (!ret) {
block_rsv_add_bytes(block_rsv, num_bytes, 0);
return 0;
trans->block_rsv = root->orphan_block_rsv;
ret = btrfs_block_rsv_check(trans, root,
root->orphan_block_rsv,
- 0, 5);
+ 0, 5, 0);
if (ret)
return ret;
* doing the truncate.
*/
while (1) {
- ret = btrfs_block_rsv_check(NULL, root, rsv, min_size, 0);
+ ret = btrfs_block_rsv_check(NULL, root, rsv, min_size, 0, 1);
if (ret) {
printk(KERN_WARNING "Could not get space for a "
- "delete, will truncate on mount\n");
+ "delete, will truncate on mount %d\n", ret);
btrfs_orphan_del(NULL, inode);
btrfs_free_block_rsv(root, rsv);
goto no_delete;
btrfs_add_ordered_operation(trans, root, inode);
while (1) {
- ret = btrfs_block_rsv_check(trans, root, rsv, min_size, 0);
+ ret = btrfs_block_rsv_check(trans, root, rsv, min_size, 0, 1);
if (ret) {
/*
* This can only happen with the original transaction we
trans->block_rsv = rc->block_rsv;
ret = btrfs_block_rsv_check(trans, root, rc->block_rsv,
- min_reserved, 0);
+ min_reserved, 0, 0);
if (ret) {
BUG_ON(ret != -EAGAIN);
ret = btrfs_commit_transaction(trans, root);
}
ret = btrfs_block_rsv_check(trans, rc->extent_root,
- rc->block_rsv, 0, 5);
+ rc->block_rsv, 0, 5, 0);
if (ret < 0) {
if (ret != -EAGAIN) {
err = ret;
{
int ret;
ret = btrfs_block_rsv_check(trans, root,
- &root->fs_info->global_block_rsv, 0, 5);
+ &root->fs_info->global_block_rsv, 0, 5, 0);
return ret ? 1 : 0;
}