Mercurial > illumos > illumos-gate
annotate usr/src/uts/common/fs/zfs/dsl_deadlist.c @ 13765:9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
author | Richard Lowe <richlowe@richlowe.net> |
---|---|
date | Wed, 01 Aug 2012 16:40:39 -0400 |
parents | 38b4aca480b3 |
children | 8f78aae28a63 |
rev | line source |
---|---|
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
1 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
2 * CDDL HEADER START |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
3 * |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
4 * The contents of this file are subject to the terms of the |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
5 * Common Development and Distribution License (the "License"). |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
6 * You may not use this file except in compliance with the License. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
7 * |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
9 * or http://www.opensolaris.org/os/licensing. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
10 * See the License for the specific language governing permissions |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
11 * and limitations under the License. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
12 * |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
13 * When distributing Covered Code, include this CDDL HEADER in each |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
15 * If applicable, add the following below this CDDL HEADER, with the |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
16 * fields enclosed by brackets "[]" replaced with your own identifying |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
17 * information: Portions Copyright [yyyy] [name of copyright owner] |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
18 * |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
19 * CDDL HEADER END |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
20 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
21 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
23 * Copyright (c) 2011 by Delphix. All rights reserved. |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
24 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
25 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
26 #include <sys/dsl_dataset.h> |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
27 #include <sys/dmu.h> |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
28 #include <sys/refcount.h> |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
29 #include <sys/zap.h> |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
30 #include <sys/zfs_context.h> |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
31 #include <sys/dsl_pool.h> |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
32 |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
33 /* |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
34 * Deadlist concurrency: |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
35 * |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
36 * Deadlists can only be modified from the syncing thread. |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
37 * |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
38 * Except for dsl_deadlist_insert(), it can only be modified with the |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
39 * dp_config_rwlock held with RW_WRITER. |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
40 * |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
41 * The accessors (dsl_deadlist_space() and dsl_deadlist_space_range()) can |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
42 * be called concurrently, from open context, with the dl_config_rwlock held |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
43 * with RW_READER. |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
44 * |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
45 * Therefore, we only need to provide locking between dsl_deadlist_insert() and |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
46 * the accessors, protecting: |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
47 * dl_phys->dl_used,comp,uncomp |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
48 * and protecting the dl_tree from being loaded. |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
49 * The locking is provided by dl_lock. Note that locking on the bpobj_t |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
50 * provides its own locking, and dl_oldfmt is immutable. |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
51 */ |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
52 |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
53 static int |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
54 dsl_deadlist_compare(const void *arg1, const void *arg2) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
55 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
56 const dsl_deadlist_entry_t *dle1 = arg1; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
57 const dsl_deadlist_entry_t *dle2 = arg2; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
58 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
59 if (dle1->dle_mintxg < dle2->dle_mintxg) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
60 return (-1); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
61 else if (dle1->dle_mintxg > dle2->dle_mintxg) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
62 return (+1); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
63 else |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
64 return (0); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
65 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
66 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
67 static void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
68 dsl_deadlist_load_tree(dsl_deadlist_t *dl) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
69 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
70 zap_cursor_t zc; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
71 zap_attribute_t za; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
72 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
73 ASSERT(!dl->dl_oldfmt); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
74 if (dl->dl_havetree) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
75 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
76 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
77 avl_create(&dl->dl_tree, dsl_deadlist_compare, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
78 sizeof (dsl_deadlist_entry_t), |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
79 offsetof(dsl_deadlist_entry_t, dle_node)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
80 for (zap_cursor_init(&zc, dl->dl_os, dl->dl_object); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
81 zap_cursor_retrieve(&zc, &za) == 0; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
82 zap_cursor_advance(&zc)) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
83 dsl_deadlist_entry_t *dle = kmem_alloc(sizeof (*dle), KM_SLEEP); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
84 dle->dle_mintxg = strtonum(za.za_name, NULL); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
85 VERIFY3U(0, ==, bpobj_open(&dle->dle_bpobj, dl->dl_os, |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
86 za.za_first_integer)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
87 avl_add(&dl->dl_tree, dle); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
88 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
89 zap_cursor_fini(&zc); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
90 dl->dl_havetree = B_TRUE; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
91 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
92 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
93 void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
94 dsl_deadlist_open(dsl_deadlist_t *dl, objset_t *os, uint64_t object) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
95 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
96 dmu_object_info_t doi; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
97 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
98 mutex_init(&dl->dl_lock, NULL, MUTEX_DEFAULT, NULL); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
99 dl->dl_os = os; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
100 dl->dl_object = object; |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
101 VERIFY3U(0, ==, dmu_bonus_hold(os, object, dl, &dl->dl_dbuf)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
102 dmu_object_info_from_db(dl->dl_dbuf, &doi); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
103 if (doi.doi_type == DMU_OT_BPOBJ) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
104 dmu_buf_rele(dl->dl_dbuf, dl); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
105 dl->dl_dbuf = NULL; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
106 dl->dl_oldfmt = B_TRUE; |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
107 VERIFY3U(0, ==, bpobj_open(&dl->dl_bpobj, os, object)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
108 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
109 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
110 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
111 dl->dl_oldfmt = B_FALSE; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
112 dl->dl_phys = dl->dl_dbuf->db_data; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
113 dl->dl_havetree = B_FALSE; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
114 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
115 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
116 void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
117 dsl_deadlist_close(dsl_deadlist_t *dl) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
118 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
119 void *cookie = NULL; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
120 dsl_deadlist_entry_t *dle; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
121 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
122 if (dl->dl_oldfmt) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
123 dl->dl_oldfmt = B_FALSE; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
124 bpobj_close(&dl->dl_bpobj); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
125 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
126 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
127 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
128 if (dl->dl_havetree) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
129 while ((dle = avl_destroy_nodes(&dl->dl_tree, &cookie)) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
130 != NULL) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
131 bpobj_close(&dle->dle_bpobj); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
132 kmem_free(dle, sizeof (*dle)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
133 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
134 avl_destroy(&dl->dl_tree); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
135 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
136 dmu_buf_rele(dl->dl_dbuf, dl); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
137 mutex_destroy(&dl->dl_lock); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
138 dl->dl_dbuf = NULL; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
139 dl->dl_phys = NULL; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
140 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
141 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
142 uint64_t |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
143 dsl_deadlist_alloc(objset_t *os, dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
144 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
145 if (spa_version(dmu_objset_spa(os)) < SPA_VERSION_DEADLISTS) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
146 return (bpobj_alloc(os, SPA_MAXBLOCKSIZE, tx)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
147 return (zap_create(os, DMU_OT_DEADLIST, DMU_OT_DEADLIST_HDR, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
148 sizeof (dsl_deadlist_phys_t), tx)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
149 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
150 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
151 void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
152 dsl_deadlist_free(objset_t *os, uint64_t dlobj, dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
153 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
154 dmu_object_info_t doi; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
155 zap_cursor_t zc; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
156 zap_attribute_t za; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
157 |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
158 VERIFY3U(0, ==, dmu_object_info(os, dlobj, &doi)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
159 if (doi.doi_type == DMU_OT_BPOBJ) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
160 bpobj_free(os, dlobj, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
161 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
162 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
163 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
164 for (zap_cursor_init(&zc, os, dlobj); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
165 zap_cursor_retrieve(&zc, &za) == 0; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
166 zap_cursor_advance(&zc)) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
167 bpobj_free(os, za.za_first_integer, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
168 zap_cursor_fini(&zc); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
169 VERIFY3U(0, ==, dmu_object_free(os, dlobj, tx)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
170 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
171 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
172 void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
173 dsl_deadlist_insert(dsl_deadlist_t *dl, const blkptr_t *bp, dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
174 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
175 dsl_deadlist_entry_t dle_tofind; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
176 dsl_deadlist_entry_t *dle; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
177 avl_index_t where; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
178 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
179 if (dl->dl_oldfmt) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
180 bpobj_enqueue(&dl->dl_bpobj, bp, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
181 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
182 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
183 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
184 dsl_deadlist_load_tree(dl); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
185 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
186 dmu_buf_will_dirty(dl->dl_dbuf, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
187 mutex_enter(&dl->dl_lock); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
188 dl->dl_phys->dl_used += |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
189 bp_get_dsize_sync(dmu_objset_spa(dl->dl_os), bp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
190 dl->dl_phys->dl_comp += BP_GET_PSIZE(bp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
191 dl->dl_phys->dl_uncomp += BP_GET_UCSIZE(bp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
192 mutex_exit(&dl->dl_lock); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
193 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
194 dle_tofind.dle_mintxg = bp->blk_birth; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
195 dle = avl_find(&dl->dl_tree, &dle_tofind, &where); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
196 if (dle == NULL) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
197 dle = avl_nearest(&dl->dl_tree, where, AVL_BEFORE); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
198 else |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
199 dle = AVL_PREV(&dl->dl_tree, dle); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
200 bpobj_enqueue(&dle->dle_bpobj, bp, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
201 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
202 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
203 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
204 * Insert new key in deadlist, which must be > all current entries. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
205 * mintxg is not inclusive. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
206 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
207 void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
208 dsl_deadlist_add_key(dsl_deadlist_t *dl, uint64_t mintxg, dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
209 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
210 uint64_t obj; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
211 dsl_deadlist_entry_t *dle; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
212 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
213 if (dl->dl_oldfmt) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
214 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
215 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
216 dsl_deadlist_load_tree(dl); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
217 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
218 dle = kmem_alloc(sizeof (*dle), KM_SLEEP); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
219 dle->dle_mintxg = mintxg; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
220 obj = bpobj_alloc(dl->dl_os, SPA_MAXBLOCKSIZE, tx); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
221 VERIFY3U(0, ==, bpobj_open(&dle->dle_bpobj, dl->dl_os, obj)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
222 avl_add(&dl->dl_tree, dle); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
223 |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
224 VERIFY3U(0, ==, zap_add_int_key(dl->dl_os, dl->dl_object, |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
225 mintxg, obj, tx)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
226 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
227 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
228 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
229 * Remove this key, merging its entries into the previous key. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
230 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
231 void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
232 dsl_deadlist_remove_key(dsl_deadlist_t *dl, uint64_t mintxg, dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
233 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
234 dsl_deadlist_entry_t dle_tofind; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
235 dsl_deadlist_entry_t *dle, *dle_prev; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
236 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
237 if (dl->dl_oldfmt) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
238 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
239 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
240 dsl_deadlist_load_tree(dl); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
241 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
242 dle_tofind.dle_mintxg = mintxg; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
243 dle = avl_find(&dl->dl_tree, &dle_tofind, NULL); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
244 dle_prev = AVL_PREV(&dl->dl_tree, dle); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
245 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
246 bpobj_enqueue_subobj(&dle_prev->dle_bpobj, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
247 dle->dle_bpobj.bpo_object, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
248 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
249 avl_remove(&dl->dl_tree, dle); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
250 bpobj_close(&dle->dle_bpobj); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
251 kmem_free(dle, sizeof (*dle)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
252 |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
253 VERIFY3U(0, ==, zap_remove_int(dl->dl_os, dl->dl_object, mintxg, tx)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
254 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
255 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
256 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
257 * Walk ds's snapshots to regenerate generate ZAP & AVL. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
258 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
259 static void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
260 dsl_deadlist_regenerate(objset_t *os, uint64_t dlobj, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
261 uint64_t mrs_obj, dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
262 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
263 dsl_deadlist_t dl; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
264 dsl_pool_t *dp = dmu_objset_pool(os); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
265 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
266 dsl_deadlist_open(&dl, os, dlobj); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
267 if (dl.dl_oldfmt) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
268 dsl_deadlist_close(&dl); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
269 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
270 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
271 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
272 while (mrs_obj != 0) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
273 dsl_dataset_t *ds; |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
274 VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, mrs_obj, FTAG, &ds)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
275 dsl_deadlist_add_key(&dl, ds->ds_phys->ds_prev_snap_txg, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
276 mrs_obj = ds->ds_phys->ds_prev_snap_obj; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
277 dsl_dataset_rele(ds, FTAG); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
278 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
279 dsl_deadlist_close(&dl); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
280 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
281 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
282 uint64_t |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
283 dsl_deadlist_clone(dsl_deadlist_t *dl, uint64_t maxtxg, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
284 uint64_t mrs_obj, dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
285 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
286 dsl_deadlist_entry_t *dle; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
287 uint64_t newobj; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
288 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
289 newobj = dsl_deadlist_alloc(dl->dl_os, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
290 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
291 if (dl->dl_oldfmt) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
292 dsl_deadlist_regenerate(dl->dl_os, newobj, mrs_obj, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
293 return (newobj); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
294 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
295 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
296 dsl_deadlist_load_tree(dl); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
297 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
298 for (dle = avl_first(&dl->dl_tree); dle; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
299 dle = AVL_NEXT(&dl->dl_tree, dle)) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
300 uint64_t obj; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
301 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
302 if (dle->dle_mintxg >= maxtxg) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
303 break; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
304 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
305 obj = bpobj_alloc(dl->dl_os, SPA_MAXBLOCKSIZE, tx); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
306 VERIFY3U(0, ==, zap_add_int_key(dl->dl_os, newobj, |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
307 dle->dle_mintxg, obj, tx)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
308 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
309 return (newobj); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
310 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
311 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
312 void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
313 dsl_deadlist_space(dsl_deadlist_t *dl, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
314 uint64_t *usedp, uint64_t *compp, uint64_t *uncompp) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
315 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
316 if (dl->dl_oldfmt) { |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
317 VERIFY3U(0, ==, bpobj_space(&dl->dl_bpobj, |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
318 usedp, compp, uncompp)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
319 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
320 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
321 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
322 mutex_enter(&dl->dl_lock); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
323 *usedp = dl->dl_phys->dl_used; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
324 *compp = dl->dl_phys->dl_comp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
325 *uncompp = dl->dl_phys->dl_uncomp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
326 mutex_exit(&dl->dl_lock); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
327 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
328 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
329 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
330 * return space used in the range (mintxg, maxtxg]. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
331 * Includes maxtxg, does not include mintxg. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
332 * mintxg and maxtxg must both be keys in the deadlist (unless maxtxg is |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
333 * larger than any bp in the deadlist (eg. UINT64_MAX)). |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
334 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
335 void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
336 dsl_deadlist_space_range(dsl_deadlist_t *dl, uint64_t mintxg, uint64_t maxtxg, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
337 uint64_t *usedp, uint64_t *compp, uint64_t *uncompp) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
338 { |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
339 dsl_deadlist_entry_t *dle; |
13512
060607df0c9d
backout 1644/1645/1646/1647/1708: Breaks 'zfs snapshot', boot environments
Richard Lowe <richlowe@richlowe.net>
parents:
13509
diff
changeset
|
340 dsl_deadlist_entry_t dle_tofind; |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
341 avl_index_t where; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
342 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
343 if (dl->dl_oldfmt) { |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
344 VERIFY3U(0, ==, bpobj_space_range(&dl->dl_bpobj, |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
345 mintxg, maxtxg, usedp, compp, uncompp)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
346 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
347 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
348 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
349 *usedp = *compp = *uncompp = 0; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
350 |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
351 mutex_enter(&dl->dl_lock); |
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
352 dsl_deadlist_load_tree(dl); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
353 dle_tofind.dle_mintxg = mintxg; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
354 dle = avl_find(&dl->dl_tree, &dle_tofind, &where); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
355 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
356 * If we don't find this mintxg, there shouldn't be anything |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
357 * after it either. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
358 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
359 ASSERT(dle != NULL || |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
360 avl_nearest(&dl->dl_tree, where, AVL_AFTER) == NULL); |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
361 |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
362 for (; dle && dle->dle_mintxg < maxtxg; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
363 dle = AVL_NEXT(&dl->dl_tree, dle)) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
364 uint64_t used, comp, uncomp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
365 |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
366 VERIFY3U(0, ==, bpobj_space(&dle->dle_bpobj, |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
367 &used, &comp, &uncomp)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
368 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
369 *usedp += used; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
370 *compp += comp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
371 *uncompp += uncomp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
372 } |
13524
f0e12b33f77c
1644 add ZFS "clones" property
Matthew Ahrens <matt@delphix.com>
parents:
13512
diff
changeset
|
373 mutex_exit(&dl->dl_lock); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
374 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
375 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
376 static void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
377 dsl_deadlist_insert_bpobj(dsl_deadlist_t *dl, uint64_t obj, uint64_t birth, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
378 dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
379 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
380 dsl_deadlist_entry_t dle_tofind; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
381 dsl_deadlist_entry_t *dle; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
382 avl_index_t where; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
383 uint64_t used, comp, uncomp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
384 bpobj_t bpo; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
385 |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
386 VERIFY3U(0, ==, bpobj_open(&bpo, dl->dl_os, obj)); |
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
387 VERIFY3U(0, ==, bpobj_space(&bpo, &used, &comp, &uncomp)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
388 bpobj_close(&bpo); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
389 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
390 dsl_deadlist_load_tree(dl); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
391 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
392 dmu_buf_will_dirty(dl->dl_dbuf, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
393 mutex_enter(&dl->dl_lock); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
394 dl->dl_phys->dl_used += used; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
395 dl->dl_phys->dl_comp += comp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
396 dl->dl_phys->dl_uncomp += uncomp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
397 mutex_exit(&dl->dl_lock); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
398 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
399 dle_tofind.dle_mintxg = birth; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
400 dle = avl_find(&dl->dl_tree, &dle_tofind, &where); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
401 if (dle == NULL) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
402 dle = avl_nearest(&dl->dl_tree, where, AVL_BEFORE); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
403 bpobj_enqueue_subobj(&dle->dle_bpobj, obj, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
404 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
405 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
406 static int |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
407 dsl_deadlist_insert_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
408 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
409 dsl_deadlist_t *dl = arg; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
410 dsl_deadlist_insert(dl, bp, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
411 return (0); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
412 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
413 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
414 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
415 * Merge the deadlist pointed to by 'obj' into dl. obj will be left as |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
416 * an empty deadlist. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
417 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
418 void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
419 dsl_deadlist_merge(dsl_deadlist_t *dl, uint64_t obj, dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
420 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
421 zap_cursor_t zc; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
422 zap_attribute_t za; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
423 dmu_buf_t *bonus; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
424 dsl_deadlist_phys_t *dlp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
425 dmu_object_info_t doi; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
426 |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
427 VERIFY3U(0, ==, dmu_object_info(dl->dl_os, obj, &doi)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
428 if (doi.doi_type == DMU_OT_BPOBJ) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
429 bpobj_t bpo; |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
430 VERIFY3U(0, ==, bpobj_open(&bpo, dl->dl_os, obj)); |
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
431 VERIFY3U(0, ==, bpobj_iterate(&bpo, |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
432 dsl_deadlist_insert_cb, dl, tx)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
433 bpobj_close(&bpo); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
434 return; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
435 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
436 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
437 for (zap_cursor_init(&zc, dl->dl_os, obj); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
438 zap_cursor_retrieve(&zc, &za) == 0; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
439 zap_cursor_advance(&zc)) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
440 uint64_t mintxg = strtonum(za.za_name, NULL); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
441 dsl_deadlist_insert_bpobj(dl, za.za_first_integer, mintxg, tx); |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
442 VERIFY3U(0, ==, zap_remove_int(dl->dl_os, obj, mintxg, tx)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
443 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
444 zap_cursor_fini(&zc); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
445 |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
446 VERIFY3U(0, ==, dmu_bonus_hold(dl->dl_os, obj, FTAG, &bonus)); |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
447 dlp = bonus->db_data; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
448 dmu_buf_will_dirty(bonus, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
449 bzero(dlp, sizeof (*dlp)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
450 dmu_buf_rele(bonus, FTAG); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
451 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
452 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
453 /* |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
454 * Remove entries on dl that are >= mintxg, and put them on the bpobj. |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
455 */ |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
456 void |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
457 dsl_deadlist_move_bpobj(dsl_deadlist_t *dl, bpobj_t *bpo, uint64_t mintxg, |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
458 dmu_tx_t *tx) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
459 { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
460 dsl_deadlist_entry_t dle_tofind; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
461 dsl_deadlist_entry_t *dle; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
462 avl_index_t where; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
463 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
464 ASSERT(!dl->dl_oldfmt); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
465 dmu_buf_will_dirty(dl->dl_dbuf, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
466 dsl_deadlist_load_tree(dl); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
467 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
468 dle_tofind.dle_mintxg = mintxg; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
469 dle = avl_find(&dl->dl_tree, &dle_tofind, &where); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
470 if (dle == NULL) |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
471 dle = avl_nearest(&dl->dl_tree, where, AVL_AFTER); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
472 while (dle) { |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
473 uint64_t used, comp, uncomp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
474 dsl_deadlist_entry_t *dle_next; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
475 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
476 bpobj_enqueue_subobj(bpo, dle->dle_bpobj.bpo_object, tx); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
477 |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
478 VERIFY3U(0, ==, bpobj_space(&dle->dle_bpobj, |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
479 &used, &comp, &uncomp)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
480 mutex_enter(&dl->dl_lock); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
481 ASSERT3U(dl->dl_phys->dl_used, >=, used); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
482 ASSERT3U(dl->dl_phys->dl_comp, >=, comp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
483 ASSERT3U(dl->dl_phys->dl_uncomp, >=, uncomp); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
484 dl->dl_phys->dl_used -= used; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
485 dl->dl_phys->dl_comp -= comp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
486 dl->dl_phys->dl_uncomp -= uncomp; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
487 mutex_exit(&dl->dl_lock); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
488 |
13765
9410cf539b11
backout 3006: causes 3046 (panics after mounting root)
Richard Lowe <richlowe@richlowe.net>
parents:
13764
diff
changeset
|
489 VERIFY3U(0, ==, zap_remove_int(dl->dl_os, dl->dl_object, |
12470
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
490 dle->dle_mintxg, tx)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
491 |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
492 dle_next = AVL_NEXT(&dl->dl_tree, dle); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
493 avl_remove(&dl->dl_tree, dle); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
494 bpobj_close(&dle->dle_bpobj); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
495 kmem_free(dle, sizeof (*dle)); |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
496 dle = dle_next; |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
497 } |
54258108784b
6948890 snapshot deletion can induce pathologically long spa_sync() times
Matthew Ahrens <Matthew.Ahrens@Sun.COM>
parents:
diff
changeset
|
498 } |