/* Find or create a page at the given pagecache position. Return the locked page. This function is specifically for buffered writes.  */
struct page* grab_cache_page_write_begin(struct address_space *mapping, pgoff_t index, unsigned flags)
/* Find or create a page at the given pagecache position. Return the locked page. This function is specifically for buffered writes.  */
struct page* grab_cache_page_write_begin(struct address_space *mapping, pgoff_t index, unsigned flags)
{
	int status;
	struct page *page;
	gfp_t gfp_notmask = 0;
	if (flags & AOP_FLAG_NOFS)
		gfp_notmask = __GFP_FS;
repeat:
	page = find_lock_page(mapping, index);
	if (likely(page))
		return page;
	page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask);
	if (!page)
		return NULL;
	status = add_to_page_cache_lru(page, mapping, index,
						GFP_KERNEL & ~gfp_notmask);
	if (unlikely(status)) {
		page_cache_release(page);
		if (status == -EEXIST)
			goto repeat;
		return NULL;
	}
	return page;
}