From: Jan Kara on 11 Feb 2010 18:10 Make some paranoic checks to verify that code does what it's expected to do. Signed-off-by: Jan Kara <jack(a)suse.cz> --- mm/page-writeback.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index f37cbc2..a389feb 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -822,6 +822,45 @@ void tag_pages_for_writeback(struct address_space *mapping, spin_lock_irq(&mapping->tree_lock); radix_tree_gang_tag_if_tagged(&mapping->page_tree, start, end, PAGECACHE_TAG_DIRTY, PAGECACHE_TAG_TOWRITE); + /* Debugging aid */ + { + int i; + pgoff_t index; + unsigned int nr_pages; + struct pagevec pvec; + + index = start; + do { + nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, + PAGECACHE_TAG_DIRTY, + min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1); + for (i = 0; i < nr_pages; i++) { + if (pvec.pages[i]->index > end) { + nr_pages = 0; + break; + } + if (!radix_tree_tag_get(&mapping->page_tree, pvec.pages[i]->index, PAGECACHE_TAG_TOWRITE)) + printk("Seeing DIRTY !TOWRITE page %lu, state %lu\n", pvec.pages[i]->index, pvec.pages[i]->flags); + } + pagevec_release(&pvec); + } while (nr_pages); + + index = start; + do { + nr_pages = pagevec_lookup_tag(&pvec, mapping, &index, + PAGECACHE_TAG_TOWRITE, + min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1); + for (i = 0; i < nr_pages; i++) { + if (pvec.pages[i]->index > end) { + nr_pages = 0; + break; + } + if (!radix_tree_tag_get(&mapping->page_tree, pvec.pages[i]->index, PAGECACHE_TAG_DIRTY)) + printk("Seeing !DIRTY TOWRITE page %lu, state %lu\n", pvec.pages[i]->index, pvec.pages[i]->flags); + } + pagevec_release(&pvec); + } while (nr_pages); + } spin_unlock_irq(&mapping->tree_lock); } EXPORT_SYMBOL(tag_pages_for_writeback); -- 1.6.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: Linux mdadm superblock question. Next: [PATCH 0/4] Better sysfs lockdep |