提交 6f334348 编写于 作者: A Arne Jansen 提交者: Chris Mason

btrfs: Fix early enospc because 'unused' calculated with wrong sign.

'unused' calculated with wrong sign in reserve_metadata_bytes().
This might have lead to unwanted over-reservations.
Signed-off-by: NArne Jansen <sensille@gmx.net>
Reviewed-by: NJosef Bacik <josef@redhat.com>
Signed-off-by: NChris Mason <chris.mason@oracle.com>
上级 e65e1535
......@@ -3413,7 +3413,7 @@ static int reserve_metadata_bytes(struct btrfs_trans_handle *trans,
* our reservation.
*/
if (unused <= space_info->total_bytes) {
unused -= space_info->total_bytes;
unused = space_info->total_bytes - unused;
if (unused >= num_bytes) {
if (!reserved)
space_info->bytes_reserved += orig_bytes;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册