freebsd-dev/cmd
George Wilson d3c2ae1c08 OpenZFS 6950 - ARC should cache compressed data
Authored by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Tom Caputi <tcaputi@datto.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Ported by: David Quigley <david.quigley@intel.com>

This review covers the reading and writing of compressed arc headers, sharing
data between the arc_hdr_t and the arc_buf_t, and the implementation of a new
dbuf cache to keep frequently access data uncompressed.

I've added a new member to l1 arc hdr called b_pdata. The b_pdata always hangs
off the arc_buf_hdr_t (if an L1 hdr is in use) and points to the physical block
for that DVA. The physical block may or may not be compressed. If compressed
arc is enabled and the block on-disk is compressed, then the b_pdata will match
the block on-disk and remain compressed in memory. If the block on disk is not
compressed, then neither will the b_pdata. Lastly, if compressed arc is
disabled, then b_pdata will always be an uncompressed version of the on-disk
block.

Typically the arc will cache only the arc_buf_hdr_t and will aggressively evict
any arc_buf_t's that are no longer referenced. This means that the arc will
primarily have compressed blocks as the arc_buf_t's are considered overhead and
are always uncompressed. When a consumer reads a block we first look to see if
the arc_buf_hdr_t is cached. If the hdr is cached then we allocate a new
arc_buf_t and decompress the b_pdata contents into the arc_buf_t's b_data. If
the hdr already has a arc_buf_t, then we will allocate an additional arc_buf_t
and bcopy the uncompressed contents from the first arc_buf_t to the new one.

Writing to the compressed arc requires that we first discard the b_pdata since
the physical block is about to be rewritten. The new data contents will be
passed in via an arc_buf_t (uncompressed) and during the I/O pipeline stages we
will copy the physical block contents to a newly allocated b_pdata.

When an l2arc is inuse it will also take advantage of the b_pdata. Now the
l2arc will always write the contents of b_pdata to the l2arc. This means that
when compressed arc is enabled that the l2arc blocks are identical to those
stored in the main data pool. This provides a significant advantage since we
can leverage the bp's checksum when reading from the l2arc to determine if the
contents are valid. If the compressed arc is disabled, then we must first
transform the read block to look like the physical block in the main data pool
before comparing the checksum and determining it's valid.

OpenZFS-issue: https://www.illumos.org/issues/6950
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/7fc10f0
Issue #5078
2016-09-13 09:58:33 -07:00
..
arc_summary Update arc_summary.py for prefetch changes 2016-07-19 09:12:41 -07:00
arcstat Update arcstat.py to remove deprecated rmis reference. 2015-12-04 15:28:45 -08:00
dbufstat Make arc_summary.py and dbufstat.py compatible with python3 2016-01-07 17:09:59 -08:00
fsck_zfs Add /sbin/fsck.zfs helper 2013-01-09 16:54:58 -08:00
mount_zfs Make zfs mount according to relatime config in dataset 2016-04-05 18:55:59 -07:00
raidz_test Fixes and enhancements of SIMD raidz parity 2016-07-19 16:43:07 -07:00
vdev_id Add extra keyword 'slot' to vdev_id.conf 2015-08-30 10:03:56 -07:00
zdb OpenZFS 6950 - ARC should cache compressed data 2016-09-13 09:58:33 -07:00
zed Bring over illumos ZFS FMA logic -- phase 1 2016-09-01 11:39:45 -07:00
zfs Fix memleak in zfs_do_* and zpool_do_* 2016-09-12 13:02:47 -07:00
zhack Fix zhack argument processing 2016-08-31 14:32:46 -07:00
zinject Fixes for issues found with cppcheck tool 2016-07-27 13:31:22 -07:00
zpios Fix minor spelling mistakes 2016-06-06 14:45:26 -07:00
zpool Fix memleak in zfs_do_* and zpool_do_* 2016-09-12 13:02:47 -07:00
zstreamdump OpenZFS 2605, 6980, 6902 2016-06-28 13:47:02 -07:00
ztest OpenZFS 6950 - ARC should cache compressed data 2016-09-13 09:58:33 -07:00
zvol_id OpenZFS 6314 - buffer overflow in dsl_dataset_name 2016-06-28 13:47:03 -07:00
Makefile.am SIMD implementation of vdev_raidz generate and reconstruct routines 2016-06-21 09:27:26 -07:00