[PATCH] Btrfs: fix wrong calculation of the available space when reserving the space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



According to the comment, we can overcommit the space up to 1/2 of the total
disk space, or we just can overcommit up to 1/8. But the code was written
reversedly. Fix it.

Signed-off-by: Miao Xie <miaox@xxxxxxxxxxxxxx>
---
This is based on btrfs-next tree.
---
 fs/btrfs/extent-tree.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index a010234..8a01087 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3962,9 +3962,9 @@ again:
 		 * 1/2 of the space.
 		 */
 		if (flush)
-			avail >>= 3;
-		else
 			avail >>= 1;
+		else
+			avail >>= 3;
 		 spin_unlock(&root->fs_info->free_chunk_lock);
 
 		if (used + num_bytes < space_info->total_bytes + avail) {
-- 
1.6.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux