/* basic invalidatepage code, this waits on any locked or writeback ranges corresponding to the page, and then deletes any extent state records from the tree  */
int extent_invalidatepage(struct extent_io_tree *tree, struct page *page, unsigned long offset)
/* basic invalidatepage code, this waits on any locked or writeback ranges corresponding to the page, and then deletes any extent state records from the tree  */
int extent_invalidatepage(struct extent_io_tree *tree, struct page *page, unsigned long offset)
{
	u64 start = ((u64)page->index << PAGE_CACHE_SHIFT);
	u64 end = start + PAGE_CACHE_SIZE - 1;
	size_t blocksize = page->mapping->host->i_sb->s_blocksize;
	start += (offset + blocksize - 1) & ~(blocksize - 1);
	if (start > end)
		return 0;
	lock_extent(tree, start, end, GFP_NOFS);
	wait_on_page_writeback(page);
	clear_extent_bit(tree, start, end,
			 EXTENT_LOCKED | EXTENT_DIRTY | EXTENT_DELALLOC |
			 EXTENT_DO_ACCOUNTING,
			 1, 1, NULL, GFP_NOFS);
	return 0;
}