Add compatibility layer for {kmap,kunmap}_atomic

Starting from linux-2.6.37, {kmap,kunmap}_atomic takes 1 argument instead of 2.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Introduce ABD: linear/scatter dual typed buffer for ARC

zfsolinux currently uses vmalloc backed slab for ARC buffers. There are some
major problems with this approach. One is that 32-bit system have only a
handful of vmalloc space. Another is that the fragmentation in slab will easily
trigger OOM in busy system.

With ABD, we use scatterlist to allocate data buffers. In this approach we can
allocate in HIGHMEM, which alleviates vmalloc space pressure on 32-bit. Also,
we don't have to rely on slab, so there's no fragmentation issue.

But for metadata buffers, we still uses linear buffer from slab. The reason for
this is that there are a lot of *_phys pointers directly point to metadata
buffers. So it's kind of impractical to change all those code. And metadata
should only be a small percentage so we probably don't have to worry about
the 32-bit and fragmentation issue, right?

Currently, ABD is not enabled and its API will treat them as normal buffers.
We will enable it once all relevant code is modified to use the API.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Modify/Add incremental checksum function for abd_iterate_rfunc

Modify/Add incremental fletcher function prototype to match abd_iterate_rfunc
callback type. Also, reduce duplicated code a bit in zfs_fletcher.c.

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Use abd_t in arc.h, dmu.h and zio.h

1. Use abd_t in arc_buf_t->b_data, dmu_buf_t->db_data, zio_t->io_data and
zio_transform_t->zt_orig_data
2. zio_* function take abd_t for data

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Convert zio_checksum to ABD version

1. Add checksum function for abd_t
2. Use abd_t version checksum function in zio_checksum_table
3. Make zio_checksum_compute and zio_checksum_error handle abd_t

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Handle abd_t in arc.c, bpobj.c and bptree.c

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Handle abd_t in dbuf.c, ddt.c, dmu*.c

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Handle abd_t in dnode*.c, dsl_*.c

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Handle abd_t in sa_impl.h, sa.c, spa.c, spa_history.c and zil.c

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Handle abd_t in metaslab.c, zap*.c, zfs_fuid.c, zfs_sa.c and zfs_vnops.c

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Handle abd_t in zio.c

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Handle abd_t in vdev*.c sans vdev_raidz.c

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Handle abd_t in vdev_raidz.c

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Handle ABD in ztest and zdb

Use ABD API on related pointers and functions.(b_data, db_data, zio_*(), etc.)
Note that the userspace still only support linear ABD.

Suggested-by: DHE <git@dehacked.net>
Signed-off-by: Chunwei Chen <tuxoko@gmail.com>
Enable ABD

Signed-off-by: Chunwei Chen <tuxoko@gmail.com>