[PATCH] btt:Release overlapping IO after it is replaced in RB-tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux