From d4a72f23863382bdf6d0ae33196f5b5decbc48fd Mon Sep 17 00:00:00 2001 From: Tom Caputi Date: Wed, 15 Nov 2017 20:27:01 -0500 Subject: 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 Authored-by: Saso Kiselkov Authored-by: Alek Pinchuk Authored-by: Tom Caputi Signed-off-by: Tom Caputi Closes #3625 Closes #6256 --- module/zfs/zap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/zfs/zap.c') diff --git a/module/zfs/zap.c b/module/zfs/zap.c index 6d1b860cc..2f6aed667 100644 --- a/module/zfs/zap.c +++ b/module/zfs/zap.c @@ -1070,7 +1070,7 @@ zap_join_key(objset_t *os, uint64_t fromobj, uint64_t intoobj, } err = zap_add(os, intoobj, za.za_name, 8, 1, &value, tx); - if (err) + if (err != 0) break; } zap_cursor_fini(&zc); -- cgit v1.2.3