summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-02-26 15:38:31 +0100
committerDavid Sterba <dsterba@suse.com>2016-02-26 15:38:31 +0100
commite9ddd77a31e6ba2867b9c33547f6f079d55f7a72 (patch)
tree3c2b40e73c989b49826b16e1294e95c01058e3e9 /fs/btrfs/inode.c
parentMerge branch 'foreign/zhaolei/reada' into for-chris-4.6 (diff)
parentBtrfs: check reserved when deciding to background flush (diff)
downloadlinux-e9ddd77a31e6ba2867b9c33547f6f079d55f7a72.tar.xz
linux-e9ddd77a31e6ba2867b9c33547f6f079d55f7a72.zip
Merge branch 'foreign/josef/space-updates' into for-chris-4.6
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f8be74037f34..350b77220153 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4212,11 +4212,20 @@ static int truncate_space_check(struct btrfs_trans_handle *trans,
{
int ret;
+ /*
+ * This is only used to apply pressure to the enospc system, we don't
+ * intend to use this reservation at all.
+ */
bytes_deleted = btrfs_csum_bytes_to_leaves(root, bytes_deleted);
+ bytes_deleted *= root->nodesize;
ret = btrfs_block_rsv_add(root, &root->fs_info->trans_block_rsv,
bytes_deleted, BTRFS_RESERVE_NO_FLUSH);
- if (!ret)
+ if (!ret) {
+ trace_btrfs_space_reservation(root->fs_info, "transaction",
+ trans->transid,
+ bytes_deleted, 1);
trans->bytes_reserved += bytes_deleted;
+ }
return ret;
}