FreeBSD/sys/geom/vinum/geom_vinum_subr.c
/* Detach a subdisk from a plex. */
Detach a subdisk from a plex.
Detach a subdisk from a plex .
int
gv_detach_sd(struct gv_sd *s, int flags)
{
	struct gv_plex *p;
	g_topology_assert();
	p = s->plex_sc;
	if (p == NULL) {
		G_VINUM_DEBUG(1, "unable to detach %s: already detached",
		    s->name);
		return (0); 
	}
	if (!(flags & GV_FLAG_F) && ((p->state > GV_PLEX_DEGRADED) ||
	    ((p->state == GV_PLEX_DEGRADED) && (s->state == GV_SD_UP)))) {
	    	G_VINUM_DEBUG(1, "unable to detach %s: plex %s is busy",
		    s->name, s->plex);
		return (GV_ERR_ISBUSY);
	}
	LIST_REMOVE(s, in_plex);
	s->plex_sc = NULL;
	memset(s->plex, 0, GV_MAXPLEXNAME);
	p->sddetached++;
	gv_save_config(s->vinumconf);
	return (0);
}
int gv_detach_sd ( struct gv_sd * s , int flags ) { struct gv_plex * p ; g_topology_assert ( ) ; p = s -> plex_sc ; if ( p == NULL ) { G_VINUM_DEBUG ( 1 , " " , s -> name ) ; return ( 0 ) ; } if ( ! ( flags & GV_FLAG_F ) && ( ( p -> state > GV_PLEX_DEGRADED ) || ( ( p -> state == GV_PLEX_DEGRADED ) && ( s -> state == GV_SD_UP ) ) ) ) { G_VINUM_DEBUG ( 1 , " " , s -> name , s -> plex ) ; return ( GV_ERR_ISBUSY ) ; } LIST_REMOVE ( s , in_plex ) ; s -> plex_sc = NULL ; memset ( s -> plex , 0 , GV_MAXPLEXNAME ) ; p -> sddetached ++ ; gv_save_config ( s -> vinumconf ) ; return ( 0 ) ; }
Detach a subdisk from a plex.
Detach a subdisk from a plex .
/* Not an error. */ /*
	 * Don't proceed if we're not forcing, and the plex is up, or degraded
	 * with this subdisk up.
	 */