All of lore.kernel.org
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Cc: Josef Bacik <jbacik@fb.com>
Subject: [PATCH 04/22] btrfs: only track ref_heads in delayed_ref_updates
Date: Thu, 19 Jul 2018 10:49:48 -0400	[thread overview]
Message-ID: <20180719145006.17532-4-josef@toxicpanda.com> (raw)
In-Reply-To: <20180719145006.17532-1-josef@toxicpanda.com>

From: Josef Bacik <jbacik@fb.com>

We use this number to figure out how many delayed refs to run, but
__btrfs_run_delayed_refs really only checks every time we need a new
delayed ref head, so we always run at least one ref head completely no
matter what the number of items on it.  So instead track only the ref
heads added by this trans handle and adjust the counting appropriately
in __btrfs_run_delayed_refs.

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 fs/btrfs/delayed-ref.c | 3 ---
 fs/btrfs/extent-tree.c | 5 +----
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index e1b322d651dd..e5a8fb7ba9f6 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -234,8 +234,6 @@ static inline void drop_delayed_ref(struct btrfs_trans_handle *trans,
 	ref->in_tree = 0;
 	btrfs_put_delayed_ref(ref);
 	atomic_dec(&delayed_refs->num_entries);
-	if (trans->delayed_ref_updates)
-		trans->delayed_ref_updates--;
 }
 
 static bool merge_ref(struct btrfs_trans_handle *trans,
@@ -460,7 +458,6 @@ static int insert_delayed_ref(struct btrfs_trans_handle *trans,
 	if (ref->action == BTRFS_ADD_DELAYED_REF)
 		list_add_tail(&ref->add_list, &href->ref_add_list);
 	atomic_inc(&root->num_entries);
-	trans->delayed_ref_updates++;
 	spin_unlock(&href->lock);
 	return ret;
 }
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 33cd43dd73ee..168312ead4ae 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2667,6 +2667,7 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
 				spin_unlock(&delayed_refs->lock);
 				break;
 			}
+			count++;
 
 			/* grab the lock that says we are going to process
 			 * all the refs for this head */
@@ -2680,7 +2681,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
 			 */
 			if (ret == -EAGAIN) {
 				locked_ref = NULL;
-				count++;
 				continue;
 			}
 		}
@@ -2708,7 +2708,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
 			unselect_delayed_ref_head(delayed_refs, locked_ref);
 			locked_ref = NULL;
 			cond_resched();
-			count++;
 			continue;
 		}
 
@@ -2726,7 +2725,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
 				return ret;
 			}
 			locked_ref = NULL;
-			count++;
 			continue;
 		}
 
@@ -2777,7 +2775,6 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans,
 		}
 
 		btrfs_put_delayed_ref(ref);
-		count++;
 		cond_resched();
 	}
 
-- 
2.14.3


  parent reply	other threads:[~2018-07-19 15:33 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 14:49 [PATCH 01/22] btrfs: add btrfs_delete_ref_head helper Josef Bacik
2018-07-19 14:49 ` [PATCH 02/22] btrfs: add cleanup_ref_head_accounting helper Josef Bacik
2018-07-19 14:49 ` [PATCH 03/22] btrfs: use cleanup_extent_op in check_ref_cleanup Josef Bacik
2018-07-19 14:49 ` Josef Bacik [this message]
2018-07-21  8:49   ` [PATCH 04/22] btrfs: only track ref_heads in delayed_ref_updates Nikolay Borisov
2018-07-19 14:49 ` [PATCH 05/22] btrfs: introduce delayed_refs_rsv Josef Bacik
2018-07-19 14:49 ` [PATCH 06/22] btrfs: check if free bgs for commit Josef Bacik
2018-07-19 14:49 ` [PATCH 07/22] btrfs: don't leak ret from do_chunk_alloc Josef Bacik
2018-07-19 15:43   ` Nikolay Borisov
2018-07-24 11:24     ` David Sterba
2018-07-19 14:49 ` [PATCH 08/22] btrfs: dump block_rsv whe dumping space info Josef Bacik
2018-07-19 15:39   ` Nikolay Borisov
2018-07-20 11:59   ` David Sterba
2018-07-19 14:49 ` [PATCH 09/22] btrfs: release metadata before running delayed refs Josef Bacik
2018-07-19 14:49 ` [PATCH 10/22] btrfs: alloc space cache inode with GFP_NOFS Josef Bacik
2018-07-19 15:35   ` Nikolay Borisov
2018-07-19 15:44     ` David Sterba
2018-07-19 15:56       ` Josef Bacik
2018-07-19 15:55     ` Josef Bacik
2018-07-19 14:49 ` [PATCH 11/22] btrfs: fix truncate throttling Josef Bacik
2018-07-19 14:49 ` [PATCH 12/22] btrfs: don't use global rsv for chunk allocation Josef Bacik
2018-07-19 14:49 ` [PATCH 13/22] btrfs: reset max_extent_size properly Josef Bacik
2018-07-19 14:49 ` [PATCH 14/22] btrfs: don't enospc all tickets on flush failure Josef Bacik
2018-07-19 14:49 ` [PATCH 15/22] btrfs: run delayed iputs before committing Josef Bacik
2018-08-21 13:51   ` David Sterba
2018-07-19 14:50 ` [PATCH 16/22] btrfs: loop in inode_rsv_refill Josef Bacik
2018-07-19 14:50 ` [PATCH 17/22] btrfs: don't take the dio_sem in the fsync path Josef Bacik
2018-07-19 15:12   ` Filipe Manana
2018-07-19 15:21   ` Filipe Manana
2018-07-19 15:54     ` Josef Bacik
2018-07-19 15:57       ` Filipe Manana
2018-07-19 14:50 ` [PATCH 18/22] btrfs: add ALLOC_CHUNK_FORCE to the flushing code Josef Bacik
2018-07-19 14:50 ` [PATCH 19/22] btrfs: set max_extent_size properly Josef Bacik
2018-07-19 14:50 ` [PATCH 20/22] btrfs: don't use ctl->free_space for max_extent_size Josef Bacik
2018-07-19 14:50 ` [PATCH 21/22] btrfs: reset max_extent_size on clear in a bitmap Josef Bacik
2018-07-19 14:50 ` [PATCH 22/22] btrfs: only run delayed refs if we're committing Josef Bacik
2018-07-20  7:37   ` Nikolay Borisov
2018-07-19 16:08 ` [PATCH 01/22] btrfs: add btrfs_delete_ref_head helper David Sterba
2018-07-19 16:12   ` Josef Bacik
2018-07-19 16:36     ` David Sterba
2018-07-20 13:11 ` Nikolay Borisov
2018-07-20 14:18   ` Josef Bacik
2018-07-20 14:48 ` David Sterba
2018-07-20 16:04 ` David Sterba

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=20180719145006.17532-4-josef@toxicpanda.com \
    --to=josef@toxicpanda.com \
    --cc=jbacik@fb.com \
    --cc=kernel-team@fb.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.