metastat.c revision bf85a12b7c81d0745d5a8aff65baeff50006cde9
/*
* 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
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "mdinclude.h"
typedef struct submirror_cb {
int un_nsm;
void
print_setname(int setno)
{
char setname[1024];
if (setno != 0) {
mdb_warn("failed to read setname at 0x%p\n",
}
}
}
void
{
int setno;
/* read in the device */
return;
}
mdb_printf("Concat/Stripe");
} else {
}
if (verbose) {
} else {
}
mdb_inc_indent(2);
mdb_dec_indent(2);
}
/* ARGSUSED */
int
{
return (WALK_ERR);
}
return (WALK_ERR);
}
/* this is one of the sub mirrors */
mdb_printf("Submirror %u: d%u ",
return (WALK_DONE);
}
}
return (WALK_NEXT);
}
/*
* Construct an RLE count for the number of 'cleared' bits in the given 'bm'
* Output the RLE count in form: [<set>.<cleared>.<set>.<cleared>...]
* RLE is Run Length Encoding, a method for compactly describing a bitmap
* as a series of numbers indicating the count of consecutive set or cleared
* bits.
*
* Input:
* <bm> bitmap to scan
* <size> length of bitmap (in bits)
* <comp_bm> RLE count array to be updated
* <opstr> Descriptive text for bitmap RLE count display
*/
static void
{
cnt_clean = 1;
printit = 0;
cur_clean = 0;
cur_dirty = 0;
cur_idx = 0;
tot_dirty = 0;
max_set_cnt = max_reset_cnt = 0;
for (i = 0; i < size; i++) {
/* If we're counting clean bits, flush the count out */
if (cnt_clean) {
cnt_clean = 0;
printit = 1;
if (cur_clean > max_reset_cnt) {
}
}
cur_clean = 0;
cur_dirty++;
tot_dirty++;
} else {
if (!cnt_clean) {
cnt_clean = 1;
printit = 1;
if (cur_dirty > max_set_cnt) {
}
}
cur_dirty = 0;
cur_clean++;
}
if (printit) {
printit = 0;
}
}
}
void
{
void **ptr;
int setno = 0;
unsigned char *rr_dirty_bm, *rr_goingclean_bm;
/* read in the device */
return;
}
if (verbose) {
} else {
}
mdb_inc_indent(2);
/*
* Dump out the current un_dirty_bm together with its size
* Also, attempt to Run Length encode the bitmap to see if this
* is a viable option
*/
return;
}
return;
}
/*
* find the sub mirrors, search through each metadevice looking
* at the un_parent.
*/
mdb_warn("unable to walk units\n");
return;
}
mdb_dec_indent(2);
}
void
{
void **ptr;
void *addr;
int setno = 0;
int i;
/* read in the device */
return;
}
if (verbose) {
} else {
}
mdb_inc_indent(2);
/*
* find the sub components if any, search through each metadevice
* looking at the un_parent.
*/
continue;
}
mdb_warn("failed to read mdc_unit_t at %p",
un_addr);
continue;
}
if (sc_parent == un_self_id) {
/* this is one of the sub components */
mdb_printf("Subdevice %u ",
}
}
}
mdb_dec_indent(2);
}
void
{
int setno = 0;
int i;
/* read in the device */
return;
}
if (verbose) {
} else {
}
mdb_inc_indent(2);
mdb_inc_indent(2);
mdb_printf("Extent\tStart Block\tBlock count\n");
for (i = 0; i < mp.un_numexts; i++) {
return;
}
mdb_printf(" %d \t %llu\t %llu\n",
}
mdb_dec_indent(2);
mdb_dec_indent(2);
}
void
{
int setno = 0;
/* read in the device */
return;
}
if (verbose) {
} else {
}
}
void
{
switch (un_type) {
break;
case MD_METAMIRROR:
break;
case MD_METATRANS:
break;
case MD_METARAID:
break;
case MD_METASP:
break;
case MD_UNDEFINED:
break;
default:
break;
}
}
/* ARGSUSED */
/*
* usage: ::metastat [-v]
*/
int
{
snarf_sets();
!= argc) {
return (DCMD_USAGE);
}
if (!(flags & DCMD_ADDRSPEC)) {
argv) == -1) {
mdb_warn("failed to walk units");
return (DCMD_ERR);
}
return (DCMD_OK);
}
/* user passed set addr */
mdb_warn("failed to walk units");
return (DCMD_ERR);
}
return (DCMD_OK);
}
return (DCMD_ERR);
}
return (DCMD_ERR);
}
mdb_dec_indent(2);
}
return (DCMD_OK);
}