diff options
author | phk <phk@FreeBSD.org> | 2002-10-20 20:28:24 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-10-20 20:28:24 +0000 |
commit | af63f9546ade194575238522dacd38cebe3b63f6 (patch) | |
tree | 4be4d44cd73707526477ac8dedf166de6841e46d /sys/geom/geom_aes.c | |
parent | f0693daa1f5896bbd37f2ad85ba732389ac99646 (diff) | |
download | FreeBSD-src-af63f9546ade194575238522dacd38cebe3b63f6.zip FreeBSD-src-af63f9546ade194575238522dacd38cebe3b63f6.tar.gz |
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.
Diffstat (limited to 'sys/geom/geom_aes.c')
-rw-r--r-- | sys/geom/geom_aes.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/sys/geom/geom_aes.c b/sys/geom/geom_aes.c index 6aae347..fae7f34 100644 --- a/sys/geom/geom_aes.c +++ b/sys/geom/geom_aes.c @@ -229,10 +229,6 @@ g_aes_start(struct bio *bp) break; case BIO_GETATTR: case BIO_SETATTR: - if (g_handleattr_off_t(bp, "GEOM::mediasize", sc->mediasize)) - return; - if (g_handleattr_int(bp, "GEOM::sectorsize", sc->sectorsize)) - return; bp2 = g_clone_bio(bp); if (bp2 == NULL) { g_io_deliver(bp, ENOMEM); @@ -320,12 +316,8 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) while (1) { if (gp->rank != 2) break; - error = g_getattr("GEOM::sectorsize", cp, §orsize); - if (error) - break; - error = g_getattr("GEOM::mediasize", cp, &mediasize); - if (error) - break; + sectorsize = cp->provider->sectorsize; + mediasize = cp->provider->mediasize; buf = g_read_data(cp, 0, sectorsize, &error); if (buf == NULL || error != 0) { break; @@ -373,6 +365,7 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused) g_topology_lock(); pp = g_new_providerf(gp, gp->name); pp->mediasize = mediasize - sectorsize; + pp->sectorsize = sectorsize; g_error_provider(pp, 0); g_topology_unlock(); break; |