657fd33bcf
Functional changes: We implement refcounts of log blocks and their aligned size on the cache device along with two corresponding arcstats. The refcounts are reflected in the header of the device and provide valuable information as to whether log blocks are accounted for correctly. These are dynamically adjusted as log blocks are committed/evicted. zdb also uses this information in the device header and compares it to the corresponding values as reported by dump_l2arc_log_blocks() which emulates l2arc_rebuild(). If the refcounts saved in the device header report higher values, zdb exits with an error. For this feature to work correctly there should be no active writes on the device. This is also employed in the tests of persistent L2ARC. We extend the structure of the cache device header by adding the two new variables mirroring the refcounts after the existing variables to preserve backward compatibility in terms of persistent L2ARC. 1) a new arcstat "l2_log_blk_asize" and refcount "l2ad_lb_asize" which reflect the total aligned size of log blocks on the device. This is also reflected in the header of the cache device as "dh_lb_asize". 2) a new arcstat "l2arc_log_blk_count" and refcount "l2ad_lb_count" which reflect the total number of L2ARC log blocks present on cache devices. It is also reflected in the header of the cache device as "dh_lb_count". In l2arc_rebuild_vdev() if the amount of committed log entries in a log block is 0 and the device header is valid we update the device header. This will facilitate trimming of the whole device in this case when TRIM for L2ARC is implemented. Improve loop protection in l2arc_rebuild() by using the starting offset of the payload of each log block instead of the starting offset of the log block. If the zio in l2arc_write_buffers() fails, restore the lbps array in the header of the device to its previous state in l2arc_write_done(). If l2arc_rebuild() ends the rebuild process without restoring any L2ARC log blocks in ARC and without any other error, this means that the lbps array in the header is pointing to non-existent or invalid log blocks. Reset the device header in this case. In l2arc_rebuild() change the zfs_dbgmsg messages to spa_history_log_internal() making them user visible with zpool history command. Non-functional changes: Make the first test in persistent L2ARC use `zdb -lll` to increase coverage in `zdb.c`. Rename psize with asize when referring to log blocks, since L2ARC_SET_PSIZE stores the vdev aligned size for log blocks. Also rename dh_log_blk_entries to dh_log_entries to make it clear that it is a mirror of l2ad_log_entries. Added comments for both changes. Fix inaccurate comments for example in l2arc_log_blk_restore(). Add asserts at the end in l2arc_evict() and l2arc_write_buffers(). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: George Amanakis <gamanakis@gmail.com> Closes #10228 |
||
---|---|---|
.. | ||
.gitignore | ||
fsck.zfs.8 | ||
Makefile.am | ||
mount.zfs.8 | ||
vdev_id.8 | ||
zdb.8 | ||
zed.8.in | ||
zfs-allow.8 | ||
zfs-bookmark.8 | ||
zfs-change-key.8 | ||
zfs-clone.8 | ||
zfs-create.8 | ||
zfs-destroy.8 | ||
zfs-diff.8 | ||
zfs-get.8 | ||
zfs-groupspace.8 | ||
zfs-hold.8 | ||
zfs-inherit.8 | ||
zfs-jail.8 | ||
zfs-list.8 | ||
zfs-load-key.8 | ||
zfs-mount-generator.8.in | ||
zfs-mount.8 | ||
zfs-program.8 | ||
zfs-project.8 | ||
zfs-projectspace.8 | ||
zfs-promote.8 | ||
zfs-receive.8 | ||
zfs-recv.8 | ||
zfs-redact.8 | ||
zfs-release.8 | ||
zfs-rename.8 | ||
zfs-rollback.8 | ||
zfs-send.8 | ||
zfs-set.8 | ||
zfs-share.8 | ||
zfs-snapshot.8 | ||
zfs-unallow.8 | ||
zfs-unjail.8 | ||
zfs-unload-key.8 | ||
zfs-unmount.8 | ||
zfs-upgrade.8 | ||
zfs-userspace.8 | ||
zfs-wait.8 | ||
zfs.8 | ||
zfsconcepts.8 | ||
zfsprops.8 | ||
zgenhostid.8 | ||
zinject.8 | ||
zpool-add.8 | ||
zpool-attach.8 | ||
zpool-checkpoint.8 | ||
zpool-clear.8 | ||
zpool-create.8 | ||
zpool-destroy.8 | ||
zpool-detach.8 | ||
zpool-events.8 | ||
zpool-export.8 | ||
zpool-get.8 | ||
zpool-history.8 | ||
zpool-import.8 | ||
zpool-initialize.8 | ||
zpool-iostat.8 | ||
zpool-labelclear.8 | ||
zpool-list.8 | ||
zpool-offline.8 | ||
zpool-online.8 | ||
zpool-reguid.8 | ||
zpool-remove.8 | ||
zpool-reopen.8 | ||
zpool-replace.8 | ||
zpool-resilver.8 | ||
zpool-scrub.8 | ||
zpool-set.8 | ||
zpool-split.8 | ||
zpool-status.8 | ||
zpool-sync.8 | ||
zpool-trim.8 | ||
zpool-upgrade.8 | ||
zpool-wait.8 | ||
zpool.8 | ||
zpoolconcepts.8 | ||
zpoolprops.8 | ||
zstream.8 | ||
zstreamdump.8 |