From fd9cb11e537843a4c4e049de57de82546b4e0f15 Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 3 Sep 1999 05:16:59 +0000 Subject: Revert a bunch of contraversial changes by PHK. After a quick think and discussion among various people some form of some of these changes will probably be recommitted. The reversion requested was requested by dg while discussions proceed. PHK has indicated that he can live with this, and it has been agreed that some form of some of these changes may return shortly after further discussion. --- sys/kern/vfs_vnops.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'sys/kern/vfs_vnops.c') diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index c64a77e..0a08938 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -429,31 +429,23 @@ vn_stat(vp, sb, p) sb->st_atimespec = vap->va_atime; sb->st_mtimespec = vap->va_mtime; sb->st_ctimespec = vap->va_ctime; - /* - * According to www.opengroup.org, the meaning of st_blksize is - * "a filesystem-specific preferred I/O block size for this - * object. In some filesystem types, this may vary from file - * to file" - * Default to zero to catch bogus uses of this field. + * For block and char device nodes we don't really care + * about what the filesystem told us, we want to know + * what the device told us */ - sb->st_blksize = 0; - - if (vp->v_type == VREG) - sb->st_blksize = vap->va_blocksize; - - /* - * For disks we can say something sensible. We report the max - * size because we prefer few big transfers than many small. - * XXX: Only reliable if the disk is opened. - * XXX: Use vn_isdisk when it allows VCHR too - */ - if ((vp->v_type == VBLK || vp->v_type == VCHR) && - devsw(vp->v_rdev) && (devsw(vp->v_rdev)->d_flags & D_DISK)) + switch (vap->va_type) { + case VBLK: + sb->st_blksize = vp->v_rdev->si_bsize_best; + break; + case VCHR: sb->st_blksize = vp->v_rdev->si_bsize_max; - + break; + default: + sb->st_blksize = vap->va_blocksize; + break; + } sb->st_flags = vap->va_flags; - if (suser_xxx(p->p_ucred, 0, 0)) sb->st_gen = 0; else -- cgit v1.1