Add page forking helpers

This adds the following 3 helpers for page forking.

	cow_replace_page_cache()
	cow_delete_from_page_cache()
	cow_clone_page()

cow_replace_page_cache(): this is similar to
replace_page_cache_page(), but using radix_tree_replace_slot(), and
page forking aware.

cow_delete_from_page_cache(): this is similar to
delete_from_page_cache(), but deleted page is still used for I/O, not
freeing.

cow_clone_page(): this makes copy of original page.

All of above needs to be in core, because of unexported functions.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
tux3: Remove page forking helpers was moved to core

This removes the following helpers, and replaces new helpers

	tux3_replace_page_cache() => cow_replace_page_cache()
	tux3_delete_from_page_cache() => cow_delete_from_page_cache()
	clone_page() => cow_clone_page() + tux3_clone_page()

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
tux3: Make save_sb() static

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Merge branch 'master' into user

* hirofumi:
  tux3: Add async I/O helper
  tux3: Use bio_end_io_t instead of void (*end_io)(struct bio *, int)
  tux3: Make save_sb() static
  tux3: Remove page forking helpers was moved to core
  Add page forking helpers
tux3: Add same I/O APIs with kernel

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
tux3: Use bio_end_io_t instead of void (*end_io)(struct bio *, int)

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
tux3: Add async I/O helper

To submit buffer_head easily, this adds APIs for it.

At first, renames some sync APIs

	blockio()	=> blockio_sync()
	devio()		=> devio_sync()

Then, adds async API as blockio().

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
tux3: Support random order I/O on volmap (volmap 2 phases I/O)

We want to submit I/O by random order (not logical/physical order)
for volmap. Because, for example, we want to flush dleaf with
nearby data pages earlier than ileaf.

But random order has the issue of dirty => clean state on the page.
Because we can't know when random order buffer I/O is done finally.
(while checking last I/O, another I/O can be started.)  This means
we would need some sort of IRQ safe locking for each submit_io and
end_io.

To avoid IRQ safe locking for each buffers, this uses 2 phases I/O.

The 1st phase just submits I/O and increment number of I/O in the delta,
and the 1st phase doesn't touch state of buffer or page at all.
With this, we just update on-disk data without modify in-core state.

After the 1st phase was done, and confirmed all I/O in the delta
was done, we start the 2nd phase to update in-core state.  We know
all state can be clean in the delta.

Because we have stable in-core state in the delta. If frontend
tried to re-dirty same buffer, frontend has to page forking then.
So at the 2nd phase, we walk all buffers, and we set all
buffers/pages pages clean.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
tux3: Consolidate part of clean_state() and prepare_and_lock_page()

clean_state() cleans page and buffer state, this is same with
bufvec_prepare_and_lock_page(). So this consolidate those.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
tux3: Optimize tux3_volmap_early_io()

This changes tux3_volmap_early_io() to add multiple contiguous
buffers into a bio, and submit buffers at once.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Merge branch 'master' into user

* hirofumi:
  tux3: Optimize tux3_volmap_early_io()
  tux3: Consolidate part of clean_state() and prepare_and_lock_page()
  tux3: Support random order I/O on volmap (volmap 2 phases I/O)
tux3: userland build fixes by 2 phases io changes for volmap

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>