Move the special-casing of stat(2)->st_blksize for device files

from UFS to the generic level.  For chr/blk devices we don't care
about the blocksize of the filesystem, we want what the device
asked for.
This commit is contained in:
Poul-Henning Kamp 1999-08-13 10:56:07 +00:00
parent 608bb3ffdf
commit 3a965c0db0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=49682
2 changed files with 17 additions and 17 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94
* $Id: vfs_vnops.c,v 1.71 1999/07/26 06:25:18 alc Exp $
* $Id: vfs_vnops.c,v 1.72 1999/08/04 18:53:49 green Exp $
*/
#include <sys/param.h>
@ -428,7 +428,20 @@ vn_stat(vp, sb, p)
sb->st_atimespec = vap->va_atime;
sb->st_mtimespec = vap->va_mtime;
sb->st_ctimespec = vap->va_ctime;
sb->st_blksize = vap->va_blocksize;
/*
* 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
*/
switch (vap->va_type) {
case VBLK:
sb->st_blksize = vp->v_rdev->si_bsize_best;
case VCHR:
sb->st_blksize = vp->v_rdev->si_bsize_max;
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;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
* $Id: ufs_vnops.c,v 1.117 1999/08/08 18:43:04 phk Exp $
* $Id: ufs_vnops.c,v 1.118 1999/08/13 10:10:12 phk Exp $
*/
#include "opt_quota.h"
@ -396,20 +396,7 @@ ufs_getattr(ap)
vap->va_ctime.tv_nsec = ip->i_ctimensec;
vap->va_flags = ip->i_flags;
vap->va_gen = ip->i_gen;
/*
* Use the information contained in v_rdev for VBLK and VCHR
* vnodes, and in the underlying mount point for (typically) VREG
* vnodes. Note that vp->v_specmountpoint can be NULL.
*/
if (vp->v_type == VBLK) {
vap->va_blocksize = vp->v_rdev->si_bsize_best;
} else if (vp->v_type == VCHR) {
vap->va_blocksize = vp->v_rdev->si_bsize_max;
} else {
vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize;
}
vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize;
vap->va_bytes = dbtob((u_quad_t)ip->i_blocks);
vap->va_type = IFTOVT(ip->i_mode);
vap->va_filerev = ip->i_modrev;