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.
This commit is contained in:
parent
efee742ecc
commit
c428d4c048
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=51558
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user