]> git.itanic.dy.fi Git - scan-pagemap/commitdiff
pf_insert: Return matching node on insert
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Mon, 11 Jun 2012 15:32:10 +0000 (18:32 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Mon, 11 Jun 2012 15:36:10 +0000 (18:36 +0300)
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 <timo.t.kokkonen@iki.fi>
treeops.c

index feaca58fbf1e14b1baf72df94da8d1f8f368540e..ff698a0033059444a147d4557ce022406728270d 100644 (file)
--- 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. */