/* write_page - Write one page to given swap location. @buf: Address we're writing. @offset: Offset of the swap page we're writing to. @bio_chain: Link the next write BIO here  */
static int write_page(void *buf, sector_t offset, struct bio **bio_chain)
/* write_page - Write one page to given swap location. @buf: Address we're writing. @offset: Offset of the swap page we're writing to. @bio_chain: Link the next write BIO here  */
static int write_page(void *buf, sector_t offset, struct bio **bio_chain)
{
	void *src;
	if (!offset)
		return -ENOSPC;
	if (bio_chain) {
		src = (void *)__get_free_page(__GFP_WAIT | __GFP_HIGH);
		if (src) {
			memcpy(src, buf, PAGE_SIZE);
		} else {
			WARN_ON_ONCE(1);
			bio_chain = NULL;
			src = buf;
		}
	} else {
		src = buf;
	}
	return bio_write_page(offset, src, bio_chain);
}