summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-09-22 19:56:14 +0000
committerphk <phk@FreeBSD.org>1999-09-22 19:56:14 +0000
commit56948f82f5dc2d74432bc167dc307d2efa804e97 (patch)
treeaa1cec6687b5942804ab9aee76ca908bc41463a7 /sys
parent9e9ee6a9d861a3edf3d0726e5344af5760250c3b (diff)
downloadFreeBSD-src-56948f82f5dc2d74432bc167dc307d2efa804e97.zip
FreeBSD-src-56948f82f5dc2d74432bc167dc307d2efa804e97.tar.gz
Kill the cdevsw->d_maxio field.
d_maxio is replaced by the dev->si_iosize_max field which the driver should be set in all calls to cdevsw->d_open if it has a better idea than the system wide default. The field is a generic dev_t field (ie: not disk specific) so that tapes and other devices can use physio as well.
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/specfs/spec_vnops.c18
-rw-r--r--sys/kern/kern_physio.c9
-rw-r--r--sys/miscfs/specfs/spec_vnops.c18
-rw-r--r--sys/sys/conf.h5
-rw-r--r--sys/sys/linedisc.h5
5 files changed, 26 insertions, 29 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index 0f4a334..e8a2163 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -167,6 +167,10 @@ spec_open(ap)
if (vp->v_mount && (vp->v_mount->mnt_flag & MNT_NODEV))
return (ENXIO);
+ /* Make this field valid before any I/O in ->d_open */
+ if (!dev->si_iosize_max)
+ dev->si_iosize_max = DFLTPHYS;
+
switch (vp->v_type) {
case VCHR:
dsw = devsw(dev);
@@ -233,15 +237,13 @@ spec_open(ap)
if (vn_isdisk(vp)) {
if (!dev->si_bsize_phys)
dev->si_bsize_phys = DEV_BSIZE;
- maxio = dev->si_iosize_max;
- if (!maxio)
- maxio = devsw(dev)->d_maxio; /* XXX */
- if (!maxio)
- maxio = DFLTPHYS;
- if (maxio > MAXPHYS)
- maxio = MAXPHYS;
- vp->v_maxio = maxio;
}
+ maxio = dev->si_iosize_max;
+ if (!maxio)
+ maxio = DFLTPHYS;
+ if (maxio > MAXPHYS)
+ maxio = MAXPHYS;
+ vp->v_maxio = maxio;
return (error);
}
diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c
index cc436bf..01bc7f3 100644
--- a/sys/kern/kern_physio.c
+++ b/sys/kern/kern_physio.c
@@ -172,14 +172,9 @@ u_int
minphys(bp)
struct buf *bp;
{
- u_int maxphys = DFLTPHYS;
- struct cdevsw *bdsw;
+ u_int maxphys;
- bdsw = devsw(bp->b_dev);
-
- if (bdsw && bdsw->d_maxio) {
- maxphys = bdsw->d_maxio;
- }
+ maxphys = bp->b_dev->si_iosize_max;
if (bp->b_kvasize && (bp->b_kvasize < maxphys))
maxphys = bp->b_kvasize;
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index 0f4a334..e8a2163 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -167,6 +167,10 @@ spec_open(ap)
if (vp->v_mount && (vp->v_mount->mnt_flag & MNT_NODEV))
return (ENXIO);
+ /* Make this field valid before any I/O in ->d_open */
+ if (!dev->si_iosize_max)
+ dev->si_iosize_max = DFLTPHYS;
+
switch (vp->v_type) {
case VCHR:
dsw = devsw(dev);
@@ -233,15 +237,13 @@ spec_open(ap)
if (vn_isdisk(vp)) {
if (!dev->si_bsize_phys)
dev->si_bsize_phys = DEV_BSIZE;
- maxio = dev->si_iosize_max;
- if (!maxio)
- maxio = devsw(dev)->d_maxio; /* XXX */
- if (!maxio)
- maxio = DFLTPHYS;
- if (maxio > MAXPHYS)
- maxio = MAXPHYS;
- vp->v_maxio = maxio;
}
+ maxio = dev->si_iosize_max;
+ if (!maxio)
+ maxio = DFLTPHYS;
+ if (maxio > MAXPHYS)
+ maxio = MAXPHYS;
+ vp->v_maxio = maxio;
return (error);
}
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 1f44b6b..16bdb49 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -61,6 +61,7 @@ struct specinfo {
struct cdevsw *si_devsw;
void *si_devfs; /* save cookie for devfs operations */
void *si_bdevfs; /* XXX block device (should go away) */
+ int si_iosize_max; /* maximum I/O size (for physio &al) */
union {
struct {
struct tty *__sit_tty;
@@ -70,7 +71,6 @@ struct specinfo {
struct mount *__sid_mountpoint;
int __sid_bsize_phys; /* min physical block size */
int __sid_bsize_best; /* optimal block size */
- int __sid_iosize_max; /* maximum I/O size */
} __si_disk;
} __si_u;
};
@@ -80,7 +80,6 @@ struct specinfo {
#define si_mountpoint __si_u.__si_disk.__sid_mountpoint
#define si_bsize_phys __si_u.__si_disk.__sid_bsize_phys
#define si_bsize_best __si_u.__si_disk.__sid_bsize_best
-#define si_iosize_max __si_u.__si_disk.__sid_iosize_max
/*
* Exported shorthand
@@ -182,7 +181,7 @@ struct cdevsw {
d_dump_t *d_dump;
d_psize_t *d_psize;
u_int d_flags;
- int d_maxio;
+ int d_bogomaxio; /* XXX not used */
int d_bmaj;
};
diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h
index 1f44b6b..16bdb49 100644
--- a/sys/sys/linedisc.h
+++ b/sys/sys/linedisc.h
@@ -61,6 +61,7 @@ struct specinfo {
struct cdevsw *si_devsw;
void *si_devfs; /* save cookie for devfs operations */
void *si_bdevfs; /* XXX block device (should go away) */
+ int si_iosize_max; /* maximum I/O size (for physio &al) */
union {
struct {
struct tty *__sit_tty;
@@ -70,7 +71,6 @@ struct specinfo {
struct mount *__sid_mountpoint;
int __sid_bsize_phys; /* min physical block size */
int __sid_bsize_best; /* optimal block size */
- int __sid_iosize_max; /* maximum I/O size */
} __si_disk;
} __si_u;
};
@@ -80,7 +80,6 @@ struct specinfo {
#define si_mountpoint __si_u.__si_disk.__sid_mountpoint
#define si_bsize_phys __si_u.__si_disk.__sid_bsize_phys
#define si_bsize_best __si_u.__si_disk.__sid_bsize_best
-#define si_iosize_max __si_u.__si_disk.__sid_iosize_max
/*
* Exported shorthand
@@ -182,7 +181,7 @@ struct cdevsw {
d_dump_t *d_dump;
d_psize_t *d_psize;
u_int d_flags;
- int d_maxio;
+ int d_bogomaxio; /* XXX not used */
int d_bmaj;
};
OpenPOWER on IntegriCloud