From 387d64a18ba6f25bd08136ddd9ed6d3ade95aa8d Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 3 Aug 2005 10:20:08 +0000 Subject: [PATCH] b=7049 - let's check whether dirty pages/buffers in bd-mapping --- lustre/obdfilter/filter_io_26.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/lustre/obdfilter/filter_io_26.c b/lustre/obdfilter/filter_io_26.c index b594e83..c3451d3 100644 --- a/lustre/obdfilter/filter_io_26.c +++ b/lustre/obdfilter/filter_io_26.c @@ -295,7 +295,42 @@ int filter_do_bio(struct obd_device *obd, struct inode *inode, rc = dreq->dr_error; RETURN(rc); } - + +static void check_metadata(struct super_block *sb, sector_t block) +{ + struct inode *bd_inode = sb->s_bdev->bd_inode; + struct address_space *bd_mapping = bd_inode->i_mapping; + pgoff_t index; + struct buffer_head *bh; + struct buffer_head *head; + struct page *page; + + index = block >> (PAGE_CACHE_SHIFT - bd_inode->i_blkbits); + page = find_get_page(bd_mapping, index); + if (!page) + return; + + if (PageDirty(page)) + CERROR("page 0x%p/%lu is dirty\n", page, page->index); + + spin_lock(&bd_mapping->private_lock); + if (!page_has_buffers(page)) + goto out_unlock; + head = page_buffers(page); + bh = head; + do { + if (buffer_dirty(bh)) + CERROR("buffer 0x%p in page 0x%p/%lu is dirty\n", + bh, page, page->index); + bh = bh->b_this_page; + } while (bh != head); + +out_unlock: + spin_unlock(&bd_mapping->private_lock); + page_cache_release(page); + return; +} + /* These are our hacks to keep our directio/bh IO coherent with ext3's * page cache use. Most notably ext3 reads file data into the page * cache when it is zeroing the tail of partial-block truncates and @@ -342,6 +377,8 @@ static int filter_clear_page_cache(struct inode *inode, unlock_page(page); page_cache_release(page); + + check_metadata(inode->i_sb, iobuf->dr_pages[i]->index); } return 0; } -- 1.8.3.1