Deleted Added
full compact
geom_slice.c (256724) geom_slice.c (256880)
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

--- 20 unchanged lines hidden (view full) ---

29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#include <sys/cdefs.h>
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

--- 20 unchanged lines hidden (view full) ---

29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/geom/geom_slice.c 256724 2013-10-18 09:14:19Z trasz $");
37__FBSDID("$FreeBSD: head/sys/geom/geom_slice.c 256880 2013-10-22 08:22:19Z mav $");
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>
42#include <sys/malloc.h>
43#include <sys/bio.h>
44#include <sys/sysctl.h>
45#include <sys/proc.h>

--- 345 unchanged lines hidden (view full) ---

391 va_end(ap);
392 sbuf_finish(sb);
393 pp = g_new_providerf(gp, "%s", sbuf_data(sb));
394 pp2 = LIST_FIRST(&gp->consumer)->provider;
395 pp->stripesize = pp2->stripesize;
396 pp->stripeoffset = pp2->stripeoffset + offset;
397 if (pp->stripesize > 0)
398 pp->stripeoffset %= pp->stripesize;
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>
42#include <sys/malloc.h>
43#include <sys/bio.h>
44#include <sys/sysctl.h>
45#include <sys/proc.h>

--- 345 unchanged lines hidden (view full) ---

391 va_end(ap);
392 sbuf_finish(sb);
393 pp = g_new_providerf(gp, "%s", sbuf_data(sb));
394 pp2 = LIST_FIRST(&gp->consumer)->provider;
395 pp->stripesize = pp2->stripesize;
396 pp->stripeoffset = pp2->stripeoffset + offset;
397 if (pp->stripesize > 0)
398 pp->stripeoffset %= pp->stripesize;
399 if (gsp->nhotspot == 0)
399 if (gsp->nhotspot == 0) {
400 pp->flags |= pp2->flags & G_PF_ACCEPT_UNMAPPED;
400 pp->flags |= pp2->flags & G_PF_ACCEPT_UNMAPPED;
401 pp->flags |= G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE;
402 }
401 if (0 && bootverbose)
402 printf("GEOM: Configure %s, start %jd length %jd end %jd\n",
403 pp->name, (intmax_t)offset, (intmax_t)length,
404 (intmax_t)(offset + length - 1));
405 pp->index = idx;
406 pp->mediasize = gsl->length;
407 pp->sectorsize = gsl->sectorsize;
408 gsl->provider = pp;

--- 16 unchanged lines hidden (view full) ---

425 * XXX: we can protect the hotspot stuff with a mutex.
426 */
427
428int
429g_slice_conf_hot(struct g_geom *gp, u_int idx, off_t offset, off_t length, int ract, int dact, int wact)
430{
431 struct g_slicer *gsp;
432 struct g_slice_hot *gsl, *gsl2;
403 if (0 && bootverbose)
404 printf("GEOM: Configure %s, start %jd length %jd end %jd\n",
405 pp->name, (intmax_t)offset, (intmax_t)length,
406 (intmax_t)(offset + length - 1));
407 pp->index = idx;
408 pp->mediasize = gsl->length;
409 pp->sectorsize = gsl->sectorsize;
410 gsl->provider = pp;

--- 16 unchanged lines hidden (view full) ---

427 * XXX: we can protect the hotspot stuff with a mutex.
428 */
429
430int
431g_slice_conf_hot(struct g_geom *gp, u_int idx, off_t offset, off_t length, int ract, int dact, int wact)
432{
433 struct g_slicer *gsp;
434 struct g_slice_hot *gsl, *gsl2;
435 struct g_consumer *cp;
433 struct g_provider *pp;
434
435 g_trace(G_T_TOPOLOGY, "g_slice_conf_hot(%s, idx: %d, off: %jd, len: %jd)",
436 gp->name, idx, (intmax_t)offset, (intmax_t)length);
437 g_topology_assert();
438 gsp = gp->softc;
436 struct g_provider *pp;
437
438 g_trace(G_T_TOPOLOGY, "g_slice_conf_hot(%s, idx: %d, off: %jd, len: %jd)",
439 gp->name, idx, (intmax_t)offset, (intmax_t)length);
440 g_topology_assert();
441 gsp = gp->softc;
439 /* Deny unmapped I/O if hotspots are used. */
442 /* Deny unmapped I/O and direct dispatch if hotspots are used. */
440 if (gsp->nhotspot == 0) {
441 LIST_FOREACH(pp, &gp->provider, provider)
443 if (gsp->nhotspot == 0) {
444 LIST_FOREACH(pp, &gp->provider, provider)
442 pp->flags &= ~G_PF_ACCEPT_UNMAPPED;
445 pp->flags &= ~(G_PF_ACCEPT_UNMAPPED |
446 G_PF_DIRECT_SEND | G_PF_DIRECT_RECEIVE);
447 LIST_FOREACH(cp, &gp->consumer, consumer)
448 cp->flags &= ~(G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE);
443 }
444 gsl = gsp->hotspot;
445 if(idx >= gsp->nhotspot) {
446 gsl2 = g_malloc((idx + 1) * sizeof *gsl2, M_WAITOK | M_ZERO);
447 if (gsp->hotspot != NULL)
448 bcopy(gsp->hotspot, gsl2, gsp->nhotspot * sizeof *gsl2);
449 gsp->hotspot = gsl2;
450 if (gsp->hotspot != NULL)

--- 55 unchanged lines hidden (view full) ---

506 gp->softc = gsp;
507 gp->start = g_slice_start;
508 gp->spoiled = g_slice_spoiled;
509 if (gp->dumpconf == NULL)
510 gp->dumpconf = g_slice_dumpconf;
511 if (gp->class->destroy_geom == NULL)
512 gp->class->destroy_geom = g_slice_destroy_geom;
513 cp = g_new_consumer(gp);
449 }
450 gsl = gsp->hotspot;
451 if(idx >= gsp->nhotspot) {
452 gsl2 = g_malloc((idx + 1) * sizeof *gsl2, M_WAITOK | M_ZERO);
453 if (gsp->hotspot != NULL)
454 bcopy(gsp->hotspot, gsl2, gsp->nhotspot * sizeof *gsl2);
455 gsp->hotspot = gsl2;
456 if (gsp->hotspot != NULL)

--- 55 unchanged lines hidden (view full) ---

512 gp->softc = gsp;
513 gp->start = g_slice_start;
514 gp->spoiled = g_slice_spoiled;
515 if (gp->dumpconf == NULL)
516 gp->dumpconf = g_slice_dumpconf;
517 if (gp->class->destroy_geom == NULL)
518 gp->class->destroy_geom = g_slice_destroy_geom;
519 cp = g_new_consumer(gp);
520 cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
514 error = g_attach(cp, pp);
515 if (error == 0)
516 error = g_access(cp, 1, 0, 0);
517 if (error) {
518 g_wither_geom(gp, ENXIO);
519 return (NULL);
520 }
521 if (extrap != NULL)

--- 16 unchanged lines hidden ---
521 error = g_attach(cp, pp);
522 if (error == 0)
523 error = g_access(cp, 1, 0, 0);
524 if (error) {
525 g_wither_geom(gp, ENXIO);
526 return (NULL);
527 }
528 if (extrap != NULL)

--- 16 unchanged lines hidden ---