]> granicus.if.org Git - zfs/commit
Sequential scrub and resilvers
authorTom Caputi <tcaputi@datto.com>
Thu, 16 Nov 2017 01:27:01 +0000 (20:27 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 16 Nov 2017 01:27:01 +0000 (17:27 -0800)
commitd4a72f23863382bdf6d0ae33196f5b5decbc48fd
tree1084ea930b9a1ef46e58d1757943ab3ad66c22c4
parente301113c17673a290098850830cf2e6d1a1fcbe3
Sequential scrub and resilvers

Currently, scrubs and resilvers can take an extremely
long time to complete. This is largely due to the fact
that zfs scans process pools in logical order, as
determined by each block's bookmark. This makes sense
from a simplicity perspective, but blocks in zfs are
often scattered randomly across disks, particularly
due to zfs's copy-on-write mechanisms.

This patch improves performance by splitting scrubs
and resilvers into a metadata scanning phase and an IO
issuing phase. The metadata scan reads through the
structure of the pool and gathers an in-memory queue
of I/Os, sorted by size and offset on disk. The issuing
phase will then issue the scrub I/Os as sequentially as
possible, greatly improving performance.

This patch also updates and cleans up some of the scan
code which has not been updated in several years.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Authored-by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Authored-by: Alek Pinchuk <apinchuk@datto.com>
Authored-by: Tom Caputi <tcaputi@datto.com>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #3625
Closes #6256
37 files changed:
cmd/zdb/zdb.c
cmd/zpool/zpool_main.c
include/sys/arc.h
include/sys/dsl_pool.h
include/sys/dsl_scan.h
include/sys/fs/zfs.h
include/sys/range_tree.h
include/sys/spa_impl.h
include/sys/vdev_impl.h
lib/libzfs/libzfs_status.c
man/man5/zfs-module-parameters.5
module/zfs/arc.c
module/zfs/dbuf.c
module/zfs/ddt.c
module/zfs/dmu_traverse.c
module/zfs/dsl_pool.c
module/zfs/dsl_scan.c
module/zfs/metaslab.c
module/zfs/range_tree.c
module/zfs/spa.c
module/zfs/spa_misc.c
module/zfs/vdev.c
module/zfs/vdev_queue.c
module/zfs/zap.c
module/zfs/zio.c
tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen_003_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_reopen/zpool_reopen_004_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/cleanup.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/setup.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub.cfg
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_002_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_003_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_004_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_005_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_scrub/zpool_scrub_offline_device.ksh
tests/zfs-tests/tests/functional/events/events_002_pos.ksh
tests/zfs-tests/tests/functional/events/events_common.kshlib