geom_subr.c (936cc4614b5187681f3a1c76a7740ead4845a548) | geom_subr.c (801bb689ca8be76700b0c16c159683b5fa89472d) |
---|---|
1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 131 unchanged lines hidden (view full) --- 140 g_topology_assert(); 141 KASSERT(gp->orphan != NULL, 142 ("g_new_consumer on geom(%s) (class %s) without orphan", 143 gp->name, gp->class->name)); 144 145 cp = g_malloc(sizeof *cp, M_ZERO); 146 cp->protect = 0x020016602; 147 cp->geom = gp; | 1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 131 unchanged lines hidden (view full) --- 140 g_topology_assert(); 141 KASSERT(gp->orphan != NULL, 142 ("g_new_consumer on geom(%s) (class %s) without orphan", 143 gp->name, gp->class->name)); 144 145 cp = g_malloc(sizeof *cp, M_ZERO); 146 cp->protect = 0x020016602; 147 cp->geom = gp; |
148 cp->stat.id = cp; |
|
148 LIST_INSERT_HEAD(&gp->consumer, cp, consumer); 149 return(cp); 150} 151 152void 153g_destroy_consumer(struct g_consumer *cp) 154{ 155 --- 23 unchanged lines hidden (view full) --- 179 pp = g_malloc(sizeof *pp + sbuf_len(sb) + 1, M_ZERO); 180 pp->protect = 0x020016603; 181 pp->name = (char *)(pp + 1); 182 strcpy(pp->name, sbuf_data(sb)); 183 sbuf_delete(sb); 184 LIST_INIT(&pp->consumers); 185 pp->error = ENXIO; 186 pp->geom = gp; | 149 LIST_INSERT_HEAD(&gp->consumer, cp, consumer); 150 return(cp); 151} 152 153void 154g_destroy_consumer(struct g_consumer *cp) 155{ 156 --- 23 unchanged lines hidden (view full) --- 180 pp = g_malloc(sizeof *pp + sbuf_len(sb) + 1, M_ZERO); 181 pp->protect = 0x020016603; 182 pp->name = (char *)(pp + 1); 183 strcpy(pp->name, sbuf_data(sb)); 184 sbuf_delete(sb); 185 LIST_INIT(&pp->consumers); 186 pp->error = ENXIO; 187 pp->geom = gp; |
188 pp->stat.id = pp; |
|
187 LIST_INSERT_HEAD(&gp->provider, pp, provider); 188 g_nproviders++; 189 g_post_event(EV_NEW_PROVIDER, NULL, NULL, pp, NULL); 190 return (pp); 191} 192 193void 194g_error_provider(struct g_provider *pp, int error) --- 127 unchanged lines hidden (view full) --- 322 323 g_trace(G_T_TOPOLOGY, "g_detach(%p)", cp); 324 KASSERT(cp != (void*)0xd0d0d0d0, ("ARGH!")); 325 g_topology_assert(); 326 KASSERT(cp->provider != NULL, ("detach but not attached")); 327 KASSERT(cp->acr == 0, ("detach but nonzero acr")); 328 KASSERT(cp->acw == 0, ("detach but nonzero acw")); 329 KASSERT(cp->ace == 0, ("detach but nonzero ace")); | 189 LIST_INSERT_HEAD(&gp->provider, pp, provider); 190 g_nproviders++; 191 g_post_event(EV_NEW_PROVIDER, NULL, NULL, pp, NULL); 192 return (pp); 193} 194 195void 196g_error_provider(struct g_provider *pp, int error) --- 127 unchanged lines hidden (view full) --- 324 325 g_trace(G_T_TOPOLOGY, "g_detach(%p)", cp); 326 KASSERT(cp != (void*)0xd0d0d0d0, ("ARGH!")); 327 g_topology_assert(); 328 KASSERT(cp->provider != NULL, ("detach but not attached")); 329 KASSERT(cp->acr == 0, ("detach but nonzero acr")); 330 KASSERT(cp->acw == 0, ("detach but nonzero acw")); 331 KASSERT(cp->ace == 0, ("detach but nonzero ace")); |
330 KASSERT(cp->biocount == 0, ("detach but nonzero biocount")); | 332 KASSERT(cp->stat.nop == cp->stat.nend, ("detach with active requests")); |
331 pp = cp->provider; 332 LIST_REMOVE(cp, consumers); 333 cp->provider = NULL; 334 if (LIST_EMPTY(&pp->consumers)) { 335 if (pp->geom->flags & G_GEOM_WITHER) 336 g_destroy_provider(pp); 337 } 338 redo_rank(cp->geom); --- 155 unchanged lines hidden (view full) --- 494{ 495 struct bio *bp2; 496 497 bp2 = bp->bio_parent; 498 if (bp2->bio_error == 0) 499 bp2->bio_error = bp->bio_error; 500 bp2->bio_completed += bp->bio_completed; 501 g_destroy_bio(bp); | 333 pp = cp->provider; 334 LIST_REMOVE(cp, consumers); 335 cp->provider = NULL; 336 if (LIST_EMPTY(&pp->consumers)) { 337 if (pp->geom->flags & G_GEOM_WITHER) 338 g_destroy_provider(pp); 339 } 340 redo_rank(cp->geom); --- 155 unchanged lines hidden (view full) --- 496{ 497 struct bio *bp2; 498 499 bp2 = bp->bio_parent; 500 if (bp2->bio_error == 0) 501 bp2->bio_error = bp->bio_error; 502 bp2->bio_completed += bp->bio_completed; 503 g_destroy_bio(bp); |
502 bp2->bio_children--; /* XXX: atomic ? */ 503 if (bp2->bio_children == 0) | 504 bp2->bio_inbed++; 505 if (bp2->bio_children == bp2->bio_inbed) |
504 g_io_deliver(bp2, bp2->bio_error); 505} 506 507/* XXX: maybe this is only g_slice_spoiled */ 508 509void 510g_std_spoiled(struct g_consumer *cp) 511{ --- 238 unchanged lines hidden --- | 506 g_io_deliver(bp2, bp2->bio_error); 507} 508 509/* XXX: maybe this is only g_slice_spoiled */ 510 511void 512g_std_spoiled(struct g_consumer *cp) 513{ --- 238 unchanged lines hidden --- |