summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-02-11 14:57:34 +0000
committerphk <phk@FreeBSD.org>2003-02-11 14:57:34 +0000
commitfd7ea6d48a7d211946407c3e54e2eb37746d510a (patch)
tree9134449cbea5212847a4e75800cbaa03b04f0f69 /sys
parentb2fb11897013800a76444ffcab5961680ac3f321 (diff)
downloadFreeBSD-src-fd7ea6d48a7d211946407c3e54e2eb37746d510a.zip
FreeBSD-src-fd7ea6d48a7d211946407c3e54e2eb37746d510a.tar.gz
Better names for struct disk elements: d_maxsize, d_stripeoffset
and d_stripesisze; Introduce si_stripesize and si_stripeoffset in struct cdev so we can make the visible to clustering code. Add stripesize and stripeoffset to providers. DTRT with stripesize and stripeoffset in various places in GEOM.
Diffstat (limited to 'sys')
-rw-r--r--sys/geom/bde/g_bde.c2
-rw-r--r--sys/geom/geom.h2
-rw-r--r--sys/geom/geom_dev.c2
-rw-r--r--sys/geom/geom_disk.c2
-rw-r--r--sys/geom/geom_slice.c8
-rw-r--r--sys/geom/notes30
-rw-r--r--sys/sys/conf.h2
-rw-r--r--sys/sys/disk.h6
-rw-r--r--sys/sys/linedisc.h2
9 files changed, 50 insertions, 6 deletions
diff --git a/sys/geom/bde/g_bde.c b/sys/geom/bde/g_bde.c
index 1f6f9cf..13fb280 100644
--- a/sys/geom/bde/g_bde.c
+++ b/sys/geom/bde/g_bde.c
@@ -248,6 +248,8 @@ g_bde_config(struct g_configargs *ga)
g_topology_lock();
pp = g_new_providerf(gp, gp->name);
pp->flags |= G_PF_CANDELETE;
+ pp->slicesize = kp->zone_cont;
+ pp->sliceoffset = 0;
pp->mediasize = sc->mediasize;
pp->sectorsize = sc->sectorsize;
g_error_provider(pp, 0);
diff --git a/sys/geom/geom.h b/sys/geom/geom.h
index 7bd3ca7..9047f071 100644
--- a/sys/geom/geom.h
+++ b/sys/geom/geom.h
@@ -170,6 +170,8 @@ struct g_provider {
u_int index;
off_t mediasize;
u_int sectorsize;
+ u_int stripesize;
+ u_int stripeoffset;
struct g_stat *stat;
u_int flags;
#define G_PF_CANDELETE 0x1
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index c626f14..fe3ad37 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -176,6 +176,8 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
mtx_unlock(&Giant);
g_topology_lock();
+ dev->si_stripesize = pp->stripesize;
+ dev->si_stripeoffset = pp->stripeoffset;
gp->softc = dev;
dev->si_drv1 = gp;
dev->si_drv2 = cp;
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index d763bfe..43d9155 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -290,6 +290,8 @@ g_disk_create(void *arg)
pp->sectorsize = dp->d_sectorsize;
if (dp->d_flags & DISKFLAG_CANDELETE)
pp->flags |= G_PF_CANDELETE;
+ pp->stripeoffset = dp->d_stripeoffset;
+ pp->stripesize = dp->d_stripesize;
g_error_provider(pp, 0);
if (bootverbose)
printf("GEOM: new disk %s\n", gp->name);
diff --git a/sys/geom/geom_slice.c b/sys/geom/geom_slice.c
index e0632b3..11f1380 100644
--- a/sys/geom/geom_slice.c
+++ b/sys/geom/geom_slice.c
@@ -291,7 +291,7 @@ g_slice_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct
int
g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length, u_int sectorsize, const char *fmt, ...)
{
- struct g_provider *pp;
+ struct g_provider *pp, *pp2;
struct g_slicer *gsp;
struct g_slice *gsl;
va_list ap;
@@ -346,8 +346,10 @@ g_slice_config(struct g_geom *gp, u_int idx, int how, off_t offset, off_t length
sbuf_vprintf(sb, fmt, ap);
sbuf_finish(sb);
pp = g_new_providerf(gp, sbuf_data(sb));
- pp->flags =
- LIST_FIRST(&gp->consumer)->provider->flags & G_PF_CANDELETE;
+ pp2 = LIST_FIRST(&gp->consumer)->provider;
+ pp->flags = pp2->flags & G_PF_CANDELETE;
+ pp->stripesize = pp2->stripesize;
+ pp->stripeoffset = (pp2->stripeoffset + offset) % pp->stripesize;
if (bootverbose)
printf("GEOM: Configure %s, start %jd length %jd end %jd\n",
pp->name, (intmax_t)offset, (intmax_t)length,
diff --git a/sys/geom/notes b/sys/geom/notes
index eff24c5..9e674f7 100644
--- a/sys/geom/notes
+++ b/sys/geom/notes
@@ -86,3 +86,33 @@ allows userland to mmap(2) the pages containing the statistics data.
In order to indicate to userland when the data in a statstics
structure might be inconsistent, g_io_deliver() atomically sets a
flag "updating" and resets it when the structure is again consistent.
+-----------------------------------------------------------------------
+maxsize, stripesize and stripeoffset
+
+maxsize is the biggest request we are willing to handle. If not
+set there is no upper bound on the size of a request and the code
+is responsible for chopping it up. Only hardware methods should
+set an upper bound in this field. Geom_disk will inherit the upper
+bound set by the device driver.
+
+stripesize is the width of any natural request boundaries for the
+device. This would be the width of a stripe on a raid-5 unit or
+one zone in GBDE. The idea with this field is to hint to clustering
+type code to not trivially overrun these boundaries.
+
+stripeoffset is the amount of the first stripe which lies before the
+devices beginning.
+
+If we have a device with 64k stripes:
+ [0...64k[
+ [64k...128k[
+ [128k..192k[
+Then it will have stripesize = 64k and stripeoffset = 0.
+
+If we put a MBR on this device, where slice#1 starts on sector#63,
+then this slice will have: stripesize = 64k, stripeoffset = 63 * sectorsize.
+
+If the clustering code wants to widen a request which writes to
+sector#53 of the slice, it can calculate how many bytes till the end of
+the stripe as:
+ stripewith - (53 * sectorsize + stripeoffset) % stripewidth.
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 20085b2..adb95df 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -78,6 +78,8 @@ struct cdev {
void *si_drv1, *si_drv2;
struct cdevsw *si_devsw;
int si_iosize_max; /* maximum I/O size (for physio &al) */
+ u_int si_stripesize;
+ u_int si_stripeoffset;
uid_t si_uid;
gid_t si_gid;
mode_t si_mode;
diff --git a/sys/sys/disk.h b/sys/sys/disk.h
index e84c427..c9b1b85 100644
--- a/sys/sys/disk.h
+++ b/sys/sys/disk.h
@@ -58,9 +58,9 @@ struct disk {
off_t d_mediasize;
u_int d_fwsectors;
u_int d_fwheads;
- u_int d_stripe_offset;
- u_int d_stripe_width;
- u_int d_max_request;
+ u_int d_maxsize;
+ u_int d_stripeoffset;
+ u_int d_stripesize;
/* Fields private to the driver */
void *d_drv1;
diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h
index 20085b2..adb95df 100644
--- a/sys/sys/linedisc.h
+++ b/sys/sys/linedisc.h
@@ -78,6 +78,8 @@ struct cdev {
void *si_drv1, *si_drv2;
struct cdevsw *si_devsw;
int si_iosize_max; /* maximum I/O size (for physio &al) */
+ u_int si_stripesize;
+ u_int si_stripeoffset;
uid_t si_uid;
gid_t si_gid;
mode_t si_mode;
OpenPOWER on IntegriCloud