/* The idea is to avoid adding buffers to pages that don't already have them. So when the buffer is up to date and the page size == block size, this marks the page up to date instead of adding new buffers.  */
static void map_buffer_to_page(struct page *page, struct buffer_head *bh, int page_block)
/* The idea is to avoid adding buffers to pages that don't already have them. So when the buffer is up to date and the page size == block size, this marks the page up to date instead of adding new buffers.  */
static void map_buffer_to_page(struct page *page, struct buffer_head *bh, int page_block)
{
	struct inode *inode = page->mapping->host;
	struct buffer_head *page_bh, *head;
	int block = 0;
	if (!page_has_buffers(page)) {
		if (inode->i_blkbits == PAGE_CACHE_SHIFT && 
		    buffer_uptodate(bh)) {
			SetPageUptodate(page);    
			return;
		}
		create_empty_buffers(page, 1 << inode->i_blkbits, 0);
	}
	head = page_buffers(page);
	page_bh = head;
	do {
		if (block == page_block) {
			page_bh->b_state = bh->b_state;
			page_bh->b_bdev = bh->b_bdev;
			page_bh->b_blocknr = bh->b_blocknr;
			break;
		}
		page_bh = page_bh->b_this_page;
		block++;
	} while (page_bh != head);
}