diff options
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 994490d5fa64..a70c5790f8f5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4046,9 +4046,7 @@ int btrfs_unlink_inode(struct btrfs_trans_handle *trans, | |||
4046 | */ | 4046 | */ |
4047 | static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir) | 4047 | static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir) |
4048 | { | 4048 | { |
4049 | struct btrfs_trans_handle *trans; | ||
4050 | struct btrfs_root *root = BTRFS_I(dir)->root; | 4049 | struct btrfs_root *root = BTRFS_I(dir)->root; |
4051 | int ret; | ||
4052 | 4050 | ||
4053 | /* | 4051 | /* |
4054 | * 1 for the possible orphan item | 4052 | * 1 for the possible orphan item |
@@ -4057,27 +4055,7 @@ static struct btrfs_trans_handle *__unlink_start_trans(struct inode *dir) | |||
4057 | * 1 for the inode ref | 4055 | * 1 for the inode ref |
4058 | * 1 for the inode | 4056 | * 1 for the inode |
4059 | */ | 4057 | */ |
4060 | trans = btrfs_start_transaction(root, 5); | 4058 | return btrfs_start_transaction_fallback_global_rsv(root, 5, 5); |
4061 | if (!IS_ERR(trans) || PTR_ERR(trans) != -ENOSPC) | ||
4062 | return trans; | ||
4063 | |||
4064 | if (PTR_ERR(trans) == -ENOSPC) { | ||
4065 | u64 num_bytes = btrfs_calc_trans_metadata_size(root, 5); | ||
4066 | |||
4067 | trans = btrfs_start_transaction(root, 0); | ||
4068 | if (IS_ERR(trans)) | ||
4069 | return trans; | ||
4070 | ret = btrfs_cond_migrate_bytes(root->fs_info, | ||
4071 | &root->fs_info->trans_block_rsv, | ||
4072 | num_bytes, 5); | ||
4073 | if (ret) { | ||
4074 | btrfs_end_transaction(trans, root); | ||
4075 | return ERR_PTR(ret); | ||
4076 | } | ||
4077 | trans->block_rsv = &root->fs_info->trans_block_rsv; | ||
4078 | trans->bytes_reserved = num_bytes; | ||
4079 | } | ||
4080 | return trans; | ||
4081 | } | 4059 | } |
4082 | 4060 | ||
4083 | static int btrfs_unlink(struct inode *dir, struct dentry *dentry) | 4061 | static int btrfs_unlink(struct inode *dir, struct dentry *dentry) |