linux-btrace.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btt:Release overlapping IO after it is replaced in RB-tree
@ 2021-09-08 22:12 songkai
  0 siblings, 0 replies; only message in thread
From: songkai @ 2021-09-08 22:12 UTC (permalink / raw)
  To: linux-btrace

Currently btt replaces the older IO when finding out new IO that is
beginning at the same sector.But the older IO will not be released
until btt exits, when calling io_free_all(),this is a waste of memory.
So,we can free the original IO after replacing it from RB-tree,avoiding
useless memory occupation when btt is running.

Signed-off-by: songkai <songkai01@inspur.com>
---
 btt/dip_rb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/btt/dip_rb.c b/btt/dip_rb.c
index 6efef6c..2cfda90 100644
--- a/btt/dip_rb.c
+++ b/btt/dip_rb.c
@@ -39,6 +39,11 @@ int rb_insert(struct rb_root *root, struct io *iop)
 			p = &(*p)->rb_right;
 		else {
 			rb_replace_node(parent, &iop->rb_node, root);
+
+			if (__iop->pdu)
+				free(__iop->pdu);
+			io_free(__iop);
+
 			return 1;
 		}
 	}
-- 
2.27.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-08 22:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-08 22:12 [PATCH] btt:Release overlapping IO after it is replaced in RB-tree songkai

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).