From 183a45f65eaaceba22d8a549b7fd46a9a694b7a6 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 19 Apr 2003 10:00:22 +0000 Subject: [PATCH] Create a dedicated structure for holding hotspot information rather than using slice structures for it. --- sys/geom/geom_slice.c | 23 ++++++++++++----------- 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 878e93d3435a..aff9103b44d0 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 41ab9555618b..ff66d7ed61c0 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;