Exemplo n.º 1
0
void
probe_raid_devs(boolean_e verbose)
{
	mdnamelist_t	*nlp, *toplp;
	int		cnt;
	md_error_t	e = mdnullerror;

	nlp = toplp = NULL;

	if (meta_get_raid_names(sp, &nlp, 0, &e) > 0) {
		/*
		 * We have some mirrors to probe
		 * get a list of top-level mirrors
		 */

		cnt = get_toplevel_mds(&nlp, &toplp, verbose);

		if (cnt && (md_probe_ioctl(toplp, cnt,
						MD_RAID, verbose) < 0))
			monitord_print(0, gettext(
			    "probe_raid_devs: "
			    "RAID-5 components %d ioctl error\n"),
			    cnt);

	}

	metafreenamelist(nlp);
	metafreenamelist(toplp);
}
Exemplo n.º 2
0
/*
 * NAME:	meta_raid_resync_all
 * DESCRIPTION: loop through the RAID devices synch'ing all
 * PARAMETERS:	char		*sp	- the set to synch
 *		daddr_t		size	- resync size
 *		md_error_t	*ep	- return error info
 *
 */
int
meta_raid_resync_all(
	mdsetname_t	*sp,
	daddr_t		size,
	md_error_t	*ep
)
{
	mdnamelist_t	*nlp = NULL;
	mdnamelist_t	*p;
	int		rval = 0, fval;

	/* should have a set */
	assert(sp != NULL);

	/* get raids */
	if (meta_get_raid_names(sp, &nlp, 0, ep) < 0)
		return (-1);

	/* fork a process */
	if ((fval = md_daemonize(sp, ep)) != 0) {
		/*
		 * md_daemonize forks off a process to do the work.  This
		 * is the parent or errror.
		 */
		if (fval > 0) {
			if (nlp != NULL)
				metafreenamelist(nlp);
			return (0);
		}
		mdclrerror(ep);
	}

	assert((fval == 0) || (fval == -1));

	/* resync each raid */
	for (p = nlp; (p != NULL); p = p->next) {
		mdname_t	*raidnp = p->namep;

		if (meta_raid_resync(sp, raidnp, size, ep) != 0)
			rval = -1;
	}

	/* cleanup, return success */
	if (nlp != NULL)
		metafreenamelist(nlp);
	if (fval == 0)
		exit(0);
	return (rval);
}