提交 804ca127 编写于 作者: D Dongsheng Yang 提交者: Chris Mason

Btrfs: qgroup: free reserved in exceeding quota.

When we exceed quota limit in writing, we will free
some reserved extent when we need to drop but not free
account in qgroup. It means, each time we exceed quota
in writing, there will be some remain space in qg->reserved
we can not use any more. If things go on like this, the
all space will be ate up.
Signed-off-by: NDongsheng Yang <yangds.fnst@cn.fujitsu.com>
Reviewed-by: NJosef Bacik <jbacik@fb.com>
Signed-off-by: NChris Mason <clm@fb.com>
上级 4087cf24
......@@ -5475,8 +5475,11 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes)
to_free = 0;
}
spin_unlock(&BTRFS_I(inode)->lock);
if (dropped)
if (dropped) {
if (root->fs_info->quota_enabled)
btrfs_qgroup_free(root, dropped * root->nodesize);
to_free += btrfs_calc_trans_metadata_size(root, dropped);
}
if (to_free) {
btrfs_block_rsv_release(root, block_rsv, to_free);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册