All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Some trivail cleanup about dealyed-refs
@ 2018-10-11  5:40 Lu Fengqi
  2018-10-11  5:40 ` [PATCH 1/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_select_ref_head() Lu Fengqi
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Lu Fengqi @ 2018-10-11  5:40 UTC (permalink / raw)
  To: linux-btrfs

There is no functional change. Just improve readablity.

PATCH 1-4 parameter cleanup patches
PATCH 5 cleanup about btrfs_select_ref_head
PATCH 6 switch int to bool; add some comment

Lu Fengqi (6):
  btrfs: delayed-ref: pass delayed_refs directly to
    btrfs_select_ref_head()
  btrfs: delayed-ref: pass delayed_refs directly to
    btrfs_delayed_ref_lock()
  btrfs: remove fs_info from btrfs_check_space_for_delayed_refs
  btrfs: remove fs_info from btrfs_should_throttle_delayed_refs
  btrfs: simplify btrfs_select_ref_head and cleanup some local variables
  btrfs: switch return_bigger to bool in find_ref_head

 fs/btrfs/ctree.h       |  6 ++----
 fs/btrfs/delayed-ref.c | 35 ++++++++++-------------------------
 fs/btrfs/delayed-ref.h |  4 ++--
 fs/btrfs/extent-tree.c | 15 +++++++--------
 fs/btrfs/inode.c       |  7 +++----
 fs/btrfs/transaction.c |  4 ++--
 6 files changed, 26 insertions(+), 45 deletions(-)

-- 
2.19.1




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

* [PATCH 1/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_select_ref_head()
  2018-10-11  5:40 [PATCH 0/6] Some trivail cleanup about dealyed-refs Lu Fengqi
@ 2018-10-11  5:40 ` Lu Fengqi
  2018-10-11  5:40 ` [PATCH 2/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_delayed_ref_lock() Lu Fengqi
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Lu Fengqi @ 2018-10-11  5:40 UTC (permalink / raw)
  To: linux-btrfs

Since trans is only used for referring to delayed_refs, there is no need
to pass it instead of delayed_refs to btrfs_select_ref_head().

No functional change.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 fs/btrfs/delayed-ref.c | 5 +----
 fs/btrfs/delayed-ref.h | 2 +-
 fs/btrfs/extent-tree.c | 2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 7f567c944fec..13ae86252c4c 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -354,15 +354,12 @@ int btrfs_check_delayed_seq(struct btrfs_fs_info *fs_info, u64 seq)
 }
 
 struct btrfs_delayed_ref_head *
-btrfs_select_ref_head(struct btrfs_trans_handle *trans)
+btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
 {
-	struct btrfs_delayed_ref_root *delayed_refs;
 	struct btrfs_delayed_ref_head *head;
 	u64 start;
 	bool loop = false;
 
-	delayed_refs = &trans->transaction->delayed_refs;
-
 again:
 	start = delayed_refs->run_delayed_start;
 	head = find_ref_head(delayed_refs, start, 1);
diff --git a/fs/btrfs/delayed-ref.h b/fs/btrfs/delayed-ref.h
index c3e3486a126c..aa66ad6919ab 100644
--- a/fs/btrfs/delayed-ref.h
+++ b/fs/btrfs/delayed-ref.h
@@ -264,7 +264,7 @@ static inline void btrfs_delayed_ref_unlock(struct btrfs_delayed_ref_head *head)
 
 
 struct btrfs_delayed_ref_head *
-btrfs_select_ref_head(struct btrfs_trans_handle *trans);
+btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs);
 
 int btrfs_check_delayed_seq(struct btrfs_fs_info *fs_info, u64 seq);
 
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 22b9269ae84c..22acc1545147 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2511,7 +2511,7 @@ static struct btrfs_delayed_ref_head *btrfs_obtain_ref_head(
 	int ret;
 
 	spin_lock(&delayed_refs->lock);
-	head = btrfs_select_ref_head(trans);
+	head = btrfs_select_ref_head(delayed_refs);
 	if (!head) {
 		spin_unlock(&delayed_refs->lock);
 		return head;
-- 
2.19.1




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

* [PATCH 2/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_delayed_ref_lock()
  2018-10-11  5:40 [PATCH 0/6] Some trivail cleanup about dealyed-refs Lu Fengqi
  2018-10-11  5:40 ` [PATCH 1/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_select_ref_head() Lu Fengqi
@ 2018-10-11  5:40 ` Lu Fengqi
  2018-10-11  5:40 ` [PATCH 3/6] btrfs: remove fs_info from btrfs_check_space_for_delayed_refs Lu Fengqi
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Lu Fengqi @ 2018-10-11  5:40 UTC (permalink / raw)
  To: linux-btrfs

Since trans is only used for referring to delayed_refs, there is no need
to pass it instead of delayed_refs to btrfs_delayed_ref_lock().

No functional change.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 fs/btrfs/delayed-ref.c | 5 +----
 fs/btrfs/delayed-ref.h | 2 +-
 fs/btrfs/extent-tree.c | 2 +-
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 13ae86252c4c..885581852bea 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -204,12 +204,9 @@ static struct btrfs_delayed_ref_head* find_ref_head(
 	return NULL;
 }
 
-int btrfs_delayed_ref_lock(struct btrfs_trans_handle *trans,
+int btrfs_delayed_ref_lock(struct btrfs_delayed_ref_root *delayed_refs,
 			   struct btrfs_delayed_ref_head *head)
 {
-	struct btrfs_delayed_ref_root *delayed_refs;
-
-	delayed_refs = &trans->transaction->delayed_refs;
 	lockdep_assert_held(&delayed_refs->lock);
 	if (mutex_trylock(&head->mutex))
 		return 0;
diff --git a/fs/btrfs/delayed-ref.h b/fs/btrfs/delayed-ref.h
index aa66ad6919ab..ef6f5cf75b3e 100644
--- a/fs/btrfs/delayed-ref.h
+++ b/fs/btrfs/delayed-ref.h
@@ -255,7 +255,7 @@ void btrfs_merge_delayed_refs(struct btrfs_trans_handle *trans,
 struct btrfs_delayed_ref_head *
 btrfs_find_delayed_ref_head(struct btrfs_delayed_ref_root *delayed_refs,
 			    u64 bytenr);
-int btrfs_delayed_ref_lock(struct btrfs_trans_handle *trans,
+int btrfs_delayed_ref_lock(struct btrfs_delayed_ref_root *delayed_refs,
 			   struct btrfs_delayed_ref_head *head);
 static inline void btrfs_delayed_ref_unlock(struct btrfs_delayed_ref_head *head)
 {
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 22acc1545147..77156bd2a9a7 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2521,7 +2521,7 @@ static struct btrfs_delayed_ref_head *btrfs_obtain_ref_head(
 	 * Grab the lock that says we are going to process all the refs for
 	 * this head
 	 */
-	ret = btrfs_delayed_ref_lock(trans, head);
+	ret = btrfs_delayed_ref_lock(delayed_refs, head);
 	spin_unlock(&delayed_refs->lock);
 
 	/*
-- 
2.19.1




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

* [PATCH 3/6] btrfs: remove fs_info from btrfs_check_space_for_delayed_refs
  2018-10-11  5:40 [PATCH 0/6] Some trivail cleanup about dealyed-refs Lu Fengqi
  2018-10-11  5:40 ` [PATCH 1/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_select_ref_head() Lu Fengqi
  2018-10-11  5:40 ` [PATCH 2/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_delayed_ref_lock() Lu Fengqi
@ 2018-10-11  5:40 ` Lu Fengqi
  2018-10-11  5:40 ` [PATCH 4/6] btrfs: remove fs_info from btrfs_should_throttle_delayed_refs Lu Fengqi
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Lu Fengqi @ 2018-10-11  5:40 UTC (permalink / raw)
  To: linux-btrfs

It can be referenced from the transaction handle.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 fs/btrfs/ctree.h       | 3 +--
 fs/btrfs/extent-tree.c | 6 +++---
 fs/btrfs/inode.c       | 2 +-
 fs/btrfs/transaction.c | 2 +-
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 15c659f23411..4002c9fd924b 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2600,8 +2600,7 @@ static inline u64 btrfs_calc_trunc_metadata_size(struct btrfs_fs_info *fs_info,
 
 int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
 				       struct btrfs_fs_info *fs_info);
-int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans,
-				       struct btrfs_fs_info *fs_info);
+int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans);
 void btrfs_dec_block_group_reservations(struct btrfs_fs_info *fs_info,
 					 const u64 start);
 void btrfs_wait_block_group_reservations(struct btrfs_block_group_cache *bg);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 77156bd2a9a7..831dc2ac1942 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2789,9 +2789,9 @@ u64 btrfs_csum_bytes_to_leaves(struct btrfs_fs_info *fs_info, u64 csum_bytes)
 	return num_csums;
 }
 
-int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans,
-				       struct btrfs_fs_info *fs_info)
+int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans)
 {
+	struct btrfs_fs_info *fs_info = trans->fs_info;
 	struct btrfs_block_rsv *global_rsv;
 	u64 num_heads = trans->transaction->delayed_refs.num_heads_ready;
 	u64 csum_bytes = trans->transaction->delayed_refs.pending_csums;
@@ -2842,7 +2842,7 @@ int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
 	if (val >= NSEC_PER_SEC / 2)
 		return 2;
 
-	return btrfs_check_space_for_delayed_refs(trans, fs_info);
+	return btrfs_check_space_for_delayed_refs(trans);
 }
 
 struct async_delayed_refs {
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 6c476dc81b8e..6a5557e8909d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5319,7 +5319,7 @@ static struct btrfs_trans_handle *evict_refill_and_join(struct btrfs_root *root,
 		 * Try to steal from the global reserve if there is space for
 		 * it.
 		 */
-		if (!btrfs_check_space_for_delayed_refs(trans, fs_info) &&
+		if (!btrfs_check_space_for_delayed_refs(trans) &&
 		    !btrfs_block_rsv_migrate(global_rsv, rsv, rsv->size, false))
 			return trans;
 
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index e7f618b17b07..c5015458c5c8 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -760,7 +760,7 @@ static int should_end_transaction(struct btrfs_trans_handle *trans)
 {
 	struct btrfs_fs_info *fs_info = trans->fs_info;
 
-	if (btrfs_check_space_for_delayed_refs(trans, fs_info))
+	if (btrfs_check_space_for_delayed_refs(trans))
 		return 1;
 
 	return !!btrfs_block_rsv_check(&fs_info->global_block_rsv, 5);
-- 
2.19.1




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

* [PATCH 4/6] btrfs: remove fs_info from btrfs_should_throttle_delayed_refs
  2018-10-11  5:40 [PATCH 0/6] Some trivail cleanup about dealyed-refs Lu Fengqi
                   ` (2 preceding siblings ...)
  2018-10-11  5:40 ` [PATCH 3/6] btrfs: remove fs_info from btrfs_check_space_for_delayed_refs Lu Fengqi
@ 2018-10-11  5:40 ` Lu Fengqi
  2018-10-11  5:40 ` [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables Lu Fengqi
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Lu Fengqi @ 2018-10-11  5:40 UTC (permalink / raw)
  To: linux-btrfs

The avg_delayed_ref_runtime can be referenced from the transaction handle.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 fs/btrfs/ctree.h       | 3 +--
 fs/btrfs/extent-tree.c | 5 ++---
 fs/btrfs/inode.c       | 5 ++---
 fs/btrfs/transaction.c | 2 +-
 4 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 4002c9fd924b..68ca41dbbef3 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2598,8 +2598,7 @@ static inline u64 btrfs_calc_trunc_metadata_size(struct btrfs_fs_info *fs_info,
 	return (u64)fs_info->nodesize * BTRFS_MAX_LEVEL * num_items;
 }
 
-int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
-				       struct btrfs_fs_info *fs_info);
+int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans);
 int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans);
 void btrfs_dec_block_group_reservations(struct btrfs_fs_info *fs_info,
 					 const u64 start);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 831dc2ac1942..241de034ba09 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -2826,8 +2826,7 @@ int btrfs_check_space_for_delayed_refs(struct btrfs_trans_handle *trans)
 	return ret;
 }
 
-int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
-				       struct btrfs_fs_info *fs_info)
+int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans)
 {
 	u64 num_entries =
 		atomic_read(&trans->transaction->delayed_refs.num_entries);
@@ -2835,7 +2834,7 @@ int btrfs_should_throttle_delayed_refs(struct btrfs_trans_handle *trans,
 	u64 val;
 
 	smp_mb();
-	avg_runtime = fs_info->avg_delayed_ref_runtime;
+	avg_runtime = trans->fs_info->avg_delayed_ref_runtime;
 	val = num_entries * avg_runtime;
 	if (val >= NSEC_PER_SEC)
 		return 1;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 6a5557e8909d..f22f77172c5f 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4713,7 +4713,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
 				btrfs_abort_transaction(trans, ret);
 				break;
 			}
-			if (btrfs_should_throttle_delayed_refs(trans, fs_info))
+			if (btrfs_should_throttle_delayed_refs(trans))
 				btrfs_async_run_delayed_refs(fs_info,
 					trans->delayed_ref_updates * 2,
 					trans->transid, 0);
@@ -4722,8 +4722,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
 							 extent_num_bytes)) {
 					should_end = true;
 				}
-				if (btrfs_should_throttle_delayed_refs(trans,
-								       fs_info))
+				if (btrfs_should_throttle_delayed_refs(trans))
 					should_throttle = true;
 			}
 		}
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index c5015458c5c8..5686290a50e1 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -835,7 +835,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
 	trans->delayed_ref_updates = 0;
 	if (!trans->sync) {
 		must_run_delayed_refs =
-			btrfs_should_throttle_delayed_refs(trans, info);
+			btrfs_should_throttle_delayed_refs(trans);
 		cur = max_t(unsigned long, cur, 32);
 
 		/*
-- 
2.19.1




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

* [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables
  2018-10-11  5:40 [PATCH 0/6] Some trivail cleanup about dealyed-refs Lu Fengqi
                   ` (3 preceding siblings ...)
  2018-10-11  5:40 ` [PATCH 4/6] btrfs: remove fs_info from btrfs_should_throttle_delayed_refs Lu Fengqi
@ 2018-10-11  5:40 ` Lu Fengqi
  2018-10-11  6:40   ` Nikolay Borisov
  2018-10-11  5:40 ` [PATCH 6/6] btrfs: switch return_bigger to bool in find_ref_head Lu Fengqi
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Lu Fengqi @ 2018-10-11  5:40 UTC (permalink / raw)
  To: linux-btrfs

If the return value of find_ref_head() is NULL, the only possibility is
that delayed_refs' head ref rbtree is empty. Hence, the second
find_ref_head() is pointless.

Besides, the local variables loop and start are unnecessary, just remove
them.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 fs/btrfs/delayed-ref.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 885581852bea..2726d2fb4bbe 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -354,20 +354,11 @@ struct btrfs_delayed_ref_head *
 btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
 {
 	struct btrfs_delayed_ref_head *head;
-	u64 start;
-	bool loop = false;
 
 again:
-	start = delayed_refs->run_delayed_start;
-	head = find_ref_head(delayed_refs, start, 1);
-	if (!head && !loop) {
+	head = find_ref_head(delayed_refs, delayed_refs->run_delayed_start, 1);
+	if (!head) {
 		delayed_refs->run_delayed_start = 0;
-		start = 0;
-		loop = true;
-		head = find_ref_head(delayed_refs, start, 1);
-		if (!head)
-			return NULL;
-	} else if (!head && loop) {
 		return NULL;
 	}
 
@@ -376,11 +367,9 @@ btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
 
 		node = rb_next(&head->href_node);
 		if (!node) {
-			if (loop)
+			if (delayed_refs->run_delayed_start == 0)
 				return NULL;
 			delayed_refs->run_delayed_start = 0;
-			start = 0;
-			loop = true;
 			goto again;
 		}
 		head = rb_entry(node, struct btrfs_delayed_ref_head,
-- 
2.19.1




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

* [PATCH 6/6] btrfs: switch return_bigger to bool in find_ref_head
  2018-10-11  5:40 [PATCH 0/6] Some trivail cleanup about dealyed-refs Lu Fengqi
                   ` (4 preceding siblings ...)
  2018-10-11  5:40 ` [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables Lu Fengqi
@ 2018-10-11  5:40 ` Lu Fengqi
  2018-10-11  6:41 ` [PATCH 0/6] Some trivail cleanup about dealyed-refs Nikolay Borisov
  2018-10-11 11:51 ` David Sterba
  7 siblings, 0 replies; 17+ messages in thread
From: Lu Fengqi @ 2018-10-11  5:40 UTC (permalink / raw)
  To: linux-btrfs

Using bool is more suitable than int here, and add the comment about the
return_bigger.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
---
 fs/btrfs/delayed-ref.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 2726d2fb4bbe..61a19376239e 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -168,11 +168,12 @@ static struct btrfs_delayed_ref_node* tree_insert(struct rb_root_cached *root,
  * find an head entry based on bytenr. This returns the delayed ref
  * head if it was able to find one, or NULL if nothing was in that spot.
  * If return_bigger is given, the next bigger entry is returned if no exact
- * match is found.
+ * match is found. But if no bigger one is found then the first node of the
+ * ref head tree will be returned.
  */
 static struct btrfs_delayed_ref_head* find_ref_head(
 		struct btrfs_delayed_ref_root *dr, u64 bytenr,
-		int return_bigger)
+		bool return_bigger)
 {
 	struct rb_root *root = &dr->href_root.rb_root;
 	struct rb_node *n;
@@ -356,7 +357,8 @@ btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
 	struct btrfs_delayed_ref_head *head;
 
 again:
-	head = find_ref_head(delayed_refs, delayed_refs->run_delayed_start, 1);
+	head = find_ref_head(delayed_refs, delayed_refs->run_delayed_start,
+			     true);
 	if (!head) {
 		delayed_refs->run_delayed_start = 0;
 		return NULL;
@@ -894,7 +896,7 @@ int btrfs_add_delayed_extent_op(struct btrfs_fs_info *fs_info,
 struct btrfs_delayed_ref_head *
 btrfs_find_delayed_ref_head(struct btrfs_delayed_ref_root *delayed_refs, u64 bytenr)
 {
-	return find_ref_head(delayed_refs, bytenr, 0);
+	return find_ref_head(delayed_refs, bytenr, false);
 }
 
 void __cold btrfs_delayed_ref_exit(void)
-- 
2.19.1




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

* Re: [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables
  2018-10-11  5:40 ` [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables Lu Fengqi
@ 2018-10-11  6:40   ` Nikolay Borisov
  2018-10-11 12:15     ` Lu Fengqi
  0 siblings, 1 reply; 17+ messages in thread
From: Nikolay Borisov @ 2018-10-11  6:40 UTC (permalink / raw)
  To: Lu Fengqi, linux-btrfs



On 11.10.2018 08:40, Lu Fengqi wrote:
> If the return value of find_ref_head() is NULL, the only possibility is
> that delayed_refs' head ref rbtree is empty. Hence, the second
> find_ref_head() is pointless.
> > Besides, the local variables loop and start are unnecessary, just remove
> them.

So the objective of that function is to get a reference to the first
delayed head which is not processed. This is done by essentially keeping
track of the last range that was processed in
delayed_refs->run_delayed_start
> 
> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
> ---
>  fs/btrfs/delayed-ref.c | 17 +++--------------
>  1 file changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
> index 885581852bea..2726d2fb4bbe 100644
> --- a/fs/btrfs/delayed-ref.c
> +++ b/fs/btrfs/delayed-ref.c
> @@ -354,20 +354,11 @@ struct btrfs_delayed_ref_head *
>  btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
>  {
>  	struct btrfs_delayed_ref_head *head;
> -	u64 start;
> -	bool loop = false;
>  
>  again:
> -	start = delayed_refs->run_delayed_start;
> -	head = find_ref_head(delayed_refs, start, 1);
> -	if (!head && !loop) {
> +	head = find_ref_head(delayed_refs, delayed_refs->run_delayed_start, 1);
> +	if (!head) {
>  		delayed_refs->run_delayed_start = 0;
> -		start = 0;
> -		loop = true;
> -		head = find_ref_head(delayed_refs, start, 1);
> -		if (!head)
> -			return NULL;
> -	} else if (!head && loop) {

I believe this will have a negative impact since it actually will
prevent finding a head which was added BEFORE the last processed head.
So when a ref head is selected in btrfs_obtain_ref_head then the
delayed_refs->lock is dropped and the given head is locked and
delayed_refs->run_delayed_start points to the end of the selected range
that the head represents. At this point it's possible that another
thread modifies a different range which is before the one we have
selected so graphically it will be something like:


---[HEAD2]----->[HEAD1]------
0                            N

Where HEAD1 is the head returned from first invocation of
btrfs_obtain_ref_head. Once  btrfs_obtain_ref_head is called the 2nd
time it will not find HEAD2 so will just reset run_delayed_start to 0
and return. So it will be up to another run of the delayed refs to
actually find head2. Essentially you made btrfs_obtain_ref_head less
greedy. Have you characterized what kind of performance impact this have?




>  		return NULL;
>  	}
>  
> @@ -376,11 +367,9 @@ btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
>  
>  		node = rb_next(&head->href_node);
>  		if (!node) {
> -			if (loop)
> +			if (delayed_refs->run_delayed_start == 0)
>  				return NULL;
>  			delayed_refs->run_delayed_start = 0;
> -			start = 0;
> -			loop = true;
>  			goto again;
>  		}
>  		head = rb_entry(node, struct btrfs_delayed_ref_head,
> 

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

* Re: [PATCH 0/6] Some trivail cleanup about dealyed-refs
  2018-10-11  5:40 [PATCH 0/6] Some trivail cleanup about dealyed-refs Lu Fengqi
                   ` (5 preceding siblings ...)
  2018-10-11  5:40 ` [PATCH 6/6] btrfs: switch return_bigger to bool in find_ref_head Lu Fengqi
@ 2018-10-11  6:41 ` Nikolay Borisov
  2018-10-11 11:51 ` David Sterba
  7 siblings, 0 replies; 17+ messages in thread
From: Nikolay Borisov @ 2018-10-11  6:41 UTC (permalink / raw)
  To: Lu Fengqi, linux-btrfs



On 11.10.2018 08:40, Lu Fengqi wrote:
> There is no functional change. Just improve readablity.
> 
> PATCH 1-4 parameter cleanup patches
> PATCH 5 cleanup about btrfs_select_ref_head
> PATCH 6 switch int to bool; add some comment
> 
> Lu Fengqi (6):
>   btrfs: delayed-ref: pass delayed_refs directly to
>     btrfs_select_ref_head()
>   btrfs: delayed-ref: pass delayed_refs directly to
>     btrfs_delayed_ref_lock()
>   btrfs: remove fs_info from btrfs_check_space_for_delayed_refs
>   btrfs: remove fs_info from btrfs_should_throttle_delayed_refs
>   btrfs: simplify btrfs_select_ref_head and cleanup some local variables
>   btrfs: switch return_bigger to bool in find_ref_head

For patches 1-4 and 6:

Reviewed-by: Nikolay Borisov <nborisov@suse.com>


> 
>  fs/btrfs/ctree.h       |  6 ++----
>  fs/btrfs/delayed-ref.c | 35 ++++++++++-------------------------
>  fs/btrfs/delayed-ref.h |  4 ++--
>  fs/btrfs/extent-tree.c | 15 +++++++--------
>  fs/btrfs/inode.c       |  7 +++----
>  fs/btrfs/transaction.c |  4 ++--
>  6 files changed, 26 insertions(+), 45 deletions(-)
> 

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

* Re: [PATCH 0/6] Some trivail cleanup about dealyed-refs
  2018-10-11  5:40 [PATCH 0/6] Some trivail cleanup about dealyed-refs Lu Fengqi
                   ` (6 preceding siblings ...)
  2018-10-11  6:41 ` [PATCH 0/6] Some trivail cleanup about dealyed-refs Nikolay Borisov
@ 2018-10-11 11:51 ` David Sterba
  2018-10-15  2:39   ` Lu Fengqi
  7 siblings, 1 reply; 17+ messages in thread
From: David Sterba @ 2018-10-11 11:51 UTC (permalink / raw)
  To: Lu Fengqi; +Cc: linux-btrfs

On Thu, Oct 11, 2018 at 01:40:32PM +0800, Lu Fengqi wrote:
> There is no functional change. Just improve readablity.
> 
> PATCH 1-4 parameter cleanup patches
> PATCH 5 cleanup about btrfs_select_ref_head
> PATCH 6 switch int to bool; add some comment
> 
> Lu Fengqi (6):
>   btrfs: delayed-ref: pass delayed_refs directly to
>     btrfs_select_ref_head()
>   btrfs: delayed-ref: pass delayed_refs directly to
>     btrfs_delayed_ref_lock()
>   btrfs: remove fs_info from btrfs_check_space_for_delayed_refs
>   btrfs: remove fs_info from btrfs_should_throttle_delayed_refs
>   btrfs: simplify btrfs_select_ref_head and cleanup some local variables
>   btrfs: switch return_bigger to bool in find_ref_head

1-4 and 6 added to misc-next, thanks.

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

* Re: [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables
  2018-10-11  6:40   ` Nikolay Borisov
@ 2018-10-11 12:15     ` Lu Fengqi
  2018-10-11 12:28       ` Nikolay Borisov
  0 siblings, 1 reply; 17+ messages in thread
From: Lu Fengqi @ 2018-10-11 12:15 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Thu, Oct 11, 2018 at 09:40:52AM +0300, Nikolay Borisov wrote:
>
>
>On 11.10.2018 08:40, Lu Fengqi wrote:
>> If the return value of find_ref_head() is NULL, the only possibility is
>> that delayed_refs' head ref rbtree is empty. Hence, the second
>> find_ref_head() is pointless.
>> > Besides, the local variables loop and start are unnecessary, just remove
>> them.
>
>So the objective of that function is to get a reference to the first
>delayed head which is not processed. This is done by essentially keeping
>track of the last range that was processed in
>delayed_refs->run_delayed_start
>> 
>> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
>> ---
>>  fs/btrfs/delayed-ref.c | 17 +++--------------
>>  1 file changed, 3 insertions(+), 14 deletions(-)
>> 
>> diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
>> index 885581852bea..2726d2fb4bbe 100644
>> --- a/fs/btrfs/delayed-ref.c
>> +++ b/fs/btrfs/delayed-ref.c
>> @@ -354,20 +354,11 @@ struct btrfs_delayed_ref_head *
>>  btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
>>  {
>>  	struct btrfs_delayed_ref_head *head;
>> -	u64 start;
>> -	bool loop = false;
>>  
>>  again:
>> -	start = delayed_refs->run_delayed_start;
>> -	head = find_ref_head(delayed_refs, start, 1);
>> -	if (!head && !loop) {
>> +	head = find_ref_head(delayed_refs, delayed_refs->run_delayed_start, 1);
>> +	if (!head) {
>>  		delayed_refs->run_delayed_start = 0;
>> -		start = 0;
>> -		loop = true;
>> -		head = find_ref_head(delayed_refs, start, 1);
>> -		if (!head)
>> -			return NULL;
>> -	} else if (!head && loop) {
>
>I believe this will have a negative impact since it actually will
>prevent finding a head which was added BEFORE the last processed head.
>So when a ref head is selected in btrfs_obtain_ref_head then the
>delayed_refs->lock is dropped and the given head is locked and
>delayed_refs->run_delayed_start points to the end of the selected range
>that the head represents. At this point it's possible that another
>thread modifies a different range which is before the one we have
>selected so graphically it will be something like:
>
>
>---[HEAD2]----->[HEAD1]------
>0                            N
>
>Where HEAD1 is the head returned from first invocation of
>btrfs_obtain_ref_head. Once  btrfs_obtain_ref_head is called the 2nd
>time it will not find HEAD2 so will just reset run_delayed_start to 0
>and return. So it will be up to another run of the delayed refs to
>actually find head2. Essentially you made btrfs_obtain_ref_head less

Not exactly. In fact, find_ref_head hides such a logic. When
return_bigger is set, if there is no larger entry to return, the first
entry will be returned. Please see the comment I add in the PATCH 6.

Hence, the 2nd invocation of btrfs_obtain_ref_head still will return
HEAD2. There is no functional change here.

However, your question makes me consider whether such hidden logic
should be extracted from find_ref_head to btrfs_select_ref_head.

>greedy. Have you characterized what kind of performance impact this have?

I noticed that there is a macro called SCRAMBLE_DELAYED_REFS in the
extent-tree.c. I am a bit curious whether it has been forgotten by
everyone, I have not found any test results about its performance impact.

-- 
Thanks,
Lu

>
>
>
>
>>  		return NULL;
>>  	}
>>  
>> @@ -376,11 +367,9 @@ btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
>>  
>>  		node = rb_next(&head->href_node);
>>  		if (!node) {
>> -			if (loop)
>> +			if (delayed_refs->run_delayed_start == 0)
>>  				return NULL;
>>  			delayed_refs->run_delayed_start = 0;
>> -			start = 0;
>> -			loop = true;
>>  			goto again;
>>  		}
>>  		head = rb_entry(node, struct btrfs_delayed_ref_head,
>> 
>
>



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

* Re: [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables
  2018-10-11 12:15     ` Lu Fengqi
@ 2018-10-11 12:28       ` Nikolay Borisov
  2018-10-11 12:45         ` David Sterba
  2018-10-15  2:09         ` Lu Fengqi
  0 siblings, 2 replies; 17+ messages in thread
From: Nikolay Borisov @ 2018-10-11 12:28 UTC (permalink / raw)
  To: Lu Fengqi; +Cc: linux-btrfs



On 11.10.2018 15:15, Lu Fengqi wrote:
> On Thu, Oct 11, 2018 at 09:40:52AM +0300, Nikolay Borisov wrote:
>>
>>
>> On 11.10.2018 08:40, Lu Fengqi wrote:
>>> If the return value of find_ref_head() is NULL, the only possibility is
>>> that delayed_refs' head ref rbtree is empty. Hence, the second
>>> find_ref_head() is pointless.
>>>> Besides, the local variables loop and start are unnecessary, just remove
>>> them.
>>
>> So the objective of that function is to get a reference to the first
>> delayed head which is not processed. This is done by essentially keeping
>> track of the last range that was processed in
>> delayed_refs->run_delayed_start
>>>
>>> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
>>> ---
>>>  fs/btrfs/delayed-ref.c | 17 +++--------------
>>>  1 file changed, 3 insertions(+), 14 deletions(-)
>>>
>>> diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
>>> index 885581852bea..2726d2fb4bbe 100644
>>> --- a/fs/btrfs/delayed-ref.c
>>> +++ b/fs/btrfs/delayed-ref.c
>>> @@ -354,20 +354,11 @@ struct btrfs_delayed_ref_head *
>>>  btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
>>>  {
>>>  	struct btrfs_delayed_ref_head *head;
>>> -	u64 start;
>>> -	bool loop = false;
>>>  
>>>  again:
>>> -	start = delayed_refs->run_delayed_start;
>>> -	head = find_ref_head(delayed_refs, start, 1);
>>> -	if (!head && !loop) {
>>> +	head = find_ref_head(delayed_refs, delayed_refs->run_delayed_start, 1);
>>> +	if (!head) {
>>>  		delayed_refs->run_delayed_start = 0;
>>> -		start = 0;
>>> -		loop = true;
>>> -		head = find_ref_head(delayed_refs, start, 1);
>>> -		if (!head)
>>> -			return NULL;
>>> -	} else if (!head && loop) {
>>
>> I believe this will have a negative impact since it actually will
>> prevent finding a head which was added BEFORE the last processed head.
>> So when a ref head is selected in btrfs_obtain_ref_head then the
>> delayed_refs->lock is dropped and the given head is locked and
>> delayed_refs->run_delayed_start points to the end of the selected range
>> that the head represents. At this point it's possible that another
>> thread modifies a different range which is before the one we have
>> selected so graphically it will be something like:
>>
>>
>> ---[HEAD2]----->[HEAD1]------
>> 0                            N
>>
>> Where HEAD1 is the head returned from first invocation of
>> btrfs_obtain_ref_head. Once  btrfs_obtain_ref_head is called the 2nd
>> time it will not find HEAD2 so will just reset run_delayed_start to 0
>> and return. So it will be up to another run of the delayed refs to
>> actually find head2. Essentially you made btrfs_obtain_ref_head less
> 
> Not exactly. In fact, find_ref_head hides such a logic. When
> return_bigger is set, if there is no larger entry to return, the first
> entry will be returned. Please see the comment I add in the PATCH 6.
> 
> Hence, the 2nd invocation of btrfs_obtain_ref_head still will return
> HEAD2. There is no functional change here.
> 
> However, your question makes me consider whether such hidden logic
> should be extracted from find_ref_head to btrfs_select_ref_head.

Right I agree with your. As it stands I will expect that if
return_bigger is true to specifically return a bigger entry or if
nothing is found to return null. IMO this behavior is higher level and
belongs to btrfs_delayed_ref_head.

> 
>> greedy. Have you characterized what kind of performance impact this have?
> 
> I noticed that there is a macro called SCRAMBLE_DELAYED_REFS in the
> extent-tree.c. I am a bit curious whether it has been forgotten by
> everyone, I have not found any test results about its performance impact.

I guess it was used during testing but nothing currently sets it. I.e it
might make sense to enable it if BTRFS_DEBUG is set.

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

* Re: [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables
  2018-10-11 12:28       ` Nikolay Borisov
@ 2018-10-11 12:45         ` David Sterba
  2018-10-15  2:32           ` Lu Fengqi
  2018-10-15  2:09         ` Lu Fengqi
  1 sibling, 1 reply; 17+ messages in thread
From: David Sterba @ 2018-10-11 12:45 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: Lu Fengqi, linux-btrfs

On Thu, Oct 11, 2018 at 03:28:15PM +0300, Nikolay Borisov wrote:
> > I noticed that there is a macro called SCRAMBLE_DELAYED_REFS in the
> > extent-tree.c. I am a bit curious whether it has been forgotten by
> > everyone, I have not found any test results about its performance impact.
> 
> I guess it was used during testing but nothing currently sets it. I.e it
> might make sense to enable it if BTRFS_DEBUG is set.

Agreed, the way the scrambling is supposed to be used does not align
very well with the typical testing workflow so adding to ti the
BTRFS_DEBUG set is ok, unless there are severe performance problems.

The part in btrfs_run_delayed_refs would be better hidden in a function
similar to btrfs_debug_check_extent_io_range or btrfs_leak_debug_check.

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

* Re: [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables
  2018-10-11 12:28       ` Nikolay Borisov
  2018-10-11 12:45         ` David Sterba
@ 2018-10-15  2:09         ` Lu Fengqi
  1 sibling, 0 replies; 17+ messages in thread
From: Lu Fengqi @ 2018-10-15  2:09 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Thu, Oct 11, 2018 at 03:28:15PM +0300, Nikolay Borisov wrote:
>
>
>On 11.10.2018 15:15, Lu Fengqi wrote:
>> On Thu, Oct 11, 2018 at 09:40:52AM +0300, Nikolay Borisov wrote:
>>>
>>>
>>> On 11.10.2018 08:40, Lu Fengqi wrote:
>>>> If the return value of find_ref_head() is NULL, the only possibility is
>>>> that delayed_refs' head ref rbtree is empty. Hence, the second
>>>> find_ref_head() is pointless.
>>>>> Besides, the local variables loop and start are unnecessary, just remove
>>>> them.
>>>
>>> So the objective of that function is to get a reference to the first
>>> delayed head which is not processed. This is done by essentially keeping
>>> track of the last range that was processed in
>>> delayed_refs->run_delayed_start
>>>>
>>>> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
>>>> ---
>>>>  fs/btrfs/delayed-ref.c | 17 +++--------------
>>>>  1 file changed, 3 insertions(+), 14 deletions(-)
>>>>
>>>> diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
>>>> index 885581852bea..2726d2fb4bbe 100644
>>>> --- a/fs/btrfs/delayed-ref.c
>>>> +++ b/fs/btrfs/delayed-ref.c
>>>> @@ -354,20 +354,11 @@ struct btrfs_delayed_ref_head *
>>>>  btrfs_select_ref_head(struct btrfs_delayed_ref_root *delayed_refs)
>>>>  {
>>>>  	struct btrfs_delayed_ref_head *head;
>>>> -	u64 start;
>>>> -	bool loop = false;
>>>>  
>>>>  again:
>>>> -	start = delayed_refs->run_delayed_start;
>>>> -	head = find_ref_head(delayed_refs, start, 1);
>>>> -	if (!head && !loop) {
>>>> +	head = find_ref_head(delayed_refs, delayed_refs->run_delayed_start, 1);
>>>> +	if (!head) {
>>>>  		delayed_refs->run_delayed_start = 0;
>>>> -		start = 0;
>>>> -		loop = true;
>>>> -		head = find_ref_head(delayed_refs, start, 1);
>>>> -		if (!head)
>>>> -			return NULL;
>>>> -	} else if (!head && loop) {
>>>
>>> I believe this will have a negative impact since it actually will
>>> prevent finding a head which was added BEFORE the last processed head.
>>> So when a ref head is selected in btrfs_obtain_ref_head then the
>>> delayed_refs->lock is dropped and the given head is locked and
>>> delayed_refs->run_delayed_start points to the end of the selected range
>>> that the head represents. At this point it's possible that another
>>> thread modifies a different range which is before the one we have
>>> selected so graphically it will be something like:
>>>
>>>
>>> ---[HEAD2]----->[HEAD1]------
>>> 0                            N
>>>
>>> Where HEAD1 is the head returned from first invocation of
>>> btrfs_obtain_ref_head. Once  btrfs_obtain_ref_head is called the 2nd
>>> time it will not find HEAD2 so will just reset run_delayed_start to 0
>>> and return. So it will be up to another run of the delayed refs to
>>> actually find head2. Essentially you made btrfs_obtain_ref_head less
>> 
>> Not exactly. In fact, find_ref_head hides such a logic. When
>> return_bigger is set, if there is no larger entry to return, the first
>> entry will be returned. Please see the comment I add in the PATCH 6.
>> 
>> Hence, the 2nd invocation of btrfs_obtain_ref_head still will return
>> HEAD2. There is no functional change here.
>> 
>> However, your question makes me consider whether such hidden logic
>> should be extracted from find_ref_head to btrfs_select_ref_head.
>
>Right I agree with your. As it stands I will expect that if
>return_bigger is true to specifically return a bigger entry or if
>nothing is found to return null. IMO this behavior is higher level and

This is also exactly what I want. The patch is on the way.

>belongs to btrfs_delayed_ref_head.
>
>> 
>>> greedy. Have you characterized what kind of performance impact this have?
>> 
>> I noticed that there is a macro called SCRAMBLE_DELAYED_REFS in the
>> extent-tree.c. I am a bit curious whether it has been forgotten by
>> everyone, I have not found any test results about its performance impact.
>
>I guess it was used during testing but nothing currently sets it. I.e it
>might make sense to enable it if BTRFS_DEBUG is set.
>

Make sense.

-- 
Thanks,
Lu



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

* Re: [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables
  2018-10-11 12:45         ` David Sterba
@ 2018-10-15  2:32           ` Lu Fengqi
  0 siblings, 0 replies; 17+ messages in thread
From: Lu Fengqi @ 2018-10-15  2:32 UTC (permalink / raw)
  To: dsterba, Nikolay Borisov, linux-btrfs

On Thu, Oct 11, 2018 at 02:45:04PM +0200, David Sterba wrote:
>On Thu, Oct 11, 2018 at 03:28:15PM +0300, Nikolay Borisov wrote:
>> > I noticed that there is a macro called SCRAMBLE_DELAYED_REFS in the
>> > extent-tree.c. I am a bit curious whether it has been forgotten by
>> > everyone, I have not found any test results about its performance impact.
>> 
>> I guess it was used during testing but nothing currently sets it. I.e it
>> might make sense to enable it if BTRFS_DEBUG is set.
>
>Agreed, the way the scrambling is supposed to be used does not align
>very well with the typical testing workflow so adding to ti the
>BTRFS_DEBUG set is ok, unless there are severe performance problems.

I will add it to the BTRFS_DEBUG set, and test if it has severe
performance problems.

>
>The part in btrfs_run_delayed_refs would be better hidden in a function
>similar to btrfs_debug_check_extent_io_range or btrfs_leak_debug_check.

Got it.

-- 
Thanks,
Lu



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

* Re: [PATCH 0/6] Some trivail cleanup about dealyed-refs
  2018-10-11 11:51 ` David Sterba
@ 2018-10-15  2:39   ` Lu Fengqi
  2018-10-15 13:26     ` David Sterba
  0 siblings, 1 reply; 17+ messages in thread
From: Lu Fengqi @ 2018-10-15  2:39 UTC (permalink / raw)
  To: dsterba, linux-btrfs

On Thu, Oct 11, 2018 at 01:51:37PM +0200, David Sterba wrote:
>On Thu, Oct 11, 2018 at 01:40:32PM +0800, Lu Fengqi wrote:
>> There is no functional change. Just improve readablity.
>> 
>> PATCH 1-4 parameter cleanup patches
>> PATCH 5 cleanup about btrfs_select_ref_head
>> PATCH 6 switch int to bool; add some comment
>> 
>> Lu Fengqi (6):
>>   btrfs: delayed-ref: pass delayed_refs directly to
>>     btrfs_select_ref_head()
>>   btrfs: delayed-ref: pass delayed_refs directly to
>>     btrfs_delayed_ref_lock()
>>   btrfs: remove fs_info from btrfs_check_space_for_delayed_refs
>>   btrfs: remove fs_info from btrfs_should_throttle_delayed_refs
>>   btrfs: simplify btrfs_select_ref_head and cleanup some local variables
>>   btrfs: switch return_bigger to bool in find_ref_head
>
>1-4 and 6 added to misc-next, thanks.

There is not patch 2 at the misc-next branch. So it was forgotten?

-- 
Thanks,
Lu



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

* Re: [PATCH 0/6] Some trivail cleanup about dealyed-refs
  2018-10-15  2:39   ` Lu Fengqi
@ 2018-10-15 13:26     ` David Sterba
  0 siblings, 0 replies; 17+ messages in thread
From: David Sterba @ 2018-10-15 13:26 UTC (permalink / raw)
  To: Lu Fengqi; +Cc: dsterba, linux-btrfs

On Mon, Oct 15, 2018 at 10:39:19AM +0800, Lu Fengqi wrote:
> On Thu, Oct 11, 2018 at 01:51:37PM +0200, David Sterba wrote:
> >On Thu, Oct 11, 2018 at 01:40:32PM +0800, Lu Fengqi wrote:
> >> There is no functional change. Just improve readablity.
> >> 
> >> PATCH 1-4 parameter cleanup patches
> >> PATCH 5 cleanup about btrfs_select_ref_head
> >> PATCH 6 switch int to bool; add some comment
> >> 
> >> Lu Fengqi (6):
> >>   btrfs: delayed-ref: pass delayed_refs directly to
> >>     btrfs_select_ref_head()
> >>   btrfs: delayed-ref: pass delayed_refs directly to
> >>     btrfs_delayed_ref_lock()
> >>   btrfs: remove fs_info from btrfs_check_space_for_delayed_refs
> >>   btrfs: remove fs_info from btrfs_should_throttle_delayed_refs
> >>   btrfs: simplify btrfs_select_ref_head and cleanup some local variables
> >>   btrfs: switch return_bigger to bool in find_ref_head
> >
> >1-4 and 6 added to misc-next, thanks.
> 
> There is not patch 2 at the misc-next branch. So it was forgotten?

You're right, got lost somewhere, now in misc-next. Thanks for checking.

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

end of thread, other threads:[~2018-10-15 13:26 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-11  5:40 [PATCH 0/6] Some trivail cleanup about dealyed-refs Lu Fengqi
2018-10-11  5:40 ` [PATCH 1/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_select_ref_head() Lu Fengqi
2018-10-11  5:40 ` [PATCH 2/6] btrfs: delayed-ref: pass delayed_refs directly to btrfs_delayed_ref_lock() Lu Fengqi
2018-10-11  5:40 ` [PATCH 3/6] btrfs: remove fs_info from btrfs_check_space_for_delayed_refs Lu Fengqi
2018-10-11  5:40 ` [PATCH 4/6] btrfs: remove fs_info from btrfs_should_throttle_delayed_refs Lu Fengqi
2018-10-11  5:40 ` [PATCH 5/6] btrfs: simplify btrfs_select_ref_head and cleanup some local variables Lu Fengqi
2018-10-11  6:40   ` Nikolay Borisov
2018-10-11 12:15     ` Lu Fengqi
2018-10-11 12:28       ` Nikolay Borisov
2018-10-11 12:45         ` David Sterba
2018-10-15  2:32           ` Lu Fengqi
2018-10-15  2:09         ` Lu Fengqi
2018-10-11  5:40 ` [PATCH 6/6] btrfs: switch return_bigger to bool in find_ref_head Lu Fengqi
2018-10-11  6:41 ` [PATCH 0/6] Some trivail cleanup about dealyed-refs Nikolay Borisov
2018-10-11 11:51 ` David Sterba
2018-10-15  2:39   ` Lu Fengqi
2018-10-15 13:26     ` David Sterba

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.