mirror_zfs/tests/zfs-tests/include
George Amanakis b7654bd794
Trim L2ARC
The l2arc_evict() function is responsible for evicting buffers which
reference the next bytes of the L2ARC device to be overwritten. Teach
this function to additionally TRIM that vdev space before it is
overwritten if the device has been filled with data. This is done by
vdev_trim_simple() which trims by issuing a new type of TRIM,
TRIM_TYPE_SIMPLE.

We also implement a "Trim Ahead" feature. It is a zfs module parameter,
expressed in % of the current write size. This trims ahead of the
current write size. A minimum of 64MB will be trimmed. The default is 0
which disables TRIM on L2ARC as it can put significant stress to
underlying storage devices. To enable TRIM on L2ARC we set
l2arc_trim_ahead > 0.

We also implement TRIM of the whole cache device upon addition to a
pool, pool creation or when the header of the device is invalid upon
importing a pool or onlining a cache device. This is dependent on
l2arc_trim_ahead > 0. TRIM of the whole device is done with
TRIM_TYPE_MANUAL so that its status can be monitored by zpool status -t.
We save the TRIM state for the whole device and the time of completion
on-disk in the header, and restore these upon L2ARC rebuild so that
zpool status -t can correctly report them. Whole device TRIM is done
asynchronously so that the user can export of the pool or remove the
cache device while it is trimming (ie if it is too slow).

We do not TRIM the whole device if persistent L2ARC has been disabled by
l2arc_rebuild_enabled = 0 because we may not want to lose all cached
buffers (eg we may want to import the pool with
l2arc_rebuild_enabled = 0 only once because of memory pressure). If
persistent L2ARC has been disabled by setting the module parameter
l2arc_rebuild_blocks_min_l2size to a value greater than the size of the
cache device then the whole device is trimmed upon creation or import of
a pool if l2arc_trim_ahead > 0.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Adam D. Moss <c@yotes.com>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #9713
Closes #9789 
Closes #10224
2020-06-09 10:15:08 -07:00
..
.gitignore Add zpool events tests 2017-05-22 12:34:42 -04:00
blkdev.shlib ZTS: Another round of changes for FreeBSD 2020-03-06 09:31:32 -08:00
commands.cfg Small program that converts a dataset id and an object id to a path 2020-05-20 10:05:33 -07:00
default.cfg.in ZTS: Fix a few defaults 2020-01-31 08:51:23 -08:00
libtest.shlib ZTS: Count CKSUM for all vdevs in verify_pool 2020-04-30 17:50:16 -07:00
Makefile.am ZTS: Catalog tunable names for tests in tunables.cfg 2020-01-14 14:57:28 -08:00
math.shlib ZTS: Eliminate functions named 'random' 2020-01-08 09:08:30 -08:00
properties.shlib ZTS: Don't use edonr on FreeBSD 2020-01-28 08:38:02 -08:00
tunables.cfg Trim L2ARC 2020-06-09 10:15:08 -07:00
zpool_script.shlib zfs-tests: fix warnings when packaging some .shlib files 2019-05-24 14:12:14 -07:00