Step one of replacing devsw->d_maxio with si_bsize_max.
Rename dev->si_bsize_max to si_iosize_max and set it in spec_open if the device didn't. Set vp->v_maxio from dev->si_bsize_max in spec_open rather than in ufs_bmap.c
This commit is contained in:
parent
552f337f1f
commit
fae03f66d1
@ -158,7 +158,7 @@ spec_open(ap)
|
||||
struct proc *p = ap->a_p;
|
||||
struct vnode *bvp, *vp = ap->a_vp;
|
||||
dev_t bdev, dev = vp->v_rdev;
|
||||
int error;
|
||||
int error, maxio;
|
||||
struct cdevsw *dsw;
|
||||
|
||||
/*
|
||||
@ -233,8 +233,14 @@ spec_open(ap)
|
||||
if (vn_isdisk(vp)) {
|
||||
if (!dev->si_bsize_phys)
|
||||
dev->si_bsize_phys = DEV_BSIZE;
|
||||
if (!dev->si_bsize_max)
|
||||
dev->si_bsize_max = MAXBSIZE;
|
||||
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;
|
||||
}
|
||||
|
||||
return (error);
|
||||
|
@ -132,41 +132,10 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, runb)
|
||||
*runb = 0;
|
||||
}
|
||||
|
||||
maxrun = 0;
|
||||
if (runp || runb || (vp->v_maxio == 0)) {
|
||||
|
||||
struct vnode *devvp;
|
||||
int blksize;
|
||||
|
||||
blksize = mp->mnt_stat.f_iosize;
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* If MAXPHYS is the largest transfer the disks can handle,
|
||||
* we probably want maxrun to be 1 block less so that we
|
||||
* don't create a block larger than the device can handle.
|
||||
*/
|
||||
devvp = ip->i_devvp;
|
||||
|
||||
if (devvp != NULL && devvp->v_tag != VT_MFS &&
|
||||
devvp->v_type == VBLK) {
|
||||
if (devsw(devvp->v_rdev)->d_maxio > MAXPHYS) {
|
||||
maxrun = MAXPHYS;
|
||||
vp->v_maxio = MAXPHYS;
|
||||
} else {
|
||||
maxrun = devsw(devvp->v_rdev)->d_maxio;
|
||||
vp->v_maxio = devsw(devvp->v_rdev)->d_maxio;
|
||||
}
|
||||
maxrun = maxrun / blksize;
|
||||
maxrun -= 1;
|
||||
}
|
||||
|
||||
if (maxrun <= 0) {
|
||||
vp->v_maxio = DFLTPHYS;
|
||||
maxrun = DFLTPHYS / blksize;
|
||||
maxrun -= 1;
|
||||
}
|
||||
}
|
||||
if (vn_isdisk(vp))
|
||||
maxrun = vp->v_rdev->si_iosize_max / mp->mnt_stat.f_iosize - 1;
|
||||
else
|
||||
maxrun = 0;
|
||||
|
||||
xap = ap == NULL ? a : ap;
|
||||
if (!nump)
|
||||
|
@ -132,41 +132,10 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, runb)
|
||||
*runb = 0;
|
||||
}
|
||||
|
||||
maxrun = 0;
|
||||
if (runp || runb || (vp->v_maxio == 0)) {
|
||||
|
||||
struct vnode *devvp;
|
||||
int blksize;
|
||||
|
||||
blksize = mp->mnt_stat.f_iosize;
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* If MAXPHYS is the largest transfer the disks can handle,
|
||||
* we probably want maxrun to be 1 block less so that we
|
||||
* don't create a block larger than the device can handle.
|
||||
*/
|
||||
devvp = ip->i_devvp;
|
||||
|
||||
if (devvp != NULL && devvp->v_tag != VT_MFS &&
|
||||
devvp->v_type == VBLK) {
|
||||
if (devsw(devvp->v_rdev)->d_maxio > MAXPHYS) {
|
||||
maxrun = MAXPHYS;
|
||||
vp->v_maxio = MAXPHYS;
|
||||
} else {
|
||||
maxrun = devsw(devvp->v_rdev)->d_maxio;
|
||||
vp->v_maxio = devsw(devvp->v_rdev)->d_maxio;
|
||||
}
|
||||
maxrun = maxrun / blksize;
|
||||
maxrun -= 1;
|
||||
}
|
||||
|
||||
if (maxrun <= 0) {
|
||||
vp->v_maxio = DFLTPHYS;
|
||||
maxrun = DFLTPHYS / blksize;
|
||||
maxrun -= 1;
|
||||
}
|
||||
}
|
||||
if (vn_isdisk(vp))
|
||||
maxrun = vp->v_rdev->si_iosize_max / mp->mnt_stat.f_iosize - 1;
|
||||
else
|
||||
maxrun = 0;
|
||||
|
||||
xap = ap == NULL ? a : ap;
|
||||
if (!nump)
|
||||
|
@ -158,7 +158,7 @@ spec_open(ap)
|
||||
struct proc *p = ap->a_p;
|
||||
struct vnode *bvp, *vp = ap->a_vp;
|
||||
dev_t bdev, dev = vp->v_rdev;
|
||||
int error;
|
||||
int error, maxio;
|
||||
struct cdevsw *dsw;
|
||||
|
||||
/*
|
||||
@ -233,8 +233,14 @@ spec_open(ap)
|
||||
if (vn_isdisk(vp)) {
|
||||
if (!dev->si_bsize_phys)
|
||||
dev->si_bsize_phys = DEV_BSIZE;
|
||||
if (!dev->si_bsize_max)
|
||||
dev->si_bsize_max = MAXBSIZE;
|
||||
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;
|
||||
}
|
||||
|
||||
return (error);
|
||||
|
@ -70,7 +70,7 @@ struct specinfo {
|
||||
struct mount *__sid_mountpoint;
|
||||
int __sid_bsize_phys; /* min physical block size */
|
||||
int __sid_bsize_best; /* optimal block size */
|
||||
int __sid_bsize_max; /* maximum block size */
|
||||
int __sid_iosize_max; /* maximum I/O size */
|
||||
} __si_disk;
|
||||
} __si_u;
|
||||
};
|
||||
@ -80,7 +80,7 @@ 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_bsize_max __si_u.__si_disk.__sid_bsize_max
|
||||
#define si_iosize_max __si_u.__si_disk.__sid_iosize_max
|
||||
|
||||
/*
|
||||
* Exported shorthand
|
||||
|
@ -70,7 +70,7 @@ struct specinfo {
|
||||
struct mount *__sid_mountpoint;
|
||||
int __sid_bsize_phys; /* min physical block size */
|
||||
int __sid_bsize_best; /* optimal block size */
|
||||
int __sid_bsize_max; /* maximum block size */
|
||||
int __sid_iosize_max; /* maximum I/O size */
|
||||
} __si_disk;
|
||||
} __si_u;
|
||||
};
|
||||
@ -80,7 +80,7 @@ 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_bsize_max __si_u.__si_disk.__sid_bsize_max
|
||||
#define si_iosize_max __si_u.__si_disk.__sid_iosize_max
|
||||
|
||||
/*
|
||||
* Exported shorthand
|
||||
|
@ -335,7 +335,7 @@ mfs_mount(mp, path, data, ndp, p)
|
||||
dev = make_dev(&mfs_cdevsw, mfs_minor, 0, 0, 0, "MFS%d", mfs_minor);
|
||||
/* It is not clear that these will get initialized otherwise */
|
||||
dev->si_bsize_phys = DEV_BSIZE;
|
||||
dev->si_bsize_max = MAXBSIZE;
|
||||
dev->si_iosize_max = DFLTPHYS;
|
||||
addaliasu(devvp, makeudev(253, mfs_minor++));
|
||||
devvp->v_data = mfsp;
|
||||
mfsp->mfs_baseoff = args.base;
|
||||
@ -497,7 +497,7 @@ mfs_init(vfsp)
|
||||
0, 0, 0, "MFS%d", mfs_minor);
|
||||
/* It is not clear that these will get initialized otherwise */
|
||||
rootdev->si_bsize_phys = DEV_BSIZE;
|
||||
rootdev->si_bsize_max = MAXBSIZE;
|
||||
rootdev->si_iosize_max = DFLTPHYS;
|
||||
mfs_minor++;
|
||||
} else if (bootverbose)
|
||||
printf("No MFS image available as root f/s.\n");
|
||||
|
@ -132,41 +132,10 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, runb)
|
||||
*runb = 0;
|
||||
}
|
||||
|
||||
maxrun = 0;
|
||||
if (runp || runb || (vp->v_maxio == 0)) {
|
||||
|
||||
struct vnode *devvp;
|
||||
int blksize;
|
||||
|
||||
blksize = mp->mnt_stat.f_iosize;
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* If MAXPHYS is the largest transfer the disks can handle,
|
||||
* we probably want maxrun to be 1 block less so that we
|
||||
* don't create a block larger than the device can handle.
|
||||
*/
|
||||
devvp = ip->i_devvp;
|
||||
|
||||
if (devvp != NULL && devvp->v_tag != VT_MFS &&
|
||||
devvp->v_type == VBLK) {
|
||||
if (devsw(devvp->v_rdev)->d_maxio > MAXPHYS) {
|
||||
maxrun = MAXPHYS;
|
||||
vp->v_maxio = MAXPHYS;
|
||||
} else {
|
||||
maxrun = devsw(devvp->v_rdev)->d_maxio;
|
||||
vp->v_maxio = devsw(devvp->v_rdev)->d_maxio;
|
||||
}
|
||||
maxrun = maxrun / blksize;
|
||||
maxrun -= 1;
|
||||
}
|
||||
|
||||
if (maxrun <= 0) {
|
||||
vp->v_maxio = DFLTPHYS;
|
||||
maxrun = DFLTPHYS / blksize;
|
||||
maxrun -= 1;
|
||||
}
|
||||
}
|
||||
if (vn_isdisk(vp))
|
||||
maxrun = vp->v_rdev->si_iosize_max / mp->mnt_stat.f_iosize - 1;
|
||||
else
|
||||
maxrun = 0;
|
||||
|
||||
xap = ap == NULL ? a : ap;
|
||||
if (!nump)
|
||||
|
Loading…
x
Reference in New Issue
Block a user