author | Lin Ling <Lin.Ling@Sun.COM> |
Mon, 03 May 2010 14:54:08 -0700 | |
changeset 12296 | 7cf402a7f374 |
parent 11935 | 538c866aaac6 |
child 13743 | 95aba6e49b9f |
permissions | -rw-r--r-- |
5913
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
1 |
/* |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
2 |
* CDDL HEADER START |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
3 |
* |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
4 |
* The contents of this file are subject to the terms of the |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
5 |
* Common Development and Distribution License (the "License"). |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
6 |
* You may not use this file except in compliance with the License. |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
7 |
* |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
9 |
* or http://www.opensolaris.org/os/licensing. |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
10 |
* See the License for the specific language governing permissions |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
11 |
* and limitations under the License. |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
12 |
* |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
18 |
* |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
19 |
* CDDL HEADER END |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
20 |
*/ |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
21 |
/* |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
22 |
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. |
5913
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
23 |
*/ |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
24 |
|
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
25 |
/* |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
26 |
* This file is intended for functions that ought to be common between user |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
27 |
* land (libzfs) and the kernel. When many common routines need to be shared |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
28 |
* then a separate file should to be created. |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
29 |
*/ |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
30 |
|
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
31 |
#if defined(_KERNEL) |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
32 |
#include <sys/systm.h> |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
33 |
#else |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
34 |
#include <string.h> |
5913
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
35 |
#endif |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
36 |
|
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
37 |
#include <sys/types.h> |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
38 |
#include <sys/fs/zfs.h> |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
39 |
#include <sys/int_limits.h> |
5913
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
40 |
#include <sys/nvpair.h> |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
41 |
#include "zfs_comutil.h" |
5913
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
42 |
|
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
43 |
/* |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
44 |
* Are there allocatable vdevs? |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
45 |
*/ |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
46 |
boolean_t |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
47 |
zfs_allocatable_devs(nvlist_t *nv) |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
48 |
{ |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
49 |
uint64_t is_log; |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
50 |
uint_t c; |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
51 |
nvlist_t **child; |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
52 |
uint_t children; |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
53 |
|
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
54 |
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
55 |
&child, &children) != 0) { |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
56 |
return (B_FALSE); |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
57 |
} |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
58 |
for (c = 0; c < children; c++) { |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
59 |
is_log = 0; |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
60 |
(void) nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
61 |
&is_log); |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
62 |
if (!is_log) |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
63 |
return (B_TRUE); |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
64 |
} |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
65 |
return (B_FALSE); |
a77f8ad2ce63
6575965 panic/thread=2a1016b5ca0: BAD TRAP: type=9 rp=1858500 addr=0 mmu_fsr=0, really, truly out of space
perrin
parents:
diff
changeset
|
66 |
} |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
67 |
|
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
68 |
void |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
69 |
zpool_get_rewind_policy(nvlist_t *nvl, zpool_rewind_policy_t *zrpp) |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
70 |
{ |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
71 |
nvlist_t *policy; |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
72 |
nvpair_t *elem; |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
73 |
char *nm; |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
74 |
|
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
75 |
/* Defaults */ |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
76 |
zrpp->zrp_request = ZPOOL_NO_REWIND; |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
77 |
zrpp->zrp_maxmeta = 0; |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10921
diff
changeset
|
78 |
zrpp->zrp_maxdata = UINT64_MAX; |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
79 |
zrpp->zrp_txg = UINT64_MAX; |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
80 |
|
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
81 |
if (nvl == NULL) |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
82 |
return; |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
83 |
|
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
84 |
elem = NULL; |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
85 |
while ((elem = nvlist_next_nvpair(nvl, elem)) != NULL) { |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
86 |
nm = nvpair_name(elem); |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
87 |
if (strcmp(nm, ZPOOL_REWIND_POLICY) == 0) { |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
88 |
if (nvpair_value_nvlist(elem, &policy) == 0) |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
89 |
zpool_get_rewind_policy(policy, zrpp); |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
90 |
return; |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
91 |
} else if (strcmp(nm, ZPOOL_REWIND_REQUEST) == 0) { |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10921
diff
changeset
|
92 |
if (nvpair_value_uint32(elem, &zrpp->zrp_request) == 0) |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10921
diff
changeset
|
93 |
if (zrpp->zrp_request & ~ZPOOL_REWIND_POLICIES) |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
94 |
zrpp->zrp_request = ZPOOL_NO_REWIND; |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
95 |
} else if (strcmp(nm, ZPOOL_REWIND_REQUEST_TXG) == 0) { |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
96 |
(void) nvpair_value_uint64(elem, &zrpp->zrp_txg); |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
97 |
} else if (strcmp(nm, ZPOOL_REWIND_META_THRESH) == 0) { |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10921
diff
changeset
|
98 |
(void) nvpair_value_uint64(elem, &zrpp->zrp_maxmeta); |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
99 |
} else if (strcmp(nm, ZPOOL_REWIND_DATA_THRESH) == 0) { |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10921
diff
changeset
|
100 |
(void) nvpair_value_uint64(elem, &zrpp->zrp_maxdata); |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
101 |
} |
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
102 |
} |
11727
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10921
diff
changeset
|
103 |
if (zrpp->zrp_request == 0) |
497d03ab2824
6900971 zdb rewind behavior needs to be revisited
Victor Latushkin <Victor.Latushkin@Sun.COM>
parents:
10921
diff
changeset
|
104 |
zrpp->zrp_request = ZPOOL_NO_REWIND; |
10921
8aac17999e4d
PSARC 2009/479 zpool recovery support
Tim Haley <Tim.Haley@Sun.COM>
parents:
5913
diff
changeset
|
105 |
} |
11935
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
106 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
107 |
typedef struct zfs_version_spa_map { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
108 |
int version_zpl; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
109 |
int version_spa; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
110 |
} zfs_version_spa_map_t; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
111 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
112 |
/* |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
113 |
* Keep this table in monotonically increasing version number order. |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
114 |
*/ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
115 |
static zfs_version_spa_map_t zfs_version_table[] = { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
116 |
{ZPL_VERSION_INITIAL, SPA_VERSION_INITIAL}, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
117 |
{ZPL_VERSION_DIRENT_TYPE, SPA_VERSION_INITIAL}, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
118 |
{ZPL_VERSION_FUID, SPA_VERSION_FUID}, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
119 |
{ZPL_VERSION_USERSPACE, SPA_VERSION_USERSPACE}, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
120 |
{ZPL_VERSION_SA, SPA_VERSION_SA}, |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
121 |
{0, 0} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
122 |
}; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
123 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
124 |
/* |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
125 |
* Return the max zpl version for a corresponding spa version |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
126 |
* -1 is returned if no mapping exists. |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
127 |
*/ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
128 |
int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
129 |
zfs_zpl_version_map(int spa_version) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
130 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
131 |
int i; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
132 |
int version = -1; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
133 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
134 |
for (i = 0; zfs_version_table[i].version_spa; i++) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
135 |
if (spa_version >= zfs_version_table[i].version_spa) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
136 |
version = zfs_version_table[i].version_zpl; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
137 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
138 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
139 |
return (version); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
140 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
141 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
142 |
/* |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
143 |
* Return the min spa version for a corresponding spa version |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
144 |
* -1 is returned if no mapping exists. |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
145 |
*/ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
146 |
int |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
147 |
zfs_spa_version_map(int zpl_version) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
148 |
{ |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
149 |
int i; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
150 |
int version = -1; |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
151 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
152 |
for (i = 0; zfs_version_table[i].version_zpl; i++) { |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
153 |
if (zfs_version_table[i].version_zpl >= zpl_version) |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
154 |
return (zfs_version_table[i].version_spa); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
155 |
} |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
156 |
|
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
157 |
return (version); |
538c866aaac6
6716117 ZFS needs native system attribute infrastructure
Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
parents:
11727
diff
changeset
|
158 |
} |
12296
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
159 |
|
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
160 |
const char *zfs_history_event_names[LOG_END] = { |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
161 |
"invalid event", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
162 |
"pool create", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
163 |
"vdev add", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
164 |
"pool remove", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
165 |
"pool destroy", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
166 |
"pool export", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
167 |
"pool import", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
168 |
"vdev attach", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
169 |
"vdev replace", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
170 |
"vdev detach", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
171 |
"vdev online", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
172 |
"vdev offline", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
173 |
"vdev upgrade", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
174 |
"pool clear", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
175 |
"pool scrub", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
176 |
"pool property set", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
177 |
"create", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
178 |
"clone", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
179 |
"destroy", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
180 |
"destroy_begin_sync", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
181 |
"inherit", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
182 |
"property set", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
183 |
"quota set", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
184 |
"permission update", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
185 |
"permission remove", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
186 |
"permission who remove", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
187 |
"promote", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
188 |
"receive", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
189 |
"rename", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
190 |
"reservation set", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
191 |
"replay_inc_sync", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
192 |
"replay_full_sync", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
193 |
"rollback", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
194 |
"snapshot", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
195 |
"filesystem version upgrade", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
196 |
"refquota set", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
197 |
"refreservation set", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
198 |
"pool scrub done", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
199 |
"user hold", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
200 |
"user release", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
201 |
"pool split", |
7cf402a7f374
6675946 'zpool status' should show the progress of resilvering for individual disk.
Lin Ling <Lin.Ling@Sun.COM>
parents:
11935
diff
changeset
|
202 |
}; |