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>
btrfs: subpagesize-blocksize: handle checksum calculations properly

With subpagesize-blocksize, the IO is done in pages but checksums are
calculated in blocks.

This patch makes sure the checksums are calculated, stored, and verfied
from proper indexes in the page.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
btrfs: subpagesize-blocksize: Handle relocation clusters appropriately

For relocation clusters boundaries are at blocks, hence in the case
of subpagesize-blocksize, we need to make sure the data in the page
is handled correctly with the cluster boundary.

This patch does that.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
btrfs: subpagesize-blocksize: Allow mounting filesystems where sectorsize != PAGE_SIZE

This is the final patch of the series that allows filesystems with
blocksize smaller than the PAGE_SIZE.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Btrfs: __init_extent_buffer: Add gfp mask as an argument.

This commit adds the required gfp mask argument that was missed out by
"subpagesize-blocksize: Define extent_buffer_head" commit.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Btrfs: find_extent_buffer: Remove unnecessary invocation of mark_extent_buffer_accessed.

We now loop across all the 'extent buffers' that are part of extent buffer
head and invoke mark_extent_buffer_accessed for each of them.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Btrfs: alloc_extent_buffer: Set EXTENT_BUFFER_IN_TREE bit on extent_buffer_head's flags.

Extent buffer head now holds the bflags member. Update that instead.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Btrfs: release_extent_buffer: Increment extent_buffer_head's refs.

Extent buffer head now holds the refs member. Update that instead.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Btrfs: release_extent_buffer: Use extent_buffer_head's refs_lock.

Extent buffer head now holds the refs_lock member. Use that instead.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Btrfs: extent_buffer_head: Replace extent_io_tree pointer with btrfs_fs_info.

The extent_buffer_head structures are added to a radix tree at
btrfs_fs_info->radix_tree. Set the back pointer in extent_buffer_head to point
back to the corresponding btrfs_fs_info structure.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Btrfs: 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 <chandan@linux.vnet.ibm.com>
Btrfs: btrfs_io_bio: Track file offset range operated on by the bio.

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. The new members
added will now track the file offset range.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Btrfs: check_page_uptodate: Pass cached extent_state pointer.

This is in preparation to "remove whole page i/o" patches.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
Btrfs: Bring back check_page_locked().

This will be required to get rid of whole page reads.

Signed-off-by: chandan <chandan@linux.vnet.ibm.com>
btrfs: subpagesize-blocksize: Get rid of whole page reads.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>