linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix wrong calculation of the available space when reserving the space
@ 2012-09-27  9:09 Miao Xie
  2012-09-27 12:33 ` Miao Xie
  2012-09-27 13:16 ` Josef Bacik
  0 siblings, 2 replies; 3+ messages in thread
From: Miao Xie @ 2012-09-27  9:09 UTC (permalink / raw)
  To: Linux Btrfs; +Cc: Josef Bacik

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs: fix wrong calculation of the available space when reserving the space
  2012-09-27  9:09 [PATCH] Btrfs: fix wrong calculation of the available space when reserving the space Miao Xie
@ 2012-09-27 12:33 ` Miao Xie
  2012-09-27 13:16 ` Josef Bacik
  1 sibling, 0 replies; 3+ messages in thread
From: Miao Xie @ 2012-09-27 12:33 UTC (permalink / raw)
  To: Linux Btrfs; +Cc: Josef Bacik

Please ignore this patch, it is not based on the new btrfs-next tree.
I'll send the right one as soon as possible.

Thanks
Miao

On thu, 27 Sep 2012 17:09:15 +0800, Miao Xie wrote:
> 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) {
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Btrfs: fix wrong calculation of the available space when reserving the space
  2012-09-27  9:09 [PATCH] Btrfs: fix wrong calculation of the available space when reserving the space Miao Xie
  2012-09-27 12:33 ` Miao Xie
@ 2012-09-27 13:16 ` Josef Bacik
  1 sibling, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2012-09-27 13:16 UTC (permalink / raw)
  To: Miao Xie; +Cc: Linux Btrfs, Josef Bacik

On Thu, Sep 27, 2012 at 03:09:15AM -0600, Miao Xie wrote:
> 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.
> 

Sorry the comment is wrong, I was actually just looking at this the other day
:).  Basically we want non-flushers to be able to overcommit more to give those
guys more of a chance of being able to make an allocation, but we want flushers
to not be able to overcommit too much since they are allowed to make more
headroom, so the logic is right, the comment is wrong.  Thanks,

Josef

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-27 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-27  9:09 [PATCH] Btrfs: fix wrong calculation of the available space when reserving the space Miao Xie
2012-09-27 12:33 ` Miao Xie
2012-09-27 13:16 ` Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).