mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Put the I/O block size in bufobj->bo_bsize.
We keep si_bsize_phys around for now as that is the simplest way to pull the number out of disk device drivers in devfs_open(). The correct solution would be to do an ioctl(DIOCGSECTORSIZE), but the point is probably mooth when filesystems sit on GEOM, so don't bother for now.
This commit is contained in:
parent
cd9c0da805
commit
5d9d81e7ea
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=136966
@ -782,11 +782,11 @@ devfs_open(ap)
|
||||
if (vn_isdisk(vp, NULL)) {
|
||||
if (!dev->si_bsize_phys)
|
||||
dev->si_bsize_phys = DEV_BSIZE;
|
||||
vp->v_bufobj.bo_bsize = dev->si_bsize_phys;
|
||||
}
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
devfs_pathconf(ap)
|
||||
struct vop_pathconf_args /* {
|
||||
|
@ -1086,7 +1086,7 @@ aio_qphysio(struct proc *p, struct aiocblist *aiocbe)
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (cb->aio_nbytes % vp->v_rdev->si_bsize_phys)
|
||||
if (cb->aio_nbytes % vp->v_bufobj.bo_bsize)
|
||||
return (-1);
|
||||
|
||||
if (cb->aio_nbytes >
|
||||
|
@ -2560,15 +2560,8 @@ getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo,
|
||||
splx(s);
|
||||
return NULL;
|
||||
}
|
||||
if (vn_isdisk(vp, NULL))
|
||||
bsize = DEV_BSIZE;
|
||||
else if (vp->v_mountedhere)
|
||||
bsize = vp->v_mountedhere->mnt_stat.f_iosize;
|
||||
else if (vp->v_mount)
|
||||
bsize = vp->v_mount->mnt_stat.f_iosize;
|
||||
else
|
||||
bsize = size;
|
||||
|
||||
bsize = bo->bo_bsize;
|
||||
offset = blkno * bsize;
|
||||
vmio = (VOP_GETVOBJECT(vp, NULL) == 0) &&
|
||||
(vp->v_vflag & VV_OBJBUF);
|
||||
|
@ -863,8 +863,10 @@ getnewvnode(tag, mp, vops, vpp)
|
||||
printf("NULL mp in getnewvnode()\n");
|
||||
#endif
|
||||
delmntque(vp);
|
||||
if (mp != NULL)
|
||||
if (mp != NULL) {
|
||||
insmntque(vp, mp);
|
||||
bo->bo_bsize = mp->mnt_stat.f_iosize;
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -1812,6 +1814,7 @@ bdevvp(dev, vpp)
|
||||
}
|
||||
vp = nvp;
|
||||
vp->v_type = VCHR;
|
||||
vp->v_bufobj.bo_bsize = DEV_BSIZE;
|
||||
addalias(vp, dev);
|
||||
*vpp = vp;
|
||||
return (0);
|
||||
|
@ -734,17 +734,10 @@ vn_stat(vp, sb, active_cred, file_cred, td)
|
||||
* object. In some filesystem types, this may vary from file
|
||||
* to file"
|
||||
* Default to PAGE_SIZE after much discussion.
|
||||
* XXX: min(PAGE_SIZE, vp->v_bufobj.bo_bsize) may be more correct.
|
||||
*/
|
||||
|
||||
if (vap->va_type == VREG) {
|
||||
sb->st_blksize = vap->va_blocksize;
|
||||
} else if (vn_isdisk(vp, NULL)) {
|
||||
sb->st_blksize = vp->v_rdev->si_bsize_phys;
|
||||
if (sb->st_blksize < BLKDEV_IOSIZE)
|
||||
sb->st_blksize = BLKDEV_IOSIZE;
|
||||
} else {
|
||||
sb->st_blksize = PAGE_SIZE;
|
||||
}
|
||||
sb->st_blksize = PAGE_SIZE;
|
||||
|
||||
sb->st_flags = vap->va_flags;
|
||||
if (suser(td))
|
||||
|
@ -82,7 +82,8 @@ struct bufobj {
|
||||
struct bufv bo_dirty; /* i Dirty buffers */
|
||||
long bo_numoutput; /* i Writes in progress */
|
||||
u_int bo_flag; /* i Flags */
|
||||
struct buf_ops *bo_ops; /* - buffer operatoins */
|
||||
struct buf_ops *bo_ops; /* - Buffer operations */
|
||||
int bo_bsize; /* - Block size for i/o */
|
||||
struct vm_object *bo_object; /* v Place to store VM object */
|
||||
};
|
||||
|
||||
|
@ -446,7 +446,7 @@ ffs_rawread(struct vnode *vp,
|
||||
|
||||
/* Only handle sector aligned reads */
|
||||
ip = VTOI(vp);
|
||||
secsize = ip->i_devvp->v_rdev->si_bsize_phys;
|
||||
secsize = ip->i_devvp->v_bufobj.bo_bsize;
|
||||
if ((uio->uio_offset & (secsize - 1)) == 0 &&
|
||||
(uio->uio_resid & (secsize - 1)) == 0) {
|
||||
|
||||
|
@ -1242,6 +1242,7 @@ ffs_vget(mp, ino, flags, vpp)
|
||||
fs = ump->um_fs;
|
||||
vp->v_vnlock->lk_flags |= LK_CANRECURSE;
|
||||
vp->v_data = ip;
|
||||
vp->v_bufobj.bo_bsize = fs->fs_bsize;
|
||||
ip->i_vnode = vp;
|
||||
ip->i_ump = ump;
|
||||
ip->i_fs = fs;
|
||||
|
@ -798,7 +798,7 @@ vnode_pager_generic_getpages(vp, m, bytecount, reqpage)
|
||||
* round up physical size for real devices.
|
||||
*/
|
||||
if (dp->v_type == VBLK || dp->v_type == VCHR) {
|
||||
int secmask = dp->v_rdev->si_bsize_phys - 1;
|
||||
int secmask = dp->v_bufobj.bo_bsize - 1;
|
||||
KASSERT(secmask < PAGE_SIZE, ("vnode_pager_generic_getpages: sector size %d too large\n", secmask + 1));
|
||||
size = (size + secmask) & ~secmask;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user