From af63f9546ade194575238522dacd38cebe3b63f6 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 20 Oct 2002 20:28:24 +0000 Subject: Now that the sectorsize and mediasize are properties of the provider, don't take the detour over the I/O path to discover them using getattr(), we can just pick them out directly. Do note though, that for now they are only valid after the first open of the underlying disk device due compatibility with the old disk_create() API. This will change in the future so they will always be valid. Sponsored by: DARPA & NAI Labs. --- sys/geom/geom_bsd.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'sys/geom/geom_bsd.c') diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c index f8688e1..9446186 100644 --- a/sys/geom/geom_bsd.c +++ b/sys/geom/geom_bsd.c @@ -319,12 +319,8 @@ g_bsd_modify(struct g_geom *gp, struct disklabel *dl) /* Get dimensions of our device. */ cp = LIST_FIRST(&gp->consumer); - error = g_getattr("GEOM::sectorsize", cp, &secsize); - if (error) - return (error); - error = g_getattr("GEOM::mediasize", cp, &mediasize); - if (error) - return (error); + secsize = cp->provider->sectorsize; + mediasize = cp->provider->mediasize; #ifdef nolonger /* @@ -513,11 +509,7 @@ g_bsd_ioctl(void *arg) KASSERT(gio->cmd == DIOCWDINFO, ("Unknown ioctl in g_bsd_ioctl")); cp = LIST_FIRST(&gp->consumer); /* Get sector size, we need it to read data. */ - error = g_getattr("GEOM::sectorsize", cp, &secsize); - if (error || secsize < 512) { - g_io_deliver(bp, error); - return; - } + secsize = cp->provider->sectorsize; secoff = ms->labeloffset % secsize; buf = g_read_data(cp, ms->labeloffset - secoff, secsize, &error); if (buf == NULL || error != 0) { @@ -703,8 +695,8 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, int flags) break; /* Get sector size, we need it to read data. */ - error = g_getattr("GEOM::sectorsize", cp, &secsize); - if (error || secsize < 512) + secsize = cp->provider->sectorsize; + if (secsize < 512) break; /* First look for a label at the start of the second sector. */ -- cgit v1.1