All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: skip commit transaction if we don't have enough pinned bytes
@ 2017-05-19 17:39 Liu Bo
  2017-05-23  9:06 ` Nikolay Borisov
  2017-06-02 18:14 ` Omar Sandoval
  0 siblings, 2 replies; 9+ messages in thread
From: Liu Bo @ 2017-05-19 17:39 UTC (permalink / raw)
  To: linux-btrfs

We commit transaction in order to reclaim space from pinned bytes because
it could process delayed refs, and in may_commit_transaction(), we check
first if pinned bytes are enough for the required space, we then check if
that plus bytes reserved for delayed insert are enough for the required
space.

This changes the code to the above logic.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/extent-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index e390451c72e6..bded1ddd1bb6 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4837,7 +4837,7 @@ static int may_commit_transaction(struct btrfs_fs_info *fs_info,
 
 	spin_lock(&delayed_rsv->lock);
 	if (percpu_counter_compare(&space_info->total_bytes_pinned,
-				   bytes - delayed_rsv->size) >= 0) {
+				   bytes - delayed_rsv->size) < 0) {
 		spin_unlock(&delayed_rsv->lock);
 		return -ENOSPC;
 	}
-- 
2.13.0


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

end of thread, other threads:[~2017-06-06 23:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-19 17:39 [PATCH] Btrfs: skip commit transaction if we don't have enough pinned bytes Liu Bo
2017-05-23  9:06 ` Nikolay Borisov
2017-05-25 16:50   ` David Sterba
2017-05-26  1:26     ` Liu Bo
2017-06-02 18:14 ` Omar Sandoval
2017-06-04  1:31   ` Holger Hoffstätte
2017-06-05 22:05   ` Liu Bo
2017-06-06  4:29   ` Liu Bo
2017-06-06 23:47     ` Omar Sandoval

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.