g_raid.c (234816) | g_raid.c (234940) |
---|---|
1/*- 2 * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2010 Alexander Motin <mav@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/geom/raid/g_raid.c 234816 2012-04-29 19:40:50Z mav $"); | 28__FBSDID("$FreeBSD: head/sys/geom/raid/g_raid.c 234940 2012-05-03 05:32:56Z mav $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34#include <sys/limits.h> 35#include <sys/lock.h> 36#include <sys/mutex.h> --- 2101 unchanged lines hidden (view full) --- 2138 struct g_raid_md_class *class; 2139 struct g_raid_md_object *obj; 2140 int status; 2141 2142 g_topology_assert(); 2143 g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); 2144 G_RAID_DEBUG(2, "Tasting provider %s.", pp->name); 2145 | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34#include <sys/limits.h> 35#include <sys/lock.h> 36#include <sys/mutex.h> --- 2101 unchanged lines hidden (view full) --- 2138 struct g_raid_md_class *class; 2139 struct g_raid_md_object *obj; 2140 int status; 2141 2142 g_topology_assert(); 2143 g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, pp->name); 2144 G_RAID_DEBUG(2, "Tasting provider %s.", pp->name); 2145 |
2146 gp = g_new_geomf(mp, "mirror:taste"); | 2146 gp = g_new_geomf(mp, "raid:taste"); |
2147 /* 2148 * This orphan function should be never called. 2149 */ 2150 gp->orphan = g_raid_taste_orphan; 2151 cp = g_new_consumer(gp); 2152 g_attach(cp, pp); 2153 2154 geom = NULL; --- 13 unchanged lines hidden (view full) --- 2168 g_detach(cp); 2169 g_destroy_consumer(cp); 2170 g_destroy_geom(gp); 2171 G_RAID_DEBUG(2, "Tasting provider %s done.", pp->name); 2172 return (geom); 2173} 2174 2175int | 2147 /* 2148 * This orphan function should be never called. 2149 */ 2150 gp->orphan = g_raid_taste_orphan; 2151 cp = g_new_consumer(gp); 2152 g_attach(cp, pp); 2153 2154 geom = NULL; --- 13 unchanged lines hidden (view full) --- 2168 g_detach(cp); 2169 g_destroy_consumer(cp); 2170 g_destroy_geom(gp); 2171 G_RAID_DEBUG(2, "Tasting provider %s done.", pp->name); 2172 return (geom); 2173} 2174 2175int |
2176g_raid_create_node_format(const char *format, struct g_geom **gp) | 2176g_raid_create_node_format(const char *format, struct gctl_req *req, 2177 struct g_geom **gp) |
2177{ 2178 struct g_raid_md_class *class; 2179 struct g_raid_md_object *obj; 2180 int status; 2181 2182 G_RAID_DEBUG(2, "Creating array for %s metadata.", format); 2183 LIST_FOREACH(class, &g_raid_md_classes, mdc_list) { 2184 if (strcasecmp(class->name, format) == 0) 2185 break; 2186 } 2187 if (class == NULL) { 2188 G_RAID_DEBUG(1, "No support for %s metadata.", format); 2189 return (G_RAID_MD_TASTE_FAIL); 2190 } 2191 obj = (void *)kobj_create((kobj_class_t)class, M_RAID, 2192 M_WAITOK); 2193 obj->mdo_class = class; | 2178{ 2179 struct g_raid_md_class *class; 2180 struct g_raid_md_object *obj; 2181 int status; 2182 2183 G_RAID_DEBUG(2, "Creating array for %s metadata.", format); 2184 LIST_FOREACH(class, &g_raid_md_classes, mdc_list) { 2185 if (strcasecmp(class->name, format) == 0) 2186 break; 2187 } 2188 if (class == NULL) { 2189 G_RAID_DEBUG(1, "No support for %s metadata.", format); 2190 return (G_RAID_MD_TASTE_FAIL); 2191 } 2192 obj = (void *)kobj_create((kobj_class_t)class, M_RAID, 2193 M_WAITOK); 2194 obj->mdo_class = class; |
2194 status = G_RAID_MD_CREATE(obj, &g_raid_class, gp); | 2195 status = G_RAID_MD_CREATE_REQ(obj, &g_raid_class, req, gp); |
2195 if (status != G_RAID_MD_TASTE_NEW) 2196 kobj_delete((kobj_t)obj, M_RAID); 2197 return (status); 2198} 2199 2200static int 2201g_raid_destroy_geom(struct gctl_req *req __unused, 2202 struct g_class *mp __unused, struct g_geom *gp) --- 285 unchanged lines hidden --- | 2196 if (status != G_RAID_MD_TASTE_NEW) 2197 kobj_delete((kobj_t)obj, M_RAID); 2198 return (status); 2199} 2200 2201static int 2202g_raid_destroy_geom(struct gctl_req *req __unused, 2203 struct g_class *mp __unused, struct g_geom *gp) --- 285 unchanged lines hidden --- |