Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jan 2002 05:19:11 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Max Khon <fjoe@iclub.nsu.ru>
Cc:        Cy Schubert - ITSD Open Systems Group <Cy.Schubert@uumail.gov.bc.ca>, Poul-Henning Kamp <phk@critter.freebsd.dk>, <arch@freebsd.org>
Subject:   Re: request for review
Message-ID:  <20020127050617.N34813-100000@gamplex.bde.org>
In-Reply-To: <20020121182450.A91754@iclub.nsu.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
Sorry this reply is late.

On Mon, 21 Jan 2002, Max Khon wrote:

> hi, there!
> On Mon, Jan 21, 2002 at 12:17:49AM +0600, Max Khon wrote:
>
> > ok, what do you think about this patch?
> >
> > Index: vfs_vnops.c
> > ===================================================================
> > RCS file: /home/ncvs/src/sys/kern/vfs_vnops.c,v
> > retrieving revision 1.126
> > diff -u -p -r1.126 vfs_vnops.c
> > --- vfs_vnops.c	13 Jan 2002 11:58:03 -0000	1.126
> > +++ vfs_vnops.c	20 Jan 2002 17:45:38 -0000
> > @@ -571,17 +571,17 @@ vn_stat(vp, sb, td)
> >  	 * Default to zero to catch bogus uses of this field.
> >  	 */
> >
> > -	if (vap->va_type == VREG) {
> > -		sb->st_blksize = vap->va_blocksize;
> > -	} else if (vn_isdisk(vp, NULL)) {
> > +	if (vn_isdisk(vp, NULL)) {
> >  		sb->st_blksize = vp->v_rdev->si_bsize_best;
> >  		if (sb->st_blksize < vp->v_rdev->si_bsize_phys)
> >  			sb->st_blksize = vp->v_rdev->si_bsize_phys;
> >  		if (sb->st_blksize < BLKDEV_IOSIZE)
> >  			sb->st_blksize = BLKDEV_IOSIZE;
> > -	} else {
> > -		sb->st_blksize = 0;
> > -	}
> > +	} else
> > +		sb->st_blksize = vap->va_blocksize;
> > +
> > +	if (sb->st_blksize == 0)
> > +		sb->st_blksize = PAGE_SIZE;
> >
> >  	sb->st_flags = vap->va_flags;
> >  	if (suser_xxx(td->td_proc->p_ucred, 0, 0))

I like this (better than the partial version committed in rev.1.128),
except it adds 2 style bugs and doesn't remove 1:

(1) The comment "Default to zero to catch bogus uses of this field." is
    now wrong.  (The comment in rev.1.128 is not much better.  It says
    PAGE_SIZE instead of 0, but doesn't say anything useful.)
(2) The comment before the code is separated from the code by a blank
    line.  This makes it appear to describe null code.
(3) The scope of the comment is made even less clear by adding a blank
    line in the code.

> btw NetBSD/OpenBSD have the following code in ufs_getattr():
>
>         /* this doesn't belong here */
> 	if (vp->v_type == VBLK)
> 		vap->va_blocksize = BLKDEV_IOSIZE;
> 	else if (vp->v_type == VCHR)
> 		vap->va_blocksize = MAXBSIZE;
> 	else
> 		vap->va_blocksize = vp->v_mount->mnt_stat.f_iosize;

That's because they haven't changed the 4.4BSD-Lite here code yet :-).

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020127050617.N34813-100000>