Mercurial > illumos > illumos-gate
annotate usr/src/uts/common/fs/zfs/dsl_scan.c @ 13941:d48547176ab4
3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
author | George Wilson <george.wilson@delphix.com> |
---|---|
date | Fri, 01 Feb 2013 14:11:09 -0800 |
parents | 9410cf539b11 |
children | 7a22d0770fc8 |
rev | line source |
---|---|
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
2 * CDDL HEADER START |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
3 * |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
4 * The contents of this file are subject to the terms of the |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
5 * Common Development and Distribution License (the "License"). |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
6 * You may not use this file except in compliance with the License. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
7 * |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
9 * or http://www.opensolaris.org/os/licensing. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
10 * See the License for the specific language governing permissions |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
11 * and limitations under the License. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
12 * |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
13 * When distributing Covered Code, include this CDDL HEADER in each |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
15 * If applicable, add the following below this CDDL HEADER, with the |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
16 * fields enclosed by brackets "[]" replaced with your own identifying |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
17 * information: Portions Copyright [yyyy] [name of copyright owner] |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
18 * |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
19 * CDDL HEADER END |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
20 */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
21 /* |
12295
e16f396f04a1
6948911 snapshot deletion can induce unsatisfiable allocations in txg sync
George Wilson <George.Wilson@Sun.COM>
parents:
11935
diff
changeset
|
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
23 * Copyright (c) 2012 by Delphix. All rights reserved. |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
24 */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
25 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
26 #include <sys/dsl_scan.h> |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
27 #include <sys/dsl_pool.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
28 #include <sys/dsl_dataset.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
29 #include <sys/dsl_prop.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
30 #include <sys/dsl_dir.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
31 #include <sys/dsl_synctask.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
32 #include <sys/dnode.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
33 #include <sys/dmu_tx.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
34 #include <sys/dmu_objset.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
35 #include <sys/arc.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
36 #include <sys/zap.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
37 #include <sys/zio.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
38 #include <sys/zfs_context.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
39 #include <sys/fs/zfs.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
40 #include <sys/zfs_znode.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
41 #include <sys/spa_impl.h> |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
42 #include <sys/vdev_impl.h> |
7160
12f467ba43f4
6725330 'zpool scrub -v' doesn't show data errors after scrub completes
ahrens
parents:
7046
diff
changeset
|
43 #include <sys/zil_impl.h> |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
44 #include <sys/zio_checksum.h> |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
45 #include <sys/ddt.h> |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11815
diff
changeset
|
46 #include <sys/sa.h> |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11815
diff
changeset
|
47 #include <sys/sa_impl.h> |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
48 #include <sys/zfeature.h> |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
49 #ifdef _KERNEL |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
50 #include <sys/zfs_vfsops.h> |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
51 #endif |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
52 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
53 typedef int (scan_cb_t)(dsl_pool_t *, const blkptr_t *, const zbookmark_t *); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
54 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
55 static scan_cb_t dsl_scan_defrag_cb; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
56 static scan_cb_t dsl_scan_scrub_cb; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
57 static scan_cb_t dsl_scan_remove_cb; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
58 static dsl_syncfunc_t dsl_scan_cancel_sync; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
59 static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
60 |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
61 int zfs_top_maxinflight = 32; /* maximum I/Os per top-level */ |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
62 int zfs_resilver_delay = 2; /* number of ticks to delay resilver */ |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
63 int zfs_scrub_delay = 4; /* number of ticks to delay scrub */ |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
64 int zfs_scan_idle = 50; /* idle window in clock ticks */ |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
65 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
66 int zfs_scan_min_time_ms = 1000; /* min millisecs to scrub per txg */ |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
67 int zfs_free_min_time_ms = 1000; /* min millisecs to free per txg */ |
11182
5997a9e6e9e7
6904168 change zfs_txg_synctime (etc.) tunables to zfs_txg_synctime_ms
Lin Ling <Lin.Ling@Sun.COM>
parents:
11147
diff
changeset
|
68 int zfs_resilver_min_time_ms = 3000; /* min millisecs to resilver per txg */ |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
69 boolean_t zfs_no_scrub_io = B_FALSE; /* set to disable scrub i/o */ |
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
70 boolean_t zfs_no_scrub_prefetch = B_FALSE; /* set to disable srub prefetching */ |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
71 enum ddt_class zfs_scrub_ddt_class_max = DDT_CLASS_DUPLICATE; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
72 int dsl_scan_delay_completion = B_FALSE; /* set to delay scan completion */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
73 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
74 #define DSL_SCAN_IS_SCRUB_RESILVER(scn) \ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
75 ((scn)->scn_phys.scn_func == POOL_SCAN_SCRUB || \ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
76 (scn)->scn_phys.scn_func == POOL_SCAN_RESILVER) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
77 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
78 extern int zfs_txg_timeout; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
79 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
80 /* the order has to match pool_scan_type */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
81 static scan_cb_t *scan_funcs[POOL_SCAN_FUNCS] = { |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
82 NULL, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
83 dsl_scan_scrub_cb, /* POOL_SCAN_SCRUB */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
84 dsl_scan_scrub_cb, /* POOL_SCAN_RESILVER */ |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
85 }; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
86 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
87 int |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
88 dsl_scan_init(dsl_pool_t *dp, uint64_t txg) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
89 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
90 int err; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
91 dsl_scan_t *scn; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
92 spa_t *spa = dp->dp_spa; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
93 uint64_t f; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
94 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
95 scn = dp->dp_scan = kmem_zalloc(sizeof (dsl_scan_t), KM_SLEEP); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
96 scn->scn_dp = dp; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
97 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
98 err = zap_lookup(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
99 "scrub_func", sizeof (uint64_t), 1, &f); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
100 if (err == 0) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
101 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
102 * There was an old-style scrub in progress. Restart a |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
103 * new-style scrub from the beginning. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
104 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
105 scn->scn_restart_txg = txg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
106 zfs_dbgmsg("old-style scrub was in progress; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
107 "restarting new-style scrub in txg %llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
108 scn->scn_restart_txg); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
109 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
110 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
111 * Load the queue obj from the old location so that it |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
112 * can be freed by dsl_scan_done(). |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
113 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
114 (void) zap_lookup(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
115 "scrub_queue", sizeof (uint64_t), 1, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
116 &scn->scn_phys.scn_queue_obj); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
117 } else { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
118 err = zap_lookup(dp->dp_meta_objset, DMU_POOL_DIRECTORY_OBJECT, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
119 DMU_POOL_SCAN, sizeof (uint64_t), SCAN_PHYS_NUMINTS, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
120 &scn->scn_phys); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
121 if (err == ENOENT) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
122 return (0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
123 else if (err) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
124 return (err); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
125 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
126 if (scn->scn_phys.scn_state == DSS_SCANNING && |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
127 spa_prev_software_version(dp->dp_spa) < SPA_VERSION_SCAN) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
128 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
129 * A new-type scrub was in progress on an old |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
130 * pool, and the pool was accessed by old |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
131 * software. Restart from the beginning, since |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
132 * the old software may have changed the pool in |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
133 * the meantime. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
134 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
135 scn->scn_restart_txg = txg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
136 zfs_dbgmsg("new-style scrub was modified " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
137 "by old software; restarting in txg %llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
138 scn->scn_restart_txg); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
139 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
140 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
141 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
142 spa_scan_stat_init(spa); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
143 return (0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
144 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
145 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
146 void |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
147 dsl_scan_fini(dsl_pool_t *dp) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
148 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
149 if (dp->dp_scan) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
150 kmem_free(dp->dp_scan, sizeof (dsl_scan_t)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
151 dp->dp_scan = NULL; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
152 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
153 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
154 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
155 /* ARGSUSED */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
156 static int |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
157 dsl_scan_setup_check(void *arg1, void *arg2, dmu_tx_t *tx) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
158 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
159 dsl_scan_t *scn = arg1; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
160 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
161 if (scn->scn_phys.scn_state == DSS_SCANNING) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
162 return (EBUSY); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
163 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
164 return (0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
165 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
166 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
167 /* ARGSUSED */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
168 static void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
169 dsl_scan_setup_sync(void *arg1, void *arg2, dmu_tx_t *tx) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
170 { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
171 dsl_scan_t *scn = arg1; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
172 pool_scan_func_t *funcp = arg2; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
173 dmu_object_type_t ot = 0; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
174 dsl_pool_t *dp = scn->scn_dp; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
175 spa_t *spa = dp->dp_spa; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
176 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
177 ASSERT(scn->scn_phys.scn_state != DSS_SCANNING); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
178 ASSERT(*funcp > POOL_SCAN_NONE && *funcp < POOL_SCAN_FUNCS); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
179 bzero(&scn->scn_phys, sizeof (scn->scn_phys)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
180 scn->scn_phys.scn_func = *funcp; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
181 scn->scn_phys.scn_state = DSS_SCANNING; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
182 scn->scn_phys.scn_min_txg = 0; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
183 scn->scn_phys.scn_max_txg = tx->tx_txg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
184 scn->scn_phys.scn_ddt_class_max = DDT_CLASSES - 1; /* the entire DDT */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
185 scn->scn_phys.scn_start_time = gethrestime_sec(); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
186 scn->scn_phys.scn_errors = 0; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
187 scn->scn_phys.scn_to_examine = spa->spa_root_vdev->vdev_stat.vs_alloc; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
188 scn->scn_restart_txg = 0; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
189 spa_scan_stat_init(spa); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
190 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
191 if (DSL_SCAN_IS_SCRUB_RESILVER(scn)) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
192 scn->scn_phys.scn_ddt_class_max = zfs_scrub_ddt_class_max; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
193 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
194 /* rewrite all disk labels */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
195 vdev_config_dirty(spa->spa_root_vdev); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
196 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
197 if (vdev_resilver_needed(spa->spa_root_vdev, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
198 &scn->scn_phys.scn_min_txg, &scn->scn_phys.scn_max_txg)) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
199 spa_event_notify(spa, NULL, ESC_ZFS_RESILVER_START); |
8525
e0e0e525d0f8
6788830 set large value to reservation cause core dump
Eric Schrock <Eric.Schrock@Sun.COM>
parents:
8274
diff
changeset
|
200 } else { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
201 spa_event_notify(spa, NULL, ESC_ZFS_SCRUB_START); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
202 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
203 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
204 spa->spa_scrub_started = B_TRUE; |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
205 /* |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
206 * If this is an incremental scrub, limit the DDT scrub phase |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
207 * to just the auto-ditto class (for correctness); the rest |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
208 * of the scrub should go faster using top-down pruning. |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
209 */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
210 if (scn->scn_phys.scn_min_txg > TXG_INITIAL) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
211 scn->scn_phys.scn_ddt_class_max = DDT_CLASS_DITTO; |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
212 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
213 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
214 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
215 /* back to the generic stuff */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
216 |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
217 if (dp->dp_blkstats == NULL) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
218 dp->dp_blkstats = |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
219 kmem_alloc(sizeof (zfs_all_blkstats_t), KM_SLEEP); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
220 } |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
221 bzero(dp->dp_blkstats, sizeof (zfs_all_blkstats_t)); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
222 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
223 if (spa_version(spa) < SPA_VERSION_DSL_SCRUB) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
224 ot = DMU_OT_ZAP_OTHER; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
225 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
226 scn->scn_phys.scn_queue_obj = zap_create(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
227 ot ? ot : DMU_OT_SCAN_QUEUE, DMU_OT_NONE, 0, tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
228 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
229 dsl_scan_sync_state(scn, tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
230 |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13700
diff
changeset
|
231 spa_history_log_internal(spa, "scan setup", tx, |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
232 "func=%u mintxg=%llu maxtxg=%llu", |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
233 *funcp, scn->scn_phys.scn_min_txg, scn->scn_phys.scn_max_txg); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
234 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
235 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
236 /* ARGSUSED */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
237 static void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
238 dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
239 { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
240 static const char *old_names[] = { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
241 "scrub_bookmark", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
242 "scrub_ddt_bookmark", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
243 "scrub_ddt_class_max", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
244 "scrub_queue", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
245 "scrub_min_txg", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
246 "scrub_max_txg", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
247 "scrub_func", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
248 "scrub_errors", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
249 NULL |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
250 }; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
251 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
252 dsl_pool_t *dp = scn->scn_dp; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
253 spa_t *spa = dp->dp_spa; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
254 int i; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
255 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
256 /* Remove any remnants of an old-style scrub. */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
257 for (i = 0; old_names[i]; i++) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
258 (void) zap_remove(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
259 DMU_POOL_DIRECTORY_OBJECT, old_names[i], tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
260 } |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
261 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
262 if (scn->scn_phys.scn_queue_obj != 0) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
263 VERIFY(0 == dmu_object_free(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
264 scn->scn_phys.scn_queue_obj, tx)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
265 scn->scn_phys.scn_queue_obj = 0; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
266 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
267 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
268 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
269 * If we were "restarted" from a stopped state, don't bother |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
270 * with anything else. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
271 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
272 if (scn->scn_phys.scn_state != DSS_SCANNING) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
273 return; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
274 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
275 if (complete) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
276 scn->scn_phys.scn_state = DSS_FINISHED; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
277 else |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
278 scn->scn_phys.scn_state = DSS_CANCELED; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
279 |
13743
95aba6e49b9f
2882 implement libzfs_core
Matthew Ahrens <mahrens@delphix.com>
parents:
13700
diff
changeset
|
280 spa_history_log_internal(spa, "scan done", tx, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
281 "complete=%u", complete); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
282 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
283 if (DSL_SCAN_IS_SCRUB_RESILVER(scn)) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
284 mutex_enter(&spa->spa_scrub_lock); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
285 while (spa->spa_scrub_inflight > 0) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
286 cv_wait(&spa->spa_scrub_io_cv, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
287 &spa->spa_scrub_lock); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
288 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
289 mutex_exit(&spa->spa_scrub_lock); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
290 spa->spa_scrub_started = B_FALSE; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
291 spa->spa_scrub_active = B_FALSE; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
292 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
293 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
294 * If the scrub/resilver completed, update all DTLs to |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
295 * reflect this. Whether it succeeded or not, vacate |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
296 * all temporary scrub DTLs. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
297 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
298 vdev_dtl_reassess(spa->spa_root_vdev, tx->tx_txg, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
299 complete ? scn->scn_phys.scn_max_txg : 0, B_TRUE); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
300 if (complete) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
301 spa_event_notify(spa, NULL, scn->scn_phys.scn_min_txg ? |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
302 ESC_ZFS_RESILVER_FINISH : ESC_ZFS_SCRUB_FINISH); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
303 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
304 spa_errlog_rotate(spa); |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
305 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
306 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
307 * We may have finished replacing a device. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
308 * Let the async thread assess this and handle the detach. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
309 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
310 spa_async_request(spa, SPA_ASYNC_RESILVER_DONE); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
311 } |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
312 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
313 scn->scn_phys.scn_end_time = gethrestime_sec(); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
314 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
315 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
316 /* ARGSUSED */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
317 static int |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
318 dsl_scan_cancel_check(void *arg1, void *arg2, dmu_tx_t *tx) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
319 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
320 dsl_scan_t *scn = arg1; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
321 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
322 if (scn->scn_phys.scn_state != DSS_SCANNING) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
323 return (ENOENT); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
324 return (0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
325 } |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
326 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
327 /* ARGSUSED */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
328 static void |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
329 dsl_scan_cancel_sync(void *arg1, void *arg2, dmu_tx_t *tx) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
330 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
331 dsl_scan_t *scn = arg1; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
332 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
333 dsl_scan_done(scn, B_FALSE, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
334 dsl_scan_sync_state(scn, tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
335 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
336 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
337 int |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
338 dsl_scan_cancel(dsl_pool_t *dp) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
339 { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
340 boolean_t complete = B_FALSE; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
341 int err; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
342 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
343 err = dsl_sync_task_do(dp, dsl_scan_cancel_check, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
344 dsl_scan_cancel_sync, dp->dp_scan, &complete, 3); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
345 return (err); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
346 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
347 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
348 static void dsl_scan_visitbp(blkptr_t *bp, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
349 const zbookmark_t *zb, dnode_phys_t *dnp, arc_buf_t *pbuf, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
350 dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
351 dmu_tx_t *tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
352 static void dsl_scan_visitdnode(dsl_scan_t *, dsl_dataset_t *ds, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
353 dmu_objset_type_t ostype, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
354 dnode_phys_t *dnp, arc_buf_t *buf, uint64_t object, dmu_tx_t *tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
355 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
356 void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
357 dsl_free(dsl_pool_t *dp, uint64_t txg, const blkptr_t *bp) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
358 { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
359 zio_free(dp->dp_spa, txg, bp); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
360 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
361 |
12295
e16f396f04a1
6948911 snapshot deletion can induce unsatisfiable allocations in txg sync
George Wilson <George.Wilson@Sun.COM>
parents:
11935
diff
changeset
|
362 void |
e16f396f04a1
6948911 snapshot deletion can induce unsatisfiable allocations in txg sync
George Wilson <George.Wilson@Sun.COM>
parents:
11935
diff
changeset
|
363 dsl_free_sync(zio_t *pio, dsl_pool_t *dp, uint64_t txg, const blkptr_t *bpp) |
e16f396f04a1
6948911 snapshot deletion can induce unsatisfiable allocations in txg sync
George Wilson <George.Wilson@Sun.COM>
parents:
11935
diff
changeset
|
364 { |
e16f396f04a1
6948911 snapshot deletion can induce unsatisfiable allocations in txg sync
George Wilson <George.Wilson@Sun.COM>
parents:
11935
diff
changeset
|
365 ASSERT(dsl_pool_sync_context(dp)); |
e16f396f04a1
6948911 snapshot deletion can induce unsatisfiable allocations in txg sync
George Wilson <George.Wilson@Sun.COM>
parents:
11935
diff
changeset
|
366 zio_nowait(zio_free_sync(pio, dp->dp_spa, txg, bpp, pio->io_flags)); |
e16f396f04a1
6948911 snapshot deletion can induce unsatisfiable allocations in txg sync
George Wilson <George.Wilson@Sun.COM>
parents:
11935
diff
changeset
|
367 } |
e16f396f04a1
6948911 snapshot deletion can induce unsatisfiable allocations in txg sync
George Wilson <George.Wilson@Sun.COM>
parents:
11935
diff
changeset
|
368 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
369 static uint64_t |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
370 dsl_scan_ds_maxtxg(dsl_dataset_t *ds) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
371 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
372 uint64_t smt = ds->ds_dir->dd_pool->dp_scan->scn_phys.scn_max_txg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
373 if (dsl_dataset_is_snapshot(ds)) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
374 return (MIN(smt, ds->ds_phys->ds_creation_txg)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
375 return (smt); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
376 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
377 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
378 static void |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
379 dsl_scan_sync_state(dsl_scan_t *scn, dmu_tx_t *tx) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
380 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
381 VERIFY(0 == zap_update(scn->scn_dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
382 DMU_POOL_DIRECTORY_OBJECT, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
383 DMU_POOL_SCAN, sizeof (uint64_t), SCAN_PHYS_NUMINTS, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
384 &scn->scn_phys, tx)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
385 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
386 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
387 static boolean_t |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
388 dsl_scan_check_pause(dsl_scan_t *scn, const zbookmark_t *zb) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
389 { |
11137
0a1ed2ae30eb
6899862 ZFS txg time tunables should be more flexible
Lin Ling <Lin.Ling@Sun.COM>
parents:
11125
diff
changeset
|
390 uint64_t elapsed_nanosecs; |
7160
12f467ba43f4
6725330 'zpool scrub -v' doesn't show data errors after scrub completes
ahrens
parents:
7046
diff
changeset
|
391 int mintime; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
392 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
393 /* we never skip user/group accounting objects */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
394 if (zb && (int64_t)zb->zb_object < 0) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
395 return (B_FALSE); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
396 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
397 if (scn->scn_pausing) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
398 return (B_TRUE); /* we're already pausing */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
399 |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
400 if (!ZB_IS_ZERO(&scn->scn_phys.scn_bookmark)) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
401 return (B_FALSE); /* we're resuming */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
402 |
7182
30fd179c7fc1
6728594 scrub can block the sync thread for 100s or more
ahrens
parents:
7160
diff
changeset
|
403 /* We only know how to resume from level-0 blocks. */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
404 if (zb && zb->zb_level != 0) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
405 return (B_FALSE); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
406 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
407 mintime = (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) ? |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
408 zfs_resilver_min_time_ms : zfs_scan_min_time_ms; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
409 elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time; |
11137
0a1ed2ae30eb
6899862 ZFS txg time tunables should be more flexible
Lin Ling <Lin.Ling@Sun.COM>
parents:
11125
diff
changeset
|
410 if (elapsed_nanosecs / NANOSEC > zfs_txg_timeout || |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
411 (elapsed_nanosecs / MICROSEC > mintime && |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
412 txg_sync_waiting(scn->scn_dp)) || |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
413 spa_shutting_down(scn->scn_dp->dp_spa)) { |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
414 if (zb) { |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
415 dprintf("pausing at bookmark %llx/%llx/%llx/%llx\n", |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
416 (longlong_t)zb->zb_objset, |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
417 (longlong_t)zb->zb_object, |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
418 (longlong_t)zb->zb_level, |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
419 (longlong_t)zb->zb_blkid); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
420 scn->scn_phys.scn_bookmark = *zb; |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
421 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
422 dprintf("pausing at DDT bookmark %llx/%llx/%llx/%llx\n", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
423 (longlong_t)scn->scn_phys.scn_ddt_bookmark.ddb_class, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
424 (longlong_t)scn->scn_phys.scn_ddt_bookmark.ddb_type, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
425 (longlong_t)scn->scn_phys.scn_ddt_bookmark.ddb_checksum, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
426 (longlong_t)scn->scn_phys.scn_ddt_bookmark.ddb_cursor); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
427 scn->scn_pausing = B_TRUE; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
428 return (B_TRUE); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
429 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
430 return (B_FALSE); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
431 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
432 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
433 typedef struct zil_scan_arg { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
434 dsl_pool_t *zsa_dp; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
435 zil_header_t *zsa_zh; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
436 } zil_scan_arg_t; |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7182
diff
changeset
|
437 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
438 /* ARGSUSED */ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
439 static int |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
440 dsl_scan_zil_block(zilog_t *zilog, blkptr_t *bp, void *arg, uint64_t claim_txg) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
441 { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
442 zil_scan_arg_t *zsa = arg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
443 dsl_pool_t *dp = zsa->zsa_dp; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
444 dsl_scan_t *scn = dp->dp_scan; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
445 zil_header_t *zh = zsa->zsa_zh; |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7182
diff
changeset
|
446 zbookmark_t zb; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
447 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
448 if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
449 return (0); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
450 |
8746
e1d96ca6808c
6796377 panic on rollback in space_map_add()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8525
diff
changeset
|
451 /* |
9701
cc5b64682e64
6803605 should be able to offline log devices
George Wilson <George.Wilson@Sun.COM>
parents:
9396
diff
changeset
|
452 * One block ("stubby") can be allocated a long time ago; we |
8746
e1d96ca6808c
6796377 panic on rollback in space_map_add()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8525
diff
changeset
|
453 * want to visit that one because it has been allocated |
e1d96ca6808c
6796377 panic on rollback in space_map_add()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8525
diff
changeset
|
454 * (on-disk) even if it hasn't been claimed (even though for |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
455 * scrub there's nothing to do to it). |
8746
e1d96ca6808c
6796377 panic on rollback in space_map_add()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8525
diff
changeset
|
456 */ |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7182
diff
changeset
|
457 if (claim_txg == 0 && bp->blk_birth >= spa_first_txg(dp->dp_spa)) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
458 return (0); |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7182
diff
changeset
|
459 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
460 SET_BOOKMARK(&zb, zh->zh_log.blk_cksum.zc_word[ZIL_ZC_OBJSET], |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
461 ZB_ZIL_OBJECT, ZB_ZIL_LEVEL, bp->blk_cksum.zc_word[ZIL_ZC_SEQ]); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
462 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
463 VERIFY(0 == scan_funcs[scn->scn_phys.scn_func](dp, bp, &zb)); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
464 return (0); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
465 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
466 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
467 /* ARGSUSED */ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
468 static int |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
469 dsl_scan_zil_record(zilog_t *zilog, lr_t *lrc, void *arg, uint64_t claim_txg) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
470 { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
471 if (lrc->lrc_txtype == TX_WRITE) { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
472 zil_scan_arg_t *zsa = arg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
473 dsl_pool_t *dp = zsa->zsa_dp; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
474 dsl_scan_t *scn = dp->dp_scan; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
475 zil_header_t *zh = zsa->zsa_zh; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
476 lr_write_t *lr = (lr_write_t *)lrc; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
477 blkptr_t *bp = &lr->lr_blkptr; |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7182
diff
changeset
|
478 zbookmark_t zb; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
479 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
480 if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
481 return (0); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
482 |
8746
e1d96ca6808c
6796377 panic on rollback in space_map_add()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8525
diff
changeset
|
483 /* |
e1d96ca6808c
6796377 panic on rollback in space_map_add()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8525
diff
changeset
|
484 * birth can be < claim_txg if this record's txg is |
e1d96ca6808c
6796377 panic on rollback in space_map_add()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8525
diff
changeset
|
485 * already txg sync'ed (but this log block contains |
e1d96ca6808c
6796377 panic on rollback in space_map_add()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8525
diff
changeset
|
486 * other records that are not synced) |
e1d96ca6808c
6796377 panic on rollback in space_map_add()
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8525
diff
changeset
|
487 */ |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7182
diff
changeset
|
488 if (claim_txg == 0 || bp->blk_birth < claim_txg) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
489 return (0); |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7182
diff
changeset
|
490 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
491 SET_BOOKMARK(&zb, zh->zh_log.blk_cksum.zc_word[ZIL_ZC_OBJSET], |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
492 lr->lr_foid, ZB_ZIL_LEVEL, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
493 lr->lr_offset / BP_GET_LSIZE(bp)); |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
494 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
495 VERIFY(0 == scan_funcs[scn->scn_phys.scn_func](dp, bp, &zb)); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
496 } |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
497 return (0); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
498 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
499 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
500 static void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
501 dsl_scan_zil(dsl_pool_t *dp, zil_header_t *zh) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
502 { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
503 uint64_t claim_txg = zh->zh_claim_txg; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
504 zil_scan_arg_t zsa = { dp, zh }; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
505 zilog_t *zilog; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
506 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
507 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
508 * We only want to visit blocks that have been claimed but not yet |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
509 * replayed (or, in read-only mode, blocks that *would* be claimed). |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
510 */ |
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
511 if (claim_txg == 0 && spa_writeable(dp->dp_spa)) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
512 return; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
513 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
514 zilog = zil_alloc(dp->dp_meta_objset, zh); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
515 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
516 (void) zil_parse(zilog, dsl_scan_zil_block, dsl_scan_zil_record, &zsa, |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
517 claim_txg); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
518 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
519 zil_free(zilog); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
520 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
521 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
522 /* ARGSUSED */ |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
523 static void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
524 dsl_scan_prefetch(dsl_scan_t *scn, arc_buf_t *buf, blkptr_t *bp, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
525 uint64_t objset, uint64_t object, uint64_t blkid) |
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
526 { |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
527 zbookmark_t czb; |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
528 uint32_t flags = ARC_NOWAIT | ARC_PREFETCH; |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
529 |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
530 if (zfs_no_scrub_prefetch) |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
531 return; |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
532 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
533 if (BP_IS_HOLE(bp) || bp->blk_birth <= scn->scn_phys.scn_min_txg || |
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
534 (BP_GET_LEVEL(bp) == 0 && BP_GET_TYPE(bp) != DMU_OT_DNODE)) |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
535 return; |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
536 |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
537 SET_BOOKMARK(&czb, objset, object, BP_GET_LEVEL(bp), blkid); |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
538 |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
539 (void) arc_read(scn->scn_zio_root, scn->scn_dp->dp_spa, bp, |
13941
d48547176ab4
3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)
George Wilson <george.wilson@delphix.com>
parents:
13765
diff
changeset
|
540 NULL, NULL, ZIO_PRIORITY_ASYNC_READ, |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
541 ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD, &flags, &czb); |
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
542 } |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
543 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
544 static boolean_t |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
545 dsl_scan_check_resume(dsl_scan_t *scn, const dnode_phys_t *dnp, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
546 const zbookmark_t *zb) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
547 { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
548 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
549 * We never skip over user/group accounting objects (obj<0) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
550 */ |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
551 if (!ZB_IS_ZERO(&scn->scn_phys.scn_bookmark) && |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
552 (int64_t)zb->zb_object >= 0) { |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
553 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
554 * If we already visited this bp & everything below (in |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
555 * a prior txg sync), don't bother doing it again. |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
556 */ |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
557 if (zbookmark_is_before(dnp, zb, &scn->scn_phys.scn_bookmark)) |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
558 return (B_TRUE); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
559 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
560 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
561 * If we found the block we're trying to resume from, or |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
562 * we went past it to a different object, zero it out to |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
563 * indicate that it's OK to start checking for pausing |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
564 * again. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
565 */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
566 if (bcmp(zb, &scn->scn_phys.scn_bookmark, sizeof (*zb)) == 0 || |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
567 zb->zb_object > scn->scn_phys.scn_bookmark.zb_object) { |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
568 dprintf("resuming at %llx/%llx/%llx/%llx\n", |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
569 (longlong_t)zb->zb_objset, |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
570 (longlong_t)zb->zb_object, |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
571 (longlong_t)zb->zb_level, |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
572 (longlong_t)zb->zb_blkid); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
573 bzero(&scn->scn_phys.scn_bookmark, sizeof (*zb)); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
574 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
575 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
576 return (B_FALSE); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
577 } |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
578 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
579 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
580 * Return nonzero on i/o error. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
581 * Return new buf to write out in *bufp. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
582 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
583 static int |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
584 dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
585 dnode_phys_t *dnp, const blkptr_t *bp, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
586 const zbookmark_t *zb, dmu_tx_t *tx, arc_buf_t **bufp) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
587 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
588 dsl_pool_t *dp = scn->scn_dp; |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
589 int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
590 int err; |
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
591 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
592 if (BP_GET_LEVEL(bp) > 0) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
593 uint32_t flags = ARC_WAIT; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
594 int i; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
595 blkptr_t *cbp; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
596 int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
597 |
13941
d48547176ab4
3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)
George Wilson <george.wilson@delphix.com>
parents:
13765
diff
changeset
|
598 err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
599 ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
600 if (err) { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
601 scn->scn_phys.scn_errors++; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
602 return (err); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
603 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
604 for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
605 dsl_scan_prefetch(scn, *bufp, cbp, zb->zb_objset, |
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
606 zb->zb_object, zb->zb_blkid * epb + i); |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
607 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
608 for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) { |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
609 zbookmark_t czb; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
610 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
611 SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object, |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
612 zb->zb_level - 1, |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
613 zb->zb_blkid * epb + i); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
614 dsl_scan_visitbp(cbp, &czb, dnp, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
615 *bufp, ds, scn, ostype, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
616 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
617 } else if (BP_GET_TYPE(bp) == DMU_OT_USERGROUP_USED) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
618 uint32_t flags = ARC_WAIT; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
619 |
13941
d48547176ab4
3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)
George Wilson <george.wilson@delphix.com>
parents:
13765
diff
changeset
|
620 err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
621 ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
622 if (err) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
623 scn->scn_phys.scn_errors++; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
624 return (err); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
625 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
626 } else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
627 uint32_t flags = ARC_WAIT; |
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
628 dnode_phys_t *cdnp; |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
629 int i, j; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
630 int epb = BP_GET_LSIZE(bp) >> DNODE_SHIFT; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
631 |
13941
d48547176ab4
3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)
George Wilson <george.wilson@delphix.com>
parents:
13765
diff
changeset
|
632 err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
633 ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
634 if (err) { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
635 scn->scn_phys.scn_errors++; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
636 return (err); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
637 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
638 for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) { |
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
639 for (j = 0; j < cdnp->dn_nblkptr; j++) { |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
640 blkptr_t *cbp = &cdnp->dn_blkptr[j]; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
641 dsl_scan_prefetch(scn, *bufp, cbp, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
642 zb->zb_objset, zb->zb_blkid * epb + i, j); |
11147
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
643 } |
74e8c05021f1
6678033 resilver code should prefetch
George Wilson <George.Wilson@Sun.COM>
parents:
11137
diff
changeset
|
644 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
645 for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
646 dsl_scan_visitdnode(scn, ds, ostype, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
647 cdnp, *bufp, zb->zb_blkid * epb + i, tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
648 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
649 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
650 } else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
651 uint32_t flags = ARC_WAIT; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
652 objset_phys_t *osp; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
653 |
13941
d48547176ab4
3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)
George Wilson <george.wilson@delphix.com>
parents:
13765
diff
changeset
|
654 err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp, |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
655 ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
656 if (err) { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
657 scn->scn_phys.scn_errors++; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
658 return (err); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
659 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
660 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
661 osp = (*bufp)->b_data; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
662 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
663 dsl_scan_visitdnode(scn, ds, osp->os_type, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
664 &osp->os_meta_dnode, *bufp, DMU_META_DNODE_OBJECT, tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
665 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
666 if (OBJSET_BUF_HAS_USERUSED(*bufp)) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
667 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
668 * We also always visit user/group accounting |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
669 * objects, and never skip them, even if we are |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
670 * pausing. This is necessary so that the space |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
671 * deltas from this txg get integrated. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
672 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
673 dsl_scan_visitdnode(scn, ds, osp->os_type, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
674 &osp->os_groupused_dnode, *bufp, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
675 DMU_GROUPUSED_OBJECT, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
676 dsl_scan_visitdnode(scn, ds, osp->os_type, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
677 &osp->os_userused_dnode, *bufp, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
678 DMU_USERUSED_OBJECT, tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
679 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
680 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
681 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
682 return (0); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
683 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
684 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
685 static void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
686 dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
687 dmu_objset_type_t ostype, dnode_phys_t *dnp, arc_buf_t *buf, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
688 uint64_t object, dmu_tx_t *tx) |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8746
diff
changeset
|
689 { |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8746
diff
changeset
|
690 int j; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8746
diff
changeset
|
691 |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8746
diff
changeset
|
692 for (j = 0; j < dnp->dn_nblkptr; j++) { |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8746
diff
changeset
|
693 zbookmark_t czb; |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8746
diff
changeset
|
694 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
695 SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
696 dnp->dn_nlevels - 1, j); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
697 dsl_scan_visitbp(&dnp->dn_blkptr[j], |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
698 &czb, dnp, buf, ds, scn, ostype, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
699 } |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11815
diff
changeset
|
700 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
701 if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
702 zbookmark_t czb; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
703 SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
704 0, DMU_SPILL_BLKID); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
705 dsl_scan_visitbp(&dnp->dn_spill, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
706 &czb, dnp, buf, ds, scn, ostype, tx); |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8746
diff
changeset
|
707 } |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8746
diff
changeset
|
708 } |
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8746
diff
changeset
|
709 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
710 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
711 * The arguments are in this order because mdb can only print the |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
712 * first 5; we want them to be useful. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
713 */ |
9396
f41cf682d0d3
PSARC/2009/204 ZFS user/group quotas & space accounting
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
8746
diff
changeset
|
714 static void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
715 dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
716 dnode_phys_t *dnp, arc_buf_t *pbuf, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
717 dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
718 dmu_tx_t *tx) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
719 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
720 dsl_pool_t *dp = scn->scn_dp; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
721 arc_buf_t *buf = NULL; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
722 blkptr_t bp_toread = *bp; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
723 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
724 /* ASSERT(pbuf == NULL || arc_released(pbuf)); */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
725 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
726 if (dsl_scan_check_pause(scn, zb)) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
727 return; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
728 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
729 if (dsl_scan_check_resume(scn, dnp, zb)) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
730 return; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
731 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
732 if (bp->blk_birth == 0) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
733 return; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
734 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
735 scn->scn_visited_this_txg++; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
736 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
737 dprintf_bp(bp, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
738 "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx buf=%p bp=%p", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
739 ds, ds ? ds->ds_object : 0, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
740 zb->zb_objset, zb->zb_object, zb->zb_level, zb->zb_blkid, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
741 pbuf, bp); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
742 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
743 if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
744 return; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
745 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
746 if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
747 &buf) != 0) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
748 return; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
749 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
750 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
751 * If dsl_scan_ddt() has aready visited this block, it will have |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
752 * already done any translations or scrubbing, so don't call the |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
753 * callback again. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
754 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
755 if (ddt_class_contains(dp->dp_spa, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
756 scn->scn_phys.scn_ddt_class_max, bp)) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
757 ASSERT(buf == NULL); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
758 return; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
759 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
760 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
761 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
762 * If this block is from the future (after cur_max_txg), then we |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
763 * are doing this on behalf of a deleted snapshot, and we will |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
764 * revisit the future block on the next pass of this dataset. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
765 * Don't scan it now unless we need to because something |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
766 * under it was modified. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
767 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
768 if (bp->blk_birth <= scn->scn_phys.scn_cur_max_txg) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
769 scan_funcs[scn->scn_phys.scn_func](dp, bp, zb); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
770 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
771 if (buf) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
772 (void) arc_buf_remove_ref(buf, &buf); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
773 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
774 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
775 static void |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
776 dsl_scan_visit_rootbp(dsl_scan_t *scn, dsl_dataset_t *ds, blkptr_t *bp, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
777 dmu_tx_t *tx) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
778 { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
779 zbookmark_t zb; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
780 |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
781 SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET, |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
782 ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
783 dsl_scan_visitbp(bp, &zb, NULL, NULL, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
784 ds, scn, DMU_OST_NONE, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
785 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
786 dprintf_ds(ds, "finished scan%s", ""); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
787 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
788 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
789 void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
790 dsl_scan_ds_destroyed(dsl_dataset_t *ds, dmu_tx_t *tx) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
791 { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
792 dsl_pool_t *dp = ds->ds_dir->dd_pool; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
793 dsl_scan_t *scn = dp->dp_scan; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
794 uint64_t mintxg; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
795 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
796 if (scn->scn_phys.scn_state != DSS_SCANNING) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
797 return; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
798 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
799 if (scn->scn_phys.scn_bookmark.zb_objset == ds->ds_object) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
800 if (dsl_dataset_is_snapshot(ds)) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
801 /* Note, scn_cur_{min,max}_txg stays the same. */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
802 scn->scn_phys.scn_bookmark.zb_objset = |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
803 ds->ds_phys->ds_next_snap_obj; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
804 zfs_dbgmsg("destroying ds %llu; currently traversing; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
805 "reset zb_objset to %llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
806 (u_longlong_t)ds->ds_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
807 (u_longlong_t)ds->ds_phys->ds_next_snap_obj); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
808 scn->scn_phys.scn_flags |= DSF_VISIT_DS_AGAIN; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
809 } else { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
810 SET_BOOKMARK(&scn->scn_phys.scn_bookmark, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
811 ZB_DESTROYED_OBJSET, 0, 0, 0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
812 zfs_dbgmsg("destroying ds %llu; currently traversing; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
813 "reset bookmark to -1,0,0,0", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
814 (u_longlong_t)ds->ds_object); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
815 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
816 } else if (zap_lookup_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
817 scn->scn_phys.scn_queue_obj, ds->ds_object, &mintxg) == 0) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
818 ASSERT3U(ds->ds_phys->ds_num_children, <=, 1); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
819 VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
820 scn->scn_phys.scn_queue_obj, ds->ds_object, tx)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
821 if (dsl_dataset_is_snapshot(ds)) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
822 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
823 * We keep the same mintxg; it could be > |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
824 * ds_creation_txg if the previous snapshot was |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
825 * deleted too. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
826 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
827 VERIFY(zap_add_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
828 scn->scn_phys.scn_queue_obj, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
829 ds->ds_phys->ds_next_snap_obj, mintxg, tx) == 0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
830 zfs_dbgmsg("destroying ds %llu; in queue; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
831 "replacing with %llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
832 (u_longlong_t)ds->ds_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
833 (u_longlong_t)ds->ds_phys->ds_next_snap_obj); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
834 } else { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
835 zfs_dbgmsg("destroying ds %llu; in queue; removing", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
836 (u_longlong_t)ds->ds_object); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
837 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
838 } else { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
839 zfs_dbgmsg("destroying ds %llu; ignoring", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
840 (u_longlong_t)ds->ds_object); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
841 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
842 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
843 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
844 * dsl_scan_sync() should be called after this, and should sync |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
845 * out our changed state, but just to be safe, do it here. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
846 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
847 dsl_scan_sync_state(scn, tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
848 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
849 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
850 void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
851 dsl_scan_ds_snapshotted(dsl_dataset_t *ds, dmu_tx_t *tx) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
852 { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
853 dsl_pool_t *dp = ds->ds_dir->dd_pool; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
854 dsl_scan_t *scn = dp->dp_scan; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
855 uint64_t mintxg; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
856 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
857 if (scn->scn_phys.scn_state != DSS_SCANNING) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
858 return; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
859 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
860 ASSERT(ds->ds_phys->ds_prev_snap_obj != 0); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
861 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
862 if (scn->scn_phys.scn_bookmark.zb_objset == ds->ds_object) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
863 scn->scn_phys.scn_bookmark.zb_objset = |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
864 ds->ds_phys->ds_prev_snap_obj; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
865 zfs_dbgmsg("snapshotting ds %llu; currently traversing; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
866 "reset zb_objset to %llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
867 (u_longlong_t)ds->ds_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
868 (u_longlong_t)ds->ds_phys->ds_prev_snap_obj); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
869 } else if (zap_lookup_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
870 scn->scn_phys.scn_queue_obj, ds->ds_object, &mintxg) == 0) { |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
871 VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
872 scn->scn_phys.scn_queue_obj, ds->ds_object, tx)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
873 VERIFY(zap_add_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
874 scn->scn_phys.scn_queue_obj, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
875 ds->ds_phys->ds_prev_snap_obj, mintxg, tx) == 0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
876 zfs_dbgmsg("snapshotting ds %llu; in queue; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
877 "replacing with %llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
878 (u_longlong_t)ds->ds_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
879 (u_longlong_t)ds->ds_phys->ds_prev_snap_obj); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
880 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
881 dsl_scan_sync_state(scn, tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
882 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
883 |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
884 void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
885 dsl_scan_ds_clone_swapped(dsl_dataset_t *ds1, dsl_dataset_t *ds2, dmu_tx_t *tx) |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
886 { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
887 dsl_pool_t *dp = ds1->ds_dir->dd_pool; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
888 dsl_scan_t *scn = dp->dp_scan; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
889 uint64_t mintxg; |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
890 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
891 if (scn->scn_phys.scn_state != DSS_SCANNING) |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
892 return; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
893 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
894 if (scn->scn_phys.scn_bookmark.zb_objset == ds1->ds_object) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
895 scn->scn_phys.scn_bookmark.zb_objset = ds2->ds_object; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
896 zfs_dbgmsg("clone_swap ds %llu; currently traversing; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
897 "reset zb_objset to %llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
898 (u_longlong_t)ds1->ds_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
899 (u_longlong_t)ds2->ds_object); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
900 } else if (scn->scn_phys.scn_bookmark.zb_objset == ds2->ds_object) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
901 scn->scn_phys.scn_bookmark.zb_objset = ds1->ds_object; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
902 zfs_dbgmsg("clone_swap ds %llu; currently traversing; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
903 "reset zb_objset to %llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
904 (u_longlong_t)ds2->ds_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
905 (u_longlong_t)ds1->ds_object); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
906 } |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
907 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
908 if (zap_lookup_int_key(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
909 ds1->ds_object, &mintxg) == 0) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
910 int err; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
911 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
912 ASSERT3U(mintxg, ==, ds1->ds_phys->ds_prev_snap_txg); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
913 ASSERT3U(mintxg, ==, ds2->ds_phys->ds_prev_snap_txg); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
914 VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
915 scn->scn_phys.scn_queue_obj, ds1->ds_object, tx)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
916 err = zap_add_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
917 scn->scn_phys.scn_queue_obj, ds2->ds_object, mintxg, tx); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
918 VERIFY(err == 0 || err == EEXIST); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
919 if (err == EEXIST) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
920 /* Both were there to begin with */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
921 VERIFY(0 == zap_add_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
922 scn->scn_phys.scn_queue_obj, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
923 ds1->ds_object, mintxg, tx)); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
924 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
925 zfs_dbgmsg("clone_swap ds %llu; in queue; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
926 "replacing with %llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
927 (u_longlong_t)ds1->ds_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
928 (u_longlong_t)ds2->ds_object); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
929 } else if (zap_lookup_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
930 scn->scn_phys.scn_queue_obj, ds2->ds_object, &mintxg) == 0) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
931 ASSERT3U(mintxg, ==, ds1->ds_phys->ds_prev_snap_txg); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
932 ASSERT3U(mintxg, ==, ds2->ds_phys->ds_prev_snap_txg); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
933 VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
934 scn->scn_phys.scn_queue_obj, ds2->ds_object, tx)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
935 VERIFY(0 == zap_add_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
936 scn->scn_phys.scn_queue_obj, ds1->ds_object, mintxg, tx)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
937 zfs_dbgmsg("clone_swap ds %llu; in queue; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
938 "replacing with %llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
939 (u_longlong_t)ds2->ds_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
940 (u_longlong_t)ds1->ds_object); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
941 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
942 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
943 dsl_scan_sync_state(scn, tx); |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
944 } |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
945 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
946 struct enqueue_clones_arg { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
947 dmu_tx_t *tx; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
948 uint64_t originobj; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
949 }; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
950 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
951 /* ARGSUSED */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
952 static int |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
953 enqueue_clones_cb(spa_t *spa, uint64_t dsobj, const char *dsname, void *arg) |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
954 { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
955 struct enqueue_clones_arg *eca = arg; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
956 dsl_dataset_t *ds; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
957 int err; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
958 dsl_pool_t *dp = spa->spa_dsl_pool; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
959 dsl_scan_t *scn = dp->dp_scan; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
960 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
961 err = dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
962 if (err) |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
963 return (err); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
964 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
965 if (ds->ds_dir->dd_phys->dd_origin_obj == eca->originobj) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
966 while (ds->ds_phys->ds_prev_snap_obj != eca->originobj) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
967 dsl_dataset_t *prev; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
968 err = dsl_dataset_hold_obj(dp, |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
969 ds->ds_phys->ds_prev_snap_obj, FTAG, &prev); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
970 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
971 dsl_dataset_rele(ds, FTAG); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
972 if (err) |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
973 return (err); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
974 ds = prev; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
975 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
976 VERIFY(zap_add_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
977 scn->scn_phys.scn_queue_obj, ds->ds_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
978 ds->ds_phys->ds_prev_snap_txg, eca->tx) == 0); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
979 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
980 dsl_dataset_rele(ds, FTAG); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
981 return (0); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
982 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
983 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
984 static void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
985 dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_tx_t *tx) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
986 { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
987 dsl_pool_t *dp = scn->scn_dp; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
988 dsl_dataset_t *ds; |
12839
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
989 objset_t *os; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
990 |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
991 VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds)); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
992 |
12839
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
993 if (dmu_objset_from_ds(ds, &os)) |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
994 goto out; |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
995 |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
996 /* |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
997 * Only the ZIL in the head (non-snapshot) is valid. Even though |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
998 * snapshots can have ZIL block pointers (which may be the same |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
999 * BP as in the head), they must be ignored. So we traverse the |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
1000 * ZIL here, rather than in scan_recurse(), because the regular |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
1001 * snapshot block-sharing rules don't apply to it. |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
1002 */ |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
1003 if (DSL_SCAN_IS_SCRUB_RESILVER(scn) && !dsl_dataset_is_snapshot(ds)) |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
1004 dsl_scan_zil(dp, &os->os_zil_header); |
1eab9192da8b
6844896 recursive snapshots take a long time
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12586
diff
changeset
|
1005 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1006 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1007 * Iterate over the bps in this ds. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1008 */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1009 dmu_buf_will_dirty(ds->ds_dbuf, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1010 dsl_scan_visit_rootbp(scn, ds, &ds->ds_phys->ds_bp, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1011 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1012 char *dsname = kmem_alloc(ZFS_MAXNAMELEN, KM_SLEEP); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1013 dsl_dataset_name(ds, dsname); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1014 zfs_dbgmsg("scanned dataset %llu (%s) with min=%llu max=%llu; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1015 "pausing=%u", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1016 (longlong_t)dsobj, dsname, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1017 (longlong_t)scn->scn_phys.scn_cur_min_txg, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1018 (longlong_t)scn->scn_phys.scn_cur_max_txg, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1019 (int)scn->scn_pausing); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1020 kmem_free(dsname, ZFS_MAXNAMELEN); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1021 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1022 if (scn->scn_pausing) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1023 goto out; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1024 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1025 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1026 * We've finished this pass over this dataset. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1027 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1028 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1029 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1030 * If we did not completely visit this dataset, do another pass. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1031 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1032 if (scn->scn_phys.scn_flags & DSF_VISIT_DS_AGAIN) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1033 zfs_dbgmsg("incomplete pass; visiting again"); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1034 scn->scn_phys.scn_flags &= ~DSF_VISIT_DS_AGAIN; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1035 VERIFY(zap_add_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1036 scn->scn_phys.scn_queue_obj, ds->ds_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1037 scn->scn_phys.scn_cur_max_txg, tx) == 0); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1038 goto out; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1039 } |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1040 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1041 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1042 * Add descendent datasets to work queue. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1043 */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1044 if (ds->ds_phys->ds_next_snap_obj != 0) { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1045 VERIFY(zap_add_int_key(dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1046 scn->scn_phys.scn_queue_obj, ds->ds_phys->ds_next_snap_obj, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1047 ds->ds_phys->ds_creation_txg, tx) == 0); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1048 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1049 if (ds->ds_phys->ds_num_children > 1) { |
10801
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1050 boolean_t usenext = B_FALSE; |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1051 if (ds->ds_phys->ds_next_clones_obj != 0) { |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1052 uint64_t count; |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1053 /* |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1054 * A bug in a previous version of the code could |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1055 * cause upgrade_clones_cb() to not set |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1056 * ds_next_snap_obj when it should, leading to a |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1057 * missing entry. Therefore we can only use the |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1058 * next_clones_obj when its count is correct. |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1059 */ |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1060 int err = zap_count(dp->dp_meta_objset, |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1061 ds->ds_phys->ds_next_clones_obj, &count); |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1062 if (err == 0 && |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1063 count == ds->ds_phys->ds_num_children - 1) |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1064 usenext = B_TRUE; |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1065 } |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1066 |
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1067 if (usenext) { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1068 VERIFY(zap_join_key(dp->dp_meta_objset, |
10801
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1069 ds->ds_phys->ds_next_clones_obj, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1070 scn->scn_phys.scn_queue_obj, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1071 ds->ds_phys->ds_creation_txg, tx) == 0); |
10801
e0bf032e8673
6822816 assertion failed: zap_remove_int(ds_next_clones_obj) returns ENOENT
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
10685
diff
changeset
|
1072 } else { |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1073 struct enqueue_clones_arg eca; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1074 eca.tx = tx; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1075 eca.originobj = ds->ds_object; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1076 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1077 (void) dmu_objset_find_spa(ds->ds_dir->dd_pool->dp_spa, |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1078 NULL, enqueue_clones_cb, &eca, DS_FIND_CHILDREN); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1079 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1080 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1081 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1082 out: |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1083 dsl_dataset_rele(ds, FTAG); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1084 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1085 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1086 /* ARGSUSED */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1087 static int |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1088 enqueue_cb(spa_t *spa, uint64_t dsobj, const char *dsname, void *arg) |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1089 { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1090 dmu_tx_t *tx = arg; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1091 dsl_dataset_t *ds; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1092 int err; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1093 dsl_pool_t *dp = spa->spa_dsl_pool; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1094 dsl_scan_t *scn = dp->dp_scan; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1095 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1096 err = dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1097 if (err) |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1098 return (err); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1099 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1100 while (ds->ds_phys->ds_prev_snap_obj != 0) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1101 dsl_dataset_t *prev; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1102 err = dsl_dataset_hold_obj(dp, ds->ds_phys->ds_prev_snap_obj, |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1103 FTAG, &prev); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1104 if (err) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1105 dsl_dataset_rele(ds, FTAG); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1106 return (err); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1107 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1108 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1109 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1110 * If this is a clone, we don't need to worry about it for now. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1111 */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1112 if (prev->ds_phys->ds_next_snap_obj != ds->ds_object) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1113 dsl_dataset_rele(ds, FTAG); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1114 dsl_dataset_rele(prev, FTAG); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1115 return (0); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1116 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1117 dsl_dataset_rele(ds, FTAG); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1118 ds = prev; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1119 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1120 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1121 VERIFY(zap_add_int_key(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1122 ds->ds_object, ds->ds_phys->ds_prev_snap_txg, tx) == 0); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1123 dsl_dataset_rele(ds, FTAG); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1124 return (0); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1125 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1126 |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1127 /* |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1128 * Scrub/dedup interaction. |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1129 * |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1130 * If there are N references to a deduped block, we don't want to scrub it |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1131 * N times -- ideally, we should scrub it exactly once. |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1132 * |
11619
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1133 * We leverage the fact that the dde's replication class (enum ddt_class) |
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1134 * is ordered from highest replication class (DDT_CLASS_DITTO) to lowest |
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1135 * (DDT_CLASS_UNIQUE) so that we may walk the DDT in that order. |
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1136 * |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1137 * To prevent excess scrubbing, the scrub begins by walking the DDT |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1138 * to find all blocks with refcnt > 1, and scrubs each of these once. |
11619
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1139 * Since there are two replication classes which contain blocks with |
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1140 * refcnt > 1, we scrub the highest replication class (DDT_CLASS_DITTO) first. |
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1141 * Finally the top-down scrub begins, only visiting blocks with refcnt == 1. |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1142 * |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1143 * There would be nothing more to say if a block's refcnt couldn't change |
11619
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1144 * during a scrub, but of course it can so we must account for changes |
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1145 * in a block's replication class. |
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1146 * |
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1147 * Here's an example of what can occur: |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1148 * |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1149 * If a block has refcnt > 1 during the DDT scrub phase, but has refcnt == 1 |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1150 * when visited during the top-down scrub phase, it will be scrubbed twice. |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1151 * This negates our scrub optimization, but is otherwise harmless. |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1152 * |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1153 * If a block has refcnt == 1 during the DDT scrub phase, but has refcnt > 1 |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1154 * on each visit during the top-down scrub phase, it will never be scrubbed. |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1155 * To catch this, ddt_sync_entry() notifies the scrub code whenever a block's |
11619
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1156 * reference class transitions to a higher level (i.e DDT_CLASS_UNIQUE to |
d3fb7ae6fe56
6909744 dedup should be set to off when a ZVOL is dumpified
George Wilson <George.Wilson@Sun.COM>
parents:
11182
diff
changeset
|
1157 * DDT_CLASS_DUPLICATE); if it transitions from refcnt == 1 to refcnt > 1 |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1158 * while a scrub is in progress, it scrubs the block right then. |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1159 */ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1160 static void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1161 dsl_scan_ddt(dsl_scan_t *scn, dmu_tx_t *tx) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1162 { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1163 ddt_bookmark_t *ddb = &scn->scn_phys.scn_ddt_bookmark; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1164 ddt_entry_t dde = { 0 }; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1165 int error; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1166 uint64_t n = 0; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1167 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1168 while ((error = ddt_walk(scn->scn_dp->dp_spa, ddb, &dde)) == 0) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1169 ddt_t *ddt; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1170 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1171 if (ddb->ddb_class > scn->scn_phys.scn_ddt_class_max) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1172 break; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1173 dprintf("visiting ddb=%llu/%llu/%llu/%llx\n", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1174 (longlong_t)ddb->ddb_class, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1175 (longlong_t)ddb->ddb_type, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1176 (longlong_t)ddb->ddb_checksum, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1177 (longlong_t)ddb->ddb_cursor); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1178 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1179 /* There should be no pending changes to the dedup table */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1180 ddt = scn->scn_dp->dp_spa->spa_ddt[ddb->ddb_checksum]; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1181 ASSERT(avl_first(&ddt->ddt_tree) == NULL); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1182 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1183 dsl_scan_ddt_entry(scn, ddb->ddb_checksum, &dde, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1184 n++; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1185 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1186 if (dsl_scan_check_pause(scn, NULL)) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1187 break; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1188 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1189 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1190 zfs_dbgmsg("scanned %llu ddt entries with class_max = %u; pausing=%u", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1191 (longlong_t)n, (int)scn->scn_phys.scn_ddt_class_max, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1192 (int)scn->scn_pausing); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1193 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1194 ASSERT(error == 0 || error == ENOENT); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1195 ASSERT(error != ENOENT || |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1196 ddb->ddb_class > scn->scn_phys.scn_ddt_class_max); |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1197 } |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1198 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1199 /* ARGSUSED */ |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1200 void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1201 dsl_scan_ddt_entry(dsl_scan_t *scn, enum zio_checksum checksum, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1202 ddt_entry_t *dde, dmu_tx_t *tx) |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1203 { |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1204 const ddt_key_t *ddk = &dde->dde_key; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1205 ddt_phys_t *ddp = dde->dde_phys; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1206 blkptr_t bp; |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1207 zbookmark_t zb = { 0 }; |
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1208 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1209 if (scn->scn_phys.scn_state != DSS_SCANNING) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1210 return; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1211 |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1212 for (int p = 0; p < DDT_PHYS_TYPES; p++, ddp++) { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1213 if (ddp->ddp_phys_birth == 0 || |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1214 ddp->ddp_phys_birth > scn->scn_phys.scn_cur_max_txg) |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1215 continue; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1216 ddt_bp_create(checksum, ddk, ddp, &bp); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1217 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1218 scn->scn_visited_this_txg++; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1219 scan_funcs[scn->scn_phys.scn_func](scn->scn_dp, &bp, &zb); |
11125
fca3e6d28599
6899923 vdev_offline/vdev_add deadlock
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
11066
diff
changeset
|
1220 } |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1221 } |
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1222 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1223 static void |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1224 dsl_scan_visit(dsl_scan_t *scn, dmu_tx_t *tx) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1225 { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1226 dsl_pool_t *dp = scn->scn_dp; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1227 zap_cursor_t zc; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1228 zap_attribute_t za; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1229 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1230 if (scn->scn_phys.scn_ddt_bookmark.ddb_class <= |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1231 scn->scn_phys.scn_ddt_class_max) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1232 scn->scn_phys.scn_cur_min_txg = scn->scn_phys.scn_min_txg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1233 scn->scn_phys.scn_cur_max_txg = scn->scn_phys.scn_max_txg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1234 dsl_scan_ddt(scn, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1235 if (scn->scn_pausing) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1236 return; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1237 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1238 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1239 if (scn->scn_phys.scn_bookmark.zb_objset == DMU_META_OBJSET) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1240 /* First do the MOS & ORIGIN */ |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1241 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1242 scn->scn_phys.scn_cur_min_txg = scn->scn_phys.scn_min_txg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1243 scn->scn_phys.scn_cur_max_txg = scn->scn_phys.scn_max_txg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1244 dsl_scan_visit_rootbp(scn, NULL, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1245 &dp->dp_meta_rootbp, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1246 spa_set_rootblkptr(dp->dp_spa, &dp->dp_meta_rootbp); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1247 if (scn->scn_pausing) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1248 return; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1249 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1250 if (spa_version(dp->dp_spa) < SPA_VERSION_DSL_SCRUB) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1251 VERIFY(0 == dmu_objset_find_spa(dp->dp_spa, |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1252 NULL, enqueue_cb, tx, DS_FIND_CHILDREN)); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1253 } else { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1254 dsl_scan_visitds(scn, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1255 dp->dp_origin_snap->ds_object, tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1256 } |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1257 ASSERT(!scn->scn_pausing); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1258 } else if (scn->scn_phys.scn_bookmark.zb_objset != |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1259 ZB_DESTROYED_OBJSET) { |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1260 /* |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1261 * If we were paused, continue from here. Note if the |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1262 * ds we were paused on was deleted, the zb_objset may |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1263 * be -1, so we will skip this and find a new objset |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1264 * below. |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1265 */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1266 dsl_scan_visitds(scn, scn->scn_phys.scn_bookmark.zb_objset, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1267 if (scn->scn_pausing) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1268 return; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1269 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1270 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1271 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1272 * In case we were paused right at the end of the ds, zero the |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1273 * bookmark so we don't think that we're still trying to resume. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1274 */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1275 bzero(&scn->scn_phys.scn_bookmark, sizeof (zbookmark_t)); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1276 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1277 /* keep pulling things out of the zap-object-as-queue */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1278 while (zap_cursor_init(&zc, dp->dp_meta_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1279 scn->scn_phys.scn_queue_obj), |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1280 zap_cursor_retrieve(&zc, &za) == 0) { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1281 dsl_dataset_t *ds; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1282 uint64_t dsobj; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1283 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1284 dsobj = strtonum(za.za_name, NULL); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
1285 VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1286 scn->scn_phys.scn_queue_obj, dsobj, tx)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1287 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1288 /* Set up min/max txg */ |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
1289 VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds)); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1290 if (za.za_first_integer != 0) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1291 scn->scn_phys.scn_cur_min_txg = |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1292 MAX(scn->scn_phys.scn_min_txg, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1293 za.za_first_integer); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1294 } else { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1295 scn->scn_phys.scn_cur_min_txg = |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1296 MAX(scn->scn_phys.scn_min_txg, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1297 ds->ds_phys->ds_prev_snap_txg); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1298 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1299 scn->scn_phys.scn_cur_max_txg = dsl_scan_ds_maxtxg(ds); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1300 dsl_dataset_rele(ds, FTAG); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1301 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1302 dsl_scan_visitds(scn, dsobj, tx); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1303 zap_cursor_fini(&zc); |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1304 if (scn->scn_pausing) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1305 return; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1306 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1307 zap_cursor_fini(&zc); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1308 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1309 |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1310 static boolean_t |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1311 dsl_scan_free_should_pause(dsl_scan_t *scn) |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1312 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1313 uint64_t elapsed_nanosecs; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1314 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1315 elapsed_nanosecs = gethrtime() - scn->scn_sync_start_time; |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1316 return (elapsed_nanosecs / NANOSEC > zfs_txg_timeout || |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1317 (elapsed_nanosecs / MICROSEC > zfs_free_min_time_ms && |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1318 txg_sync_waiting(scn->scn_dp)) || |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1319 spa_shutting_down(scn->scn_dp->dp_spa)); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1320 } |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1321 |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1322 static int |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1323 dsl_scan_free_block_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1324 { |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1325 dsl_scan_t *scn = arg; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1326 |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1327 if (!scn->scn_is_bptree || |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1328 (BP_GET_LEVEL(bp) == 0 && BP_GET_TYPE(bp) != DMU_OT_OBJSET)) { |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1329 if (dsl_scan_free_should_pause(scn)) |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1330 return (ERESTART); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1331 } |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1332 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1333 zio_nowait(zio_free_sync(scn->scn_zio_root, scn->scn_dp->dp_spa, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1334 dmu_tx_get_txg(tx), bp, 0)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1335 dsl_dir_diduse_space(tx->tx_pool->dp_free_dir, DD_USED_HEAD, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1336 -bp_get_dsize_sync(scn->scn_dp->dp_spa, bp), |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1337 -BP_GET_PSIZE(bp), -BP_GET_UCSIZE(bp), tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1338 scn->scn_visited_this_txg++; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1339 return (0); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1340 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1341 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1342 boolean_t |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1343 dsl_scan_active(dsl_scan_t *scn) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1344 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1345 spa_t *spa = scn->scn_dp->dp_spa; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1346 uint64_t used = 0, comp, uncomp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1347 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1348 if (spa->spa_load_state != SPA_LOAD_NONE) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1349 return (B_FALSE); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1350 if (spa_shutting_down(spa)) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1351 return (B_FALSE); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1352 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1353 if (scn->scn_phys.scn_state == DSS_SCANNING) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1354 return (B_TRUE); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1355 |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1356 if (spa_feature_is_active(spa, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1357 &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) { |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1358 return (B_TRUE); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1359 } |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1360 if (spa_version(scn->scn_dp->dp_spa) >= SPA_VERSION_DEADLISTS) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1361 (void) bpobj_space(&scn->scn_dp->dp_free_bpobj, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1362 &used, &comp, &uncomp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1363 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1364 return (used != 0); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1365 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1366 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1367 void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1368 dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1369 { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1370 dsl_scan_t *scn = dp->dp_scan; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1371 spa_t *spa = dp->dp_spa; |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1372 int err; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1373 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1374 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1375 * Check for scn_restart_txg before checking spa_load_state, so |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1376 * that we can restart an old-style scan while the pool is being |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1377 * imported (see dsl_scan_init). |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1378 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1379 if (scn->scn_restart_txg != 0 && |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1380 scn->scn_restart_txg <= tx->tx_txg) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1381 pool_scan_func_t func = POOL_SCAN_SCRUB; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1382 dsl_scan_done(scn, B_FALSE, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1383 if (vdev_resilver_needed(spa->spa_root_vdev, NULL, NULL)) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1384 func = POOL_SCAN_RESILVER; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1385 zfs_dbgmsg("restarting scan func=%u txg=%llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1386 func, tx->tx_txg); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1387 dsl_scan_setup_sync(scn, &func, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1388 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1389 |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1390 if (!dsl_scan_active(scn) || |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1391 spa_sync_pass(dp->dp_spa) > 1) |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1392 return; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1393 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1394 scn->scn_visited_this_txg = 0; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1395 scn->scn_pausing = B_FALSE; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1396 scn->scn_sync_start_time = gethrtime(); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1397 spa->spa_scrub_active = B_TRUE; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1398 |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1399 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1400 * First process the free list. If we pause the free, don't do |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1401 * any scanning. This ensures that there is no free list when |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1402 * we are scanning, so the scan code doesn't have to worry about |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1403 * traversing it. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1404 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1405 if (spa_version(dp->dp_spa) >= SPA_VERSION_DEADLISTS) { |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1406 scn->scn_is_bptree = B_FALSE; |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1407 scn->scn_zio_root = zio_root(dp->dp_spa, NULL, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1408 NULL, ZIO_FLAG_MUSTSUCCEED); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1409 err = bpobj_iterate(&dp->dp_free_bpobj, |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1410 dsl_scan_free_block_cb, scn, tx); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
1411 VERIFY3U(0, ==, zio_wait(scn->scn_zio_root)); |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1412 |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1413 if (err == 0 && spa_feature_is_active(spa, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1414 &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) { |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1415 scn->scn_is_bptree = B_TRUE; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1416 scn->scn_zio_root = zio_root(dp->dp_spa, NULL, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1417 NULL, ZIO_FLAG_MUSTSUCCEED); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1418 err = bptree_iterate(dp->dp_meta_objset, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1419 dp->dp_bptree_obj, B_TRUE, dsl_scan_free_block_cb, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1420 scn, tx); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
1421 VERIFY3U(0, ==, zio_wait(scn->scn_zio_root)); |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1422 if (err != 0) |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1423 return; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1424 |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1425 /* disable async destroy feature */ |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1426 spa_feature_decr(spa, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1427 &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY], tx); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1428 ASSERT(!spa_feature_is_active(spa, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1429 &spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
1430 VERIFY3U(0, ==, zap_remove(dp->dp_meta_objset, |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1431 DMU_POOL_DIRECTORY_OBJECT, |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1432 DMU_POOL_BPTREE_OBJ, tx)); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
1433 VERIFY3U(0, ==, bptree_free(dp->dp_meta_objset, |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1434 dp->dp_bptree_obj, tx)); |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1435 dp->dp_bptree_obj = 0; |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1436 } |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1437 if (scn->scn_visited_this_txg) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1438 zfs_dbgmsg("freed %llu blocks in %llums from " |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1439 "free_bpobj/bptree txg %llu", |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1440 (longlong_t)scn->scn_visited_this_txg, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1441 (longlong_t) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1442 (gethrtime() - scn->scn_sync_start_time) / MICROSEC, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1443 (longlong_t)tx->tx_txg); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1444 scn->scn_visited_this_txg = 0; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1445 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1446 * Re-sync the ddt so that we can further modify |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1447 * it when doing bprewrite. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1448 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1449 ddt_sync(spa, tx->tx_txg); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1450 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1451 if (err == ERESTART) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1452 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1453 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1454 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1455 if (scn->scn_phys.scn_state != DSS_SCANNING) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1456 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1457 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1458 if (scn->scn_phys.scn_ddt_bookmark.ddb_class <= |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1459 scn->scn_phys.scn_ddt_class_max) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1460 zfs_dbgmsg("doing scan sync txg %llu; " |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1461 "ddt bm=%llu/%llu/%llu/%llx", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1462 (longlong_t)tx->tx_txg, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1463 (longlong_t)scn->scn_phys.scn_ddt_bookmark.ddb_class, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1464 (longlong_t)scn->scn_phys.scn_ddt_bookmark.ddb_type, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1465 (longlong_t)scn->scn_phys.scn_ddt_bookmark.ddb_checksum, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1466 (longlong_t)scn->scn_phys.scn_ddt_bookmark.ddb_cursor); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1467 ASSERT(scn->scn_phys.scn_bookmark.zb_objset == 0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1468 ASSERT(scn->scn_phys.scn_bookmark.zb_object == 0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1469 ASSERT(scn->scn_phys.scn_bookmark.zb_level == 0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1470 ASSERT(scn->scn_phys.scn_bookmark.zb_blkid == 0); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1471 } else { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1472 zfs_dbgmsg("doing scan sync txg %llu; bm=%llu/%llu/%llu/%llu", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1473 (longlong_t)tx->tx_txg, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1474 (longlong_t)scn->scn_phys.scn_bookmark.zb_objset, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1475 (longlong_t)scn->scn_phys.scn_bookmark.zb_object, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1476 (longlong_t)scn->scn_phys.scn_bookmark.zb_level, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1477 (longlong_t)scn->scn_phys.scn_bookmark.zb_blkid); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1478 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1479 |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1480 scn->scn_zio_root = zio_root(dp->dp_spa, NULL, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1481 NULL, ZIO_FLAG_CANFAIL); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1482 dsl_scan_visit(scn, tx); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1483 (void) zio_wait(scn->scn_zio_root); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
12296
diff
changeset
|
1484 scn->scn_zio_root = NULL; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1485 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1486 zfs_dbgmsg("visited %llu blocks in %llums", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1487 (longlong_t)scn->scn_visited_this_txg, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1488 (longlong_t)(gethrtime() - scn->scn_sync_start_time) / MICROSEC); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1489 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1490 if (!scn->scn_pausing) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1491 /* finished with scan. */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1492 zfs_dbgmsg("finished scan txg %llu", (longlong_t)tx->tx_txg); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1493 dsl_scan_done(scn, B_TRUE, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1494 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1495 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1496 if (DSL_SCAN_IS_SCRUB_RESILVER(scn)) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1497 mutex_enter(&spa->spa_scrub_lock); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1498 while (spa->spa_scrub_inflight > 0) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1499 cv_wait(&spa->spa_scrub_io_cv, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1500 &spa->spa_scrub_lock); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1501 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1502 mutex_exit(&spa->spa_scrub_lock); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1503 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1504 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1505 dsl_scan_sync_state(scn, tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1506 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1507 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1508 /* |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1509 * This will start a new scan, or restart an existing one. |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1510 */ |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1511 void |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1512 dsl_resilver_restart(dsl_pool_t *dp, uint64_t txg) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1513 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1514 if (txg == 0) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1515 dmu_tx_t *tx; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1516 tx = dmu_tx_create_dd(dp->dp_mos_dir); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1517 VERIFY(0 == dmu_tx_assign(tx, TXG_WAIT)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1518 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1519 txg = dmu_tx_get_txg(tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1520 dp->dp_scan->scn_restart_txg = txg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1521 dmu_tx_commit(tx); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1522 } else { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1523 dp->dp_scan->scn_restart_txg = txg; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1524 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1525 zfs_dbgmsg("restarting resilver txg=%llu", txg); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1526 } |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1527 |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1528 boolean_t |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1529 dsl_scan_resilvering(dsl_pool_t *dp) |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1530 { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1531 return (dp->dp_scan->scn_phys.scn_state == DSS_SCANNING && |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1532 dp->dp_scan->scn_phys.scn_func == POOL_SCAN_RESILVER); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1533 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1534 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1535 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1536 * scrub consumers |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1537 */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1538 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1539 static void |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1540 count_block(zfs_all_blkstats_t *zab, const blkptr_t *bp) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1541 { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1542 int i; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1543 |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1544 /* |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1545 * If we resume after a reboot, zab will be NULL; don't record |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1546 * incomplete stats in that case. |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1547 */ |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1548 if (zab == NULL) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1549 return; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1550 |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1551 for (i = 0; i < 4; i++) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1552 int l = (i < 2) ? BP_GET_LEVEL(bp) : DN_MAX_LEVELS; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1553 int t = (i & 1) ? BP_GET_TYPE(bp) : DMU_OT_TOTAL; |
13700
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1554 if (t & DMU_OT_NEWTYPE) |
2889e2596bd6
2619 asynchronous destruction of ZFS file systems
Christopher Siden <chris.siden@delphix.com>
parents:
12839
diff
changeset
|
1555 t = DMU_OT_OTHER; |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1556 zfs_blkstat_t *zb = &zab->zab_type[l][t]; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1557 int equal; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1558 |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1559 zb->zb_count++; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1560 zb->zb_asize += BP_GET_ASIZE(bp); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1561 zb->zb_lsize += BP_GET_LSIZE(bp); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1562 zb->zb_psize += BP_GET_PSIZE(bp); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1563 zb->zb_gangs += BP_COUNT_GANG(bp); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1564 |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1565 switch (BP_GET_NDVAS(bp)) { |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1566 case 2: |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1567 if (DVA_GET_VDEV(&bp->blk_dva[0]) == |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1568 DVA_GET_VDEV(&bp->blk_dva[1])) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1569 zb->zb_ditto_2_of_2_samevdev++; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1570 break; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1571 case 3: |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1572 equal = (DVA_GET_VDEV(&bp->blk_dva[0]) == |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1573 DVA_GET_VDEV(&bp->blk_dva[1])) + |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1574 (DVA_GET_VDEV(&bp->blk_dva[0]) == |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1575 DVA_GET_VDEV(&bp->blk_dva[2])) + |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1576 (DVA_GET_VDEV(&bp->blk_dva[1]) == |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1577 DVA_GET_VDEV(&bp->blk_dva[2])); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1578 if (equal == 1) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1579 zb->zb_ditto_2_of_3_samevdev++; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1580 else if (equal == 3) |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1581 zb->zb_ditto_3_of_3_samevdev++; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1582 break; |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1583 } |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1584 } |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1585 } |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1586 |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1587 static void |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1588 dsl_scan_scrub_done(zio_t *zio) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1589 { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1590 spa_t *spa = zio->io_spa; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1591 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1592 zio_data_buf_free(zio->io_data, zio->io_size); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1593 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1594 mutex_enter(&spa->spa_scrub_lock); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1595 spa->spa_scrub_inflight--; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1596 cv_broadcast(&spa->spa_scrub_io_cv); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1597 |
7754
b80e4842ad54
6754011 SPA 3.0: lock breakup, i/o pipeline refactoring, device failure handling
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7182
diff
changeset
|
1598 if (zio->io_error && (zio->io_error != ECKSUM || |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1599 !(zio->io_flags & ZIO_FLAG_SPECULATIVE))) { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1600 spa->spa_dsl_pool->dp_scan->scn_phys.scn_errors++; |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1601 } |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1602 mutex_exit(&spa->spa_scrub_lock); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1603 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1604 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1605 static int |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1606 dsl_scan_scrub_cb(dsl_pool_t *dp, |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1607 const blkptr_t *bp, const zbookmark_t *zb) |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1608 { |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1609 dsl_scan_t *scn = dp->dp_scan; |
8274
846b39508aff
6713916 scrub/resilver needlessly decompress data
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
8241
diff
changeset
|
1610 size_t size = BP_GET_PSIZE(bp); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1611 spa_t *spa = dp->dp_spa; |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1612 uint64_t phys_birth = BP_PHYSICAL_BIRTH(bp); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1613 boolean_t needs_io; |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1614 int zio_flags = ZIO_FLAG_SCAN_THREAD | ZIO_FLAG_RAW | ZIO_FLAG_CANFAIL; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1615 int zio_priority; |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1616 int scan_delay = 0; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1617 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1618 if (phys_birth <= scn->scn_phys.scn_min_txg || |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1619 phys_birth >= scn->scn_phys.scn_max_txg) |
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
1620 return (0); |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
1621 |
7837
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1622 count_block(dp->dp_blkstats, bp); |
001de5627df3
6333409 traversal code should be able to issue multiple reads in parallel
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
7754
diff
changeset
|
1623 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1624 ASSERT(DSL_SCAN_IS_SCRUB_RESILVER(scn)); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1625 if (scn->scn_phys.scn_func == POOL_SCAN_SCRUB) { |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1626 zio_flags |= ZIO_FLAG_SCRUB; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1627 zio_priority = ZIO_PRIORITY_SCRUB; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1628 needs_io = B_TRUE; |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1629 scan_delay = zfs_scrub_delay; |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1630 } else if (scn->scn_phys.scn_func == POOL_SCAN_RESILVER) { |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1631 zio_flags |= ZIO_FLAG_RESILVER; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1632 zio_priority = ZIO_PRIORITY_RESILVER; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1633 needs_io = B_FALSE; |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1634 scan_delay = zfs_resilver_delay; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1635 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1636 |
7160
12f467ba43f4
6725330 'zpool scrub -v' doesn't show data errors after scrub completes
ahrens
parents:
7046
diff
changeset
|
1637 /* If it's an intent log block, failure is expected. */ |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1638 if (zb->zb_level == ZB_ZIL_LEVEL) |
7160
12f467ba43f4
6725330 'zpool scrub -v' doesn't show data errors after scrub completes
ahrens
parents:
7046
diff
changeset
|
1639 zio_flags |= ZIO_FLAG_SPECULATIVE; |
12f467ba43f4
6725330 'zpool scrub -v' doesn't show data errors after scrub completes
ahrens
parents:
7046
diff
changeset
|
1640 |
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
1641 for (int d = 0; d < BP_GET_NDVAS(bp); d++) { |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1642 vdev_t *vd = vdev_lookup_top(spa, |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1643 DVA_GET_VDEV(&bp->blk_dva[d])); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1644 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1645 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1646 * Keep track of how much data we've examined so that |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1647 * zpool(1M) status can make useful progress reports. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1648 */ |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1649 scn->scn_phys.scn_examined += DVA_GET_ASIZE(&bp->blk_dva[d]); |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1650 spa->spa_scan_pass_exam += DVA_GET_ASIZE(&bp->blk_dva[d]); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1651 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1652 /* if it's a resilver, this may not be in the target range */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1653 if (!needs_io) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1654 if (DVA_GET_GANG(&bp->blk_dva[d])) { |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1655 /* |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1656 * Gang members may be spread across multiple |
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
1657 * vdevs, so the best estimate we have is the |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
1658 * scrub range, which has already been checked. |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1659 * XXX -- it would be better to change our |
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
1660 * allocation policy to ensure that all |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
1661 * gang members reside on the same vdev. |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1662 */ |
8241
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
1663 needs_io = B_TRUE; |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
1664 } else { |
5a60f16123ba
6328632 zpool offline is a bit too conservative
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
7837
diff
changeset
|
1665 needs_io = vdev_dtl_contains(vd, DTL_PARTIAL, |
10922
e2081f502306
PSARC 2009/571 ZFS Deduplication Properties
Jeff Bonwick <Jeff.Bonwick@Sun.COM>
parents:
10850
diff
changeset
|
1666 phys_birth, 1); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1667 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1668 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1669 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1670 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1671 if (needs_io && !zfs_no_scrub_io) { |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1672 vdev_t *rvd = spa->spa_root_vdev; |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1673 uint64_t maxinflight = rvd->vdev_children * zfs_top_maxinflight; |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1674 void *data = zio_data_buf_alloc(size); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1675 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1676 mutex_enter(&spa->spa_scrub_lock); |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1677 while (spa->spa_scrub_inflight >= maxinflight) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1678 cv_wait(&spa->spa_scrub_io_cv, &spa->spa_scrub_lock); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1679 spa->spa_scrub_inflight++; |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1680 mutex_exit(&spa->spa_scrub_lock); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1681 |
12586
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1682 /* |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1683 * If we're seeing recent (zfs_scan_idle) "important" I/Os |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1684 * then throttle our workload to limit the impact of a scan. |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1685 */ |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1686 if (ddi_get_lbolt64() - spa->spa_last_io <= zfs_scan_idle) |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1687 delay(scan_delay); |
b118bbd65be9
6494473 ZFS needs a way to slow down resilvering
George Wilson <George.Wilson@Sun.COM>
parents:
12470
diff
changeset
|
1688 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1689 zio_nowait(zio_read(NULL, spa, bp, data, size, |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1690 dsl_scan_scrub_done, NULL, zio_priority, |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1691 zio_flags, zb)); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1692 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1693 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1694 /* do not relocate this block */ |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1695 return (0); |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1696 } |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1697 |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1698 int |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1699 dsl_scan(dsl_pool_t *dp, pool_scan_func_t func) |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1700 { |
9997
174d75a29a1c
6843235 zpool resilver stalls with spa_scrub_thread in a 3 way deadlock
George Wilson <George.Wilson@Sun.COM>
parents:
9701
diff
changeset
|
1701 spa_t *spa = dp->dp_spa; |
174d75a29a1c
6843235 zpool resilver stalls with spa_scrub_thread in a 3 way deadlock
George Wilson <George.Wilson@Sun.COM>
parents:
9701
diff
changeset
|
1702 |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1703 /* |
10850
bb29ac73664d
6840704 osol_0906 PV guests sometimes hang at login prompt
George Wilson <George.Wilson@Sun.COM>
parents:
10801
diff
changeset
|
1704 * Purge all vdev caches and probe all devices. We do this here |
bb29ac73664d
6840704 osol_0906 PV guests sometimes hang at login prompt
George Wilson <George.Wilson@Sun.COM>
parents:
10801
diff
changeset
|
1705 * rather than in sync context because this requires a writer lock |
bb29ac73664d
6840704 osol_0906 PV guests sometimes hang at login prompt
George Wilson <George.Wilson@Sun.COM>
parents:
10801
diff
changeset
|
1706 * on the spa_config lock, which we can't do from sync context. The |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1707 * spa_scrub_reopen flag indicates that vdev_open() should not |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1708 * attempt to start another scrub. |
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1709 */ |
10685
931790026ac6
6846163 ZFS continues to use faulted logzilla, bringing system to a crawl
George Wilson <George.Wilson@Sun.COM>
parents:
9997
diff
changeset
|
1710 spa_vdev_state_enter(spa, SCL_NONE); |
9997
174d75a29a1c
6843235 zpool resilver stalls with spa_scrub_thread in a 3 way deadlock
George Wilson <George.Wilson@Sun.COM>
parents:
9701
diff
changeset
|
1711 spa->spa_scrub_reopen = B_TRUE; |
174d75a29a1c
6843235 zpool resilver stalls with spa_scrub_thread in a 3 way deadlock
George Wilson <George.Wilson@Sun.COM>
parents:
9701
diff
changeset
|
1712 vdev_reopen(spa->spa_root_vdev); |
174d75a29a1c
6843235 zpool resilver stalls with spa_scrub_thread in a 3 way deadlock
George Wilson <George.Wilson@Sun.COM>
parents:
9701
diff
changeset
|
1713 spa->spa_scrub_reopen = B_FALSE; |
174d75a29a1c
6843235 zpool resilver stalls with spa_scrub_thread in a 3 way deadlock
George Wilson <George.Wilson@Sun.COM>
parents:
9701
diff
changeset
|
1714 (void) spa_vdev_state_exit(spa, NULL, 0); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1715 |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1716 return (dsl_sync_task_do(dp, dsl_scan_setup_check, |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
12295
diff
changeset
|
1717 dsl_scan_setup_sync, dp->dp_scan, &func, 0)); |
7046
361307ae060d
6343667 scrub/resilver has to start over when a snapshot is taken
ahrens
parents:
diff
changeset
|
1718 } |