diff options
author | phk <phk@FreeBSD.org> | 2003-04-19 10:00:22 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-04-19 10:00:22 +0000 |
commit | a41f716e9125fc28668d9e5527484d806592cddf (patch) | |
tree | b62184b8f0672e5ffa38fa2f90890cb180c77cc5 /sys/geom | |
parent | f6cc6047c753be3f79f0c7b210a1380b7691897f (diff) | |
download | FreeBSD-src-a41f716e9125fc28668d9e5527484d806592cddf.zip FreeBSD-src-a41f716e9125fc28668d9e5527484d806592cddf.tar.gz |
Create a dedicated structure for holding hotspot information rather than
using slice structures for it.
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_slice.c | 23 | ||||
-rw-r--r-- | sys/geom/geom_slice.h | 19 |
2 files changed, 24 insertions, 18 deletions
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c index 878e93d..aff9103 100644 --- a/sys/geom/geom_slice.c +++ b/sys/geom/geom_slice.c @@ -152,7 +152,8 @@ g_slice_start(struct bio *bp) struct g_geom *gp; struct g_consumer *cp; struct g_slicer *gsp; - struct g_slice *gsl, *gmp; + struct g_slice *gsl; + struct g_slice_hot *gmp; int idx, error; u_int m_index; off_t t; @@ -181,8 +182,8 @@ g_slice_start(struct bio *bp) g_io_deliver(bp, EINVAL); return; } - for (m_index = 0; m_index < gsp->nhot; m_index++) { - gmp = &gsp->hot[m_index]; + for (m_index = 0; m_index < gsp->nhotspot; m_index++) { + gmp = &gsp->hotspot[m_index]; if (t >= gmp->offset + gmp->length) continue; if (t + bp->bio_length <= gmp->offset) @@ -341,21 +342,21 @@ int g_slice_conf_hot(struct g_geom *gp, u_int idx, off_t offset, off_t length) { struct g_slicer *gsp; - struct g_slice *gsl, *gsl2; + struct g_slice_hot *gsl, *gsl2; g_trace(G_T_TOPOLOGY, "g_slice_conf_hot()"); g_topology_assert(); gsp = gp->softc; - gsl = gsp->hot; - if(idx >= gsp->nhot) { + gsl = gsp->hotspot; + if(idx >= gsp->nhotspot) { gsl2 = g_malloc((idx + 1) * sizeof *gsl2, M_WAITOK | M_ZERO); - if (gsp->hot != NULL) - bcopy(gsp->hot, gsl2, gsp->nhot * sizeof *gsl2); - gsp->hot = gsl2; - if (gsp->hot != NULL) + if (gsp->hotspot != NULL) + bcopy(gsp->hotspot, gsl2, gsp->nhotspot * sizeof *gsl2); + gsp->hotspot = gsl2; + if (gsp->hotspot != NULL) g_free(gsl); gsl = gsl2; - gsp->nhot = idx + 1; + gsp->nhotspot = idx + 1; } if (bootverbose) printf("GEOM: Add %s hot[%d] start %jd length %jd end %jd\n", diff --git a/sys/geom/geom_slice.h b/sys/geom/geom_slice.h index 41ab955..ff66d7e 100644 --- a/sys/geom/geom_slice.h +++ b/sys/geom/geom_slice.h @@ -45,16 +45,21 @@ struct g_slice { struct g_provider *provider; }; +struct g_slice_hot { + off_t offset; + off_t length; +}; + typedef int g_slice_start_t (struct bio *bp); struct g_slicer { - u_int nslice; - u_int nprovider; - u_int nhot; - struct g_slice *slices; - struct g_slice *hot; - void *softc; - g_slice_start_t *start; + u_int nslice; + u_int nprovider; + struct g_slice *slices; + u_int nhotspot; + struct g_slice_hot *hotspot; + void *softc; + g_slice_start_t *start; }; g_dumpconf_t g_slice_dumpconf; |