From: Timo Kokkonen Date: Mon, 11 Jun 2012 15:32:10 +0000 (+0300) Subject: pf_insert: Return matching node on insert X-Git-Url: http://git.itanic.dy.fi/?p=scan-pagemap;a=commitdiff_plain;h=1273c6165f1785093d70ac5e98e140b15bb6e0d5 pf_insert: Return matching node on insert When a matching entry is found from the rb_tree, the insert function should return the found entry from the tree to the caller. This is also explicitly documented in the code. However, the code incorrectly returned NULL instead. Fix the code to return the match as it should do. Without this fix identical pageframe entries are never located. Signed-off-by: Timo Kokkonen --- diff --git a/treeops.c b/treeops.c index feaca58..ff698a0 100644 --- a/treeops.c +++ b/treeops.c @@ -20,7 +20,7 @@ struct pageframe *pf_insert(struct rb_root *root, struct pageframe *pf) * tree. Return that node to indicate the * collision */ - return NULL; + return this; } /* Add new node and rebalance tree. */