btrfs: convert manual iteration to immutable biovec iteration

Use the new API with immutable biovec and bvec_iter, instead of
old-fashioned traversal through bi_io_vec[].
Follow up of 9e96618c ("btrfs: Convert to bio_for_each_segment()").

Signed-off-by: Dongsu Park <dongsu.park@profitbricks.com>
btrfs: use a correct function for bvec iteration in btrfs_csum_one_bio()

Commit 94607a8a("block: Convert various code to bio_for_each_page()")
introduced a critical bug in btrfs_csum_one_bio() using
bio_for_each_page_all() for iterating through each bvec.
That should actually call bio_for_each_page() to take the current
offset into account. Without this fix, xfstests/btrfs/012 would
end up with lockup with warnings in btrfs_add_ordered_sum(), because
iter.bi_size becomes < 0.

Signed-off-by: Dongsu Park <dongsu.park@profitbricks.com>
Multipage bvecs

Convert merging to bio_add_page()/blk_max_segment()

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
kill ll_merge_requests_fn

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
block: fix compile errors

Fix various compile errors,
e.g. getting rid of BIOVEC_PHYS_MERGEABLE, using bvec instead of sg,
set bio as the 2nd arg of __blk_segment_map_sg(), etc.
block: plugging

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
[dpark: fix compile errors]
md: get rid of bio_list from struct task
blk-mq: remove also remaining calls to blk_attempt_plug_merge()
direct-io: Rewrite based on immutable biovecs

Near total rewrite of fs/direct-io.c. This makes use of our new bio
splitting functionality, and the fact that generic_make_request() will
take arbitrary size bios - we allocate a bio, pin pages to it directly,
then call the getblocks() function to map it wherever the filesystem
tells us - splitting as needed.

Appears to pass xfstests with CONFIG_XFS_DEBUG=y (would appreciate testing from
someone who uses xfstests more than I).

Doesn't quite work with btrfs yet - when running xfstests it eventually get
stuck in an infinite loop somewhere. First thing in the kernel log is a warning
at fs/btrfs/ordered-data.c:288 in btrfs_add_ordered_sum() - if any of the btrfs
people want to take a look that would be a great help.

It _definitely_ needs review/auditing from someone intimately familiar with the
expected behaviour w.r.t. everything related to filesystem semantics and the
handling of the getblocks() call - dio_send_bio() is what primarily implements
that behaviour.

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
dio: use submit_io() for block zeroing
block: kill bio_get_nr_vecs()

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
btrfs: fix compile error on calling btrfs_dio_bio_alloc()
foo

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
more dio rewriting
fs/dio: wait for completion for dio inside the loop

Fix compile errors, by waiting for completion for dio inside loop,
as well as checking dio->async instead of dio->refcount.