summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-03-03 13:05:00 +0000
committerphk <phk@FreeBSD.org>2003-03-03 13:05:00 +0000
commit7499df545729c9d91d2eabb72e479a6cd3e09fab (patch)
treeebeb4dc8a6258d6e27bf80318a7c535c404b73c1 /sys
parent8a0180038b858afdb5efab37fccdc9cd13a552e9 (diff)
downloadFreeBSD-src-7499df545729c9d91d2eabb72e479a6cd3e09fab.zip
FreeBSD-src-7499df545729c9d91d2eabb72e479a6cd3e09fab.tar.gz
Add a "-S sectorsize" option to enable Kirk to find a bug :-)
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/md/md.c8
-rw-r--r--sys/sys/mdioctl.h3
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index c03d10e..7b754cb 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -746,6 +746,8 @@ mdcreate_malloc(struct md_ioctl *mdio)
return (EINVAL);
if (mdio->md_options & ~(MD_AUTOUNIT | MD_COMPRESS | MD_RESERVE))
return (EINVAL);
+ if (mdio->md_secsize != 0 && !powerof2(mdio->md_secsize))
+ return (EINVAL);
/* Compression doesn't make sense if we have reserved space */
if (mdio->md_options & MD_RESERVE)
mdio->md_options &= ~MD_COMPRESS;
@@ -760,8 +762,12 @@ mdcreate_malloc(struct md_ioctl *mdio)
return (EBUSY);
}
sc->type = MD_MALLOC;
- sc->secsize = DEV_BSIZE;
+ if (mdio->md_secsize != 0)
+ sc->secsize = mdio->md_secsize;
+ else
+ sc->secsize = DEV_BSIZE;
sc->nsect = mdio->md_size;
+ sc->nsect /= (sc->secsize / DEV_BSIZE);
sc->flags = mdio->md_options & (MD_COMPRESS | MD_FORCE);
sc->indir = dimension(sc->nsect);
sc->uma = uma_zcreate(sc->name, sc->secsize,
diff --git a/sys/sys/mdioctl.h b/sys/sys/mdioctl.h
index 15a70e1..89b9522 100644
--- a/sys/sys/mdioctl.h
+++ b/sys/sys/mdioctl.h
@@ -53,7 +53,7 @@ enum md_types {MD_MALLOC, MD_PRELOAD, MD_VNODE, MD_SWAP};
* Ioctl definitions for memory disk pseudo-device.
*/
-#define MDNPAD 100
+#define MDNPAD 99
struct md_ioctl {
unsigned md_version; /* Structure layout version */
unsigned md_unit; /* unit number */
@@ -62,6 +62,7 @@ struct md_ioctl {
unsigned md_size; /* size of disk in DEV_BSIZE units */
unsigned md_options; /* options */
u_int64_t md_base; /* base address */
+ int md_secsize; /* sectorsize */
int md_pad[MDNPAD]; /* padding for future ideas */
};
OpenPOWER on IntegriCloud