All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Linux Btrfs <linux-btrfs@vger.kernel.org>
Cc: Josef Bacik <jbacik@fusionio.com>
Subject: [PATCH] Btrfs: fix wrong calculation of the available space when reserving the space
Date: Thu, 27 Sep 2012 17:09:15 +0800	[thread overview]
Message-ID: <506417BB.5050408@cn.fujitsu.com> (raw)

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@cn.fujitsu.com>
---
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

             reply	other threads:[~2012-09-27  9:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-27  9:09 Miao Xie [this message]
2012-09-27 12:33 ` [PATCH] Btrfs: fix wrong calculation of the available space when reserving the space Miao Xie
2012-09-27 13:16 ` Josef Bacik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=506417BB.5050408@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.