mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
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.
This commit is contained in:
parent
bb17c5f69f
commit
8a63edc3a1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=110710
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user