]> git.itanic.dy.fi Git - scan-pagemap/commitdiff
parse_pageframe: Fully ignore all unused pages
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Fri, 16 Jul 2010 12:00:22 +0000 (15:00 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Fri, 16 Jul 2010 12:00:22 +0000 (15:00 +0300)
The pagemap data read from the file might contain only the page shift
field, nothing else. That kind of pages are really not useful, so they
can be skipped.

Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
parse.c

diff --git a/parse.c b/parse.c
index 096c4ef685ad8bce81118c4f9a79995bd4fddda5..8895173a2e9f511018dd8b478d55030f6e33205b 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -185,6 +185,11 @@ static int parse_pageframe(FILE *file, struct pageframe *pf_tree,
 
                        pageframe_to_struct(pf[ret / sizeof(pf[0])], pageframe);
 
+                       /* ignore unused pages */
+                       if (!(pageframe->page_swapped ||
+                                       pageframe->page_present))
+                               continue;
+
                        if (check_parse_opts(opts, pageframe, map)) {
                                match = tree_to_pageframe(
                                        bintree_add(&pf_tree->tree,