/* Note: Should always be called with the Page Lock held to prevent races if we have to add a new request. Also assumes that the caller has already called nfs_flush_incompatible() if necessary.  */
static struct nfs_page* nfs_setup_write_request(struct nfs_open_context *ctx, struct page *page, unsigned int offset, unsigned int bytes)
/* Note: Should always be called with the Page Lock held to prevent races if we have to add a new request. Also assumes that the caller has already called nfs_flush_incompatible() if necessary.  */
static struct nfs_page* nfs_setup_write_request(struct nfs_open_context *ctx, struct page *page, unsigned int offset, unsigned int bytes)
{
	struct inode *inode = page->mapping->host;
	struct nfs_page	*req;
	int error;
	req = nfs_try_to_update_request(inode, page, offset, bytes);
	if (req != NULL)
		goto out;
	req = nfs_create_request(ctx, inode, page, offset, bytes);
	if (IS_ERR(req))
		goto out;
	error = nfs_inode_add_request(inode, req);
	if (error != 0) {
		nfs_release_request(req);
		req = ERR_PTR(error);
	}
out:
	return req;
}