From 872629476414ab109f622ab404355f2283a99c5b Mon Sep 17 00:00:00 2001 From: dyson Date: Sat, 24 Jan 1998 02:01:46 +0000 Subject: Add better support for larger I/O clusters, including larger physical I/O. The support is not mature yet, and some of the underlying implementation needs help. However, support does exist for IDE devices now. --- sys/gnu/fs/ext2fs/ext2_bmap.c | 44 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) (limited to 'sys/gnu/fs/ext2fs/ext2_bmap.c') diff --git a/sys/gnu/fs/ext2fs/ext2_bmap.c b/sys/gnu/fs/ext2fs/ext2_bmap.c index 84df148..4cab099 100644 --- a/sys/gnu/fs/ext2fs/ext2_bmap.c +++ b/sys/gnu/fs/ext2fs/ext2_bmap.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)ufs_bmap.c 8.7 (Berkeley) 3/21/95 - * $Id: ufs_bmap.c,v 1.16 1997/09/02 20:06:56 bde Exp $ + * $Id: ufs_bmap.c,v 1.17 1997/11/24 16:33:03 bde Exp $ */ #include @@ -46,11 +46,13 @@ #include #include #include +#include #include #include #include #include +#include /* * Bmap converts a the logical block number of a file to its physical block @@ -124,18 +126,48 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, runb) #endif if (runp) { + *runp = 0; + } + + if (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. */ - *runp = 0; - maxrun = MAXPHYS / mp->mnt_stat.f_iosize - 1; - } + devvp = ip->i_devvp; - if (runb) { - *runb = 0; + if (devvp && devvp->v_type == VBLK && + (devvp->v_rdev != NODEV) && + (major(devvp->v_rdev) < nblkdev)) { + if (bdevsw[major(devvp->v_rdev)]->d_maxio > MAXPHYS) { + maxrun = MAXPHYS; + vp->v_maxio = MAXPHYS; + } else { + maxrun = bdevsw[major(devvp->v_rdev)]->d_maxio; + vp->v_maxio = bdevsw[major(devvp->v_rdev)]->d_maxio; + } + maxrun = maxrun / blksize; + maxrun -= 1; + } + + if (maxrun == 0) { + vp->v_maxio = DFLTPHYS; + maxrun = DFLTPHYS / blksize; + maxrun -= 1; + } } xap = ap == NULL ? a : ap; -- cgit v1.1