forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a diagnostic kstat for obtaining pool status
This kstat output does not require taking the spa_namespace lock, as in the case for 'zpool status'. It can be used for investigations when pools are in a hung state while holding global locks required for a traditional 'zpool status' to proceed. This kstat is not safe to use in conditions where pools are in the process of configuration changes (i.e., adding/removing devices). Therefore, this kstat is not intended to be a general replacement or alternative to using 'zpool status'. Sponsored-by: Wasabi Technology, Inc. Sponsored-By: Klara Inc. Co-authored-by: Don Brady <[email protected]> Signed-off-by: Don Brady <[email protected]>
- Loading branch information
1 parent
e0bf43d
commit 2ad5b24
Showing
20 changed files
with
1,329 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* CDDL HEADER START | ||
* | ||
* The contents of this file are subject to the terms of the | ||
* Common Development and Distribution License (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* | ||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
* or http://opensource.org/licenses/CDDL-1.0. | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
* | ||
* When distributing Covered Code, include this CDDL HEADER in each | ||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
* If applicable, add the following below this CDDL HEADER, with the | ||
* fields enclosed by brackets "[]" replaced with your own identifying | ||
* information: Portions Copyright [yyyy] [name of copyright owner] | ||
* | ||
* CDDL HEADER END | ||
*/ | ||
|
||
/* | ||
* Copyright (c) 2024, Klara Inc. | ||
*/ | ||
|
||
#ifndef _SYS_JPRINT_H | ||
#define _SYS_JPRINT_H | ||
|
||
/* maximum stack nesting */ | ||
#define JP_MAX_STACK 32 | ||
|
||
enum jp_type { | ||
JP_OBJECT = 1, | ||
JP_ARRAY | ||
}; | ||
|
||
struct jp_stack { | ||
enum jp_type type; | ||
int nelem; | ||
}; | ||
|
||
typedef struct jprint { | ||
char *buffer; /* pointer to application's buffer */ | ||
size_t buflen; /* length of buffer */ | ||
char *bufp; /* current write position in buffer */ | ||
char tmpbuf[32]; /* local buffer for conversions */ | ||
int error; /* error code */ | ||
int ncall; /* API call number on which error occurred */ | ||
struct jp_stack /* stack of array/object nodes */ | ||
stack[JP_MAX_STACK]; | ||
int stackp; | ||
} jprint_t; | ||
|
||
/* error return codes */ | ||
#define JPRINT_OK 0 /* no error */ | ||
#define JPRINT_BUF_FULL 1 /* output buffer full */ | ||
#define JPRINT_NEST_ERROR 2 /* nesting error */ | ||
#define JPRINT_STACK_FULL 3 /* array/object nesting */ | ||
#define JPRINT_STACK_EMPTY 4 /* stack underflow error */ | ||
#define JPRINT_OPEN 5 /* not all objects closed */ | ||
#define JPRINT_FMT 6 /* format error */ | ||
|
||
const char *jp_errorstring(int err); | ||
int jp_error(jprint_t *jp); | ||
void jp_open(jprint_t *jp, char *buffer, size_t buflen); | ||
int jp_close(jprint_t *jp); | ||
int jp_errorpos(jprint_t *jp); | ||
int jp_printf(jprint_t *jp, const char *fmt, ...); | ||
|
||
#endif /* _SYS_JPRINT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* CDDL HEADER START | ||
* | ||
* The contents of this file are subject to the terms of the | ||
* Common Development and Distribution License (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* | ||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
* or http://opensource.org/licenses/CDDL-1.0. | ||
* See the License for the specific language governing permissions | ||
* and limitations under the License. | ||
* | ||
* When distributing Covered Code, include this CDDL HEADER in each | ||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
* If applicable, add the following below this CDDL HEADER, with the | ||
* fields enclosed by brackets "[]" replaced with your own identifying | ||
* information: Portions Copyright [yyyy] [name of copyright owner] | ||
* | ||
* CDDL HEADER END | ||
*/ | ||
|
||
/* | ||
* Copyright (c) 2024, Klara Inc. | ||
*/ | ||
|
||
#ifndef _SYS_SPA_JSON_STATS_H | ||
#define _SYS_SPA_JSON_STATS_H | ||
|
||
#include <sys/zfs_context.h> | ||
#include <sys/spa_impl.h> | ||
#include <sys/kstat.h> | ||
|
||
typedef struct spa_json_stats { | ||
kmutex_t lock; | ||
kstat_t *kstat; | ||
} spa_json_stats_t; | ||
|
||
extern int spa_generate_json_stats(spa_t *spa, char *buf, size_t size); | ||
|
||
#endif /* _SYS_SPA_JSON_STATS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.