diff mbox

[01/10] btrfs: Adjust commit-transaction condition to avoid NO_SPACE more

Message ID 1424165965-4066-1-git-send-email-zhaolei@cn.fujitsu.com (mailing list archive)
State Superseded
Headers show

Commit Message

Zhaolei Feb. 17, 2015, 9:39 a.m. UTC
From: Zhao Lei <zhaolei@cn.fujitsu.com>

If we have any chance to make a successful write, we should not give up.

This patch adjust commit-transaction condition from:
  pinned >= wanted
to
  left + pinned >= wanted

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 fs/btrfs/extent-tree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Zhaolei Feb. 17, 2015, 9:42 a.m. UTC | #1
Hi,

> From: Zhaolei [mailto:zhaolei@cn.fujitsu.com]
> Subject: [PATCH 01/10] btrfs: Adjust commit-transaction condition to avoid
> NO_SPACE more

Sorry for title, it is only one patch.
Will resend.

Thanks
Zhaolei

> 
> From: Zhao Lei <zhaolei@cn.fujitsu.com>
> 
> If we have any chance to make a successful write, we should not give up.
> 
> This patch adjust commit-transaction condition from:
>   pinned >= wanted
> to
>   left + pinned >= wanted
> 
> Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
> ---
>  fs/btrfs/extent-tree.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index
> 414d533..4ffce64 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -3751,7 +3751,8 @@ alloc:
>  		 * don't bother committing the transaction.
>  		 */
>  		if (percpu_counter_compare(&data_sinfo->total_bytes_pinned,
> -					   bytes) < 0)
> +					   used + bytes -
> +					   data_sinfo->total_bytes) < 0)
>  			have_pinned_space = 0;
>  		spin_unlock(&data_sinfo->lock);
> 
> --
> 1.8.5.1



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 414d533..4ffce64 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3751,7 +3751,8 @@  alloc:
 		 * don't bother committing the transaction.
 		 */
 		if (percpu_counter_compare(&data_sinfo->total_bytes_pinned,
-					   bytes) < 0)
+					   used + bytes -
+					   data_sinfo->total_bytes) < 0)
 			have_pinned_space = 0;
 		spin_unlock(&data_sinfo->lock);