summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/fs/specfs/spec_vnops.c12
-rw-r--r--sys/gnu/ext2fs/ext2_bmap.c39
-rw-r--r--sys/gnu/fs/ext2fs/ext2_bmap.c39
-rw-r--r--sys/miscfs/specfs/spec_vnops.c12
-rw-r--r--sys/sys/conf.h4
-rw-r--r--sys/sys/linedisc.h4
-rw-r--r--sys/ufs/mfs/mfs_vfsops.c4
-rw-r--r--sys/ufs/ufs/ufs_bmap.c39
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)
OpenPOWER on IntegriCloud