From owner-freebsd-arch Sat Jan 26 10:22:45 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id EC2D737B402 for ; Sat, 26 Jan 2002 10:22:40 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id FAA21078; Sun, 27 Jan 2002 05:17:26 +1100 Date: Sun, 27 Jan 2002 05:19:11 +1100 (EST) From: Bruce Evans X-X-Sender: To: Max Khon Cc: Cy Schubert - ITSD Open Systems Group , Poul-Henning Kamp , Subject: Re: request for review In-Reply-To: <20020121182450.A91754@iclub.nsu.ru> Message-ID: <20020127050617.N34813-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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