diff options
author | phk <phk@FreeBSD.org> | 1999-09-20 19:57:28 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-09-20 19:57:28 +0000 |
commit | 3ea30afc2df519befce9b302ed4959d17a6392e6 (patch) | |
tree | f5b84884151162e62383cc75887209758a02a78c | |
parent | c0818069f7d5c0aa756e24c5d4605e5c1da60edc (diff) | |
download | FreeBSD-src-3ea30afc2df519befce9b302ed4959d17a6392e6.zip FreeBSD-src-3ea30afc2df519befce9b302ed4959d17a6392e6.tar.gz |
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
-rw-r--r-- | sys/fs/specfs/spec_vnops.c | 12 | ||||
-rw-r--r-- | sys/gnu/ext2fs/ext2_bmap.c | 39 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_bmap.c | 39 | ||||
-rw-r--r-- | sys/miscfs/specfs/spec_vnops.c | 12 | ||||
-rw-r--r-- | sys/sys/conf.h | 4 | ||||
-rw-r--r-- | sys/sys/linedisc.h | 4 | ||||
-rw-r--r-- | sys/ufs/mfs/mfs_vfsops.c | 4 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_bmap.c | 39 |
8 files changed, 36 insertions, 117 deletions
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c index 46b4eb5..7509c5e 100644 --- a/sys/fs/specfs/spec_vnops.c +++ b/sys/fs/specfs/spec_vnops.c @@ -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); diff --git a/sys/gnu/ext2fs/ext2_bmap.c b/sys/gnu/ext2fs/ext2_bmap.c index cf56407..d200b36 100644 --- a/sys/gnu/ext2fs/ext2_bmap.c +++ b/sys/gnu/ext2fs/ext2_bmap.c @@ -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) diff --git a/sys/gnu/fs/ext2fs/ext2_bmap.c b/sys/gnu/fs/ext2fs/ext2_bmap.c index cf56407..d200b36 100644 --- a/sys/gnu/fs/ext2fs/ext2_bmap.c +++ b/sys/gnu/fs/ext2fs/ext2_bmap.c @@ -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) diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c index 46b4eb5..7509c5e 100644 --- a/sys/miscfs/specfs/spec_vnops.c +++ b/sys/miscfs/specfs/spec_vnops.c @@ -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); diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 156a192..1f44b6b 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -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 diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h index 156a192..1f44b6b 100644 --- a/sys/sys/linedisc.h +++ b/sys/sys/linedisc.h @@ -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 diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c index 22ca0b6..c17fbd4 100644 --- a/sys/ufs/mfs/mfs_vfsops.c +++ b/sys/ufs/mfs/mfs_vfsops.c @@ -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"); diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c index cf56407..d200b36 100644 --- a/sys/ufs/ufs/ufs_bmap.c +++ b/sys/ufs/ufs/ufs_bmap.c @@ -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) |