/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2012, 2015 by Delphix. All rights reserved.
*/
#include <sys/zfs_context.h>
#include <sys/vdev_impl.h>
/*
* Virtual device vector for mirroring.
*/
typedef struct mirror_child {
int mc_error;
typedef struct mirror_map {
int mm_children;
int mm_replacing;
int mm_preferred;
int mm_root;
} mirror_map_t;
static void
{
}
};
static mirror_map_t *
{
int c, d;
mm->mm_children = c;
/*
* Check the other, lower-index DVAs to see if they're on
* the same vdev as the child we picked. If they are, use
* them since they are likely to have been allocated from
* the primary metaslab in use at the time, and hence are
* more likely to have locality with single-copy data.
*/
mm->mm_preferred = d;
}
for (c = 0; c < mm->mm_children; c++) {
}
} else {
c = vd->vdev_children;
mm->mm_children = c;
for (c = 0; c < mm->mm_children; c++) {
}
}
return (mm);
}
static int
{
int numerrors = 0;
int lasterror = 0;
if (vd->vdev_children == 0) {
}
for (int c = 0; c < vd->vdev_children; c++) {
if (cvd->vdev_open_error) {
numerrors++;
continue;
}
}
return (lasterror);
}
return (0);
}
static void
{
for (int c = 0; c < vd->vdev_children; c++)
}
static void
{
mc->mc_skipped = 0;
}
static void
{
}
}
mc->mc_skipped = 0;
}
/*
* Try to find a child whose DTL doesn't contain the block we want to read.
* If we can't, try the read on any vdev we haven't already tried.
*/
static int
{
int i, c;
/*
* Try to find a child whose DTL doesn't contain the block to read.
* If a child is known to be completely inaccessible (indicated by
* vdev_readable() returning B_FALSE), don't even try.
*/
if (c >= mm->mm_children)
c = 0;
continue;
continue;
}
return (c);
}
/*
* Every device is either missing or has this txg in its DTL.
* Look for any child we haven't already tried before giving up.
*/
for (c = 0; c < mm->mm_children; c++)
return (c);
/*
* Every child failed. There's no place left to look.
*/
return (-1);
}
static void
{
int c, children;
/*
* For scrubbing reads we need to allocate a read
* buffer for each child and issue reads to all
* children. If any child succeeds, it will copy its
* data into zio->io_data in vdev_mirror_scrub_done.
*/
for (c = 0; c < mm->mm_children; c++) {
}
return;
}
/*
* For normal reads just pick one child.
*/
c = vdev_mirror_child_select(zio);
children = (c >= 0);
} else {
/*
* Writes go to all children.
*/
c = 0;
}
while (children--) {
c++;
}
}
static int
{
for (int c = 0; c < mm->mm_children; c++) {
int s = mc->mc_speculative;
}
}
static void
{
int c;
int good_copies = 0;
int unexpected_errors = 0;
for (c = 0; c < mm->mm_children; c++) {
if (!mc->mc_skipped)
good_copies++;
}
}
/*
* XXX -- for now, treat partial writes as success.
*
* Now that we support write reallocation, it would be better
* to treat partial failure as real failure unless there are
* no non-degraded top-level vdevs left, and not update DTLs
* if we intend to reallocate.
*/
/* XXPOLICY */
/*
* Always require at least one good copy.
*
* For ditto blocks (io_vd == NULL), require
* all copies to be good.
*
* XXX -- for replacing vdevs, there's no great answer.
* If the old device is really dead, we may not even
* be able to access it -- so we only want to
* require good writes to the new device. But if
* the new device turns out to be flaky, we want
* to be able to detach it -- which requires all
* writes to the old device to have succeeded.
*/
}
return;
}
/*
* If we don't have a good copy yet, keep trying other children.
*/
/* XXPOLICY */
return;
}
/* XXPOLICY */
if (good_copies == 0) {
}
/*
* Use the good data we have in hand to repair damaged children.
*/
for (c = 0; c < mm->mm_children; c++) {
/*
* Don't rewrite known good children.
* Not only is it unnecessary, it could
* actually be harmful: if the system lost
* power while rewriting the only good copy,
* there would be no good copies left!
*/
continue;
continue;
}
}
}
}
static void
{
else
}
NULL,
NULL,
VDEV_TYPE_MIRROR, /* name of this vdev type */
B_FALSE /* not a leaf vdev */
};
NULL,
NULL,
VDEV_TYPE_REPLACING, /* name of this vdev type */
B_FALSE /* not a leaf vdev */
};
NULL,
NULL,
VDEV_TYPE_SPARE, /* name of this vdev type */
B_FALSE /* not a leaf vdev */
};