Btrfs: subpagesize-blocksize: Get rid of whole page reads.

bio_vec->{bv_offset, bv_len} cannot be relied upon by the end bio functions
to track the file offset range operated on by the bio. Hence this patch adds
two new members to 'struct btrfs_io_bio' to track the file offset range.

This patch also brings back check_page_locked() to reliably unlock pages in
readpage's end bio function.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Btrfs: subpagesize-blocksize: Get rid of whole page writes.

This commit brings back functions that set/clear EXTENT_WRITEBACK bits. These
are required to reliably clear PG_writeback page flag.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Btrfs: subpagesize-blocksize: Work with extents aligned to blocksize.

This is a small part of a bigger set of fixes needed to get
subpagesize-blocksize to function properly. This patch is required to get 2k
blocksize writes to work correctly.

Without this patch, In lock_and_cleanup_extent_if_need() two consecutive 2k
block writes that map to first and second 2k parts of a 4k page would result
in the second 2k write to *clear* out the EXTENT_DELALLOC bit of the first 2k
block. Fix this.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Btrfs: subpagesize-blocksize: Define extent_buffer_head

In order to handle multiple extent buffers per page, first we
need to create a way to handle all the extent buffers that
are attached to a page.

This patch creates a new data structure eb_head, and moves
fields that are common to all extent buffers in a page from
extent buffer to eb_head.

This also adds changes that are needed to handle multiple
extent buffers per page case.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Btrfs: subpagesize-blocksize: Hardcode MAX_EXTENT_BUFFERS_PER_PAGE to 2.

With 2k blocksize the maximum number extent buffers per page will be 2. We
should be computing this value at runtime. For now, Let's work with the
hardcoded value.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Btrfs: subpagesize-blocksize: Allow mounting filesystems where sectorsize != PAGE_SIZE

This patch allows mounting filesystems with blocksize smaller than the
PAGE_SIZE.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Btrfs: subpagesize-blocksize: Compute and look up csums based on sectorsized blocks.

Checksums are applicable to sectorsize units. The current code uses
bio->bv_len units to compute and look up checksums. This works on machines
where sectorsize == PAGE_CACHE_SIZE. This patch makes the checksum
computation and look up code to work with sectorsize units.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>