From owner-freebsd-fs@FreeBSD.ORG Thu Sep 11 14:03:54 2008 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8011A106566B for ; Thu, 11 Sep 2008 14:03:54 +0000 (UTC) (envelope-from jh@saunalahti.fi) Received: from emh01.mail.saunalahti.fi (emh01.mail.saunalahti.fi [62.142.5.107]) by mx1.freebsd.org (Postfix) with ESMTP id 334F08FC15 for ; Thu, 11 Sep 2008 14:03:54 +0000 (UTC) (envelope-from jh@saunalahti.fi) Received: from saunalahti-vams (vs3-12.mail.saunalahti.fi [62.142.5.96]) by emh01-2.mail.saunalahti.fi (Postfix) with SMTP id DA2321ABCB; Thu, 11 Sep 2008 17:03:52 +0300 (EEST) Received: from emh01.mail.saunalahti.fi ([62.142.5.107]) by vs3-12.mail.saunalahti.fi ([62.142.5.96]) with SMTP (gateway) id A06399C9241; Thu, 11 Sep 2008 17:03:52 +0300 Received: from a91-153-122-179.elisa-laajakaista.fi (a91-153-122-179.elisa-laajakaista.fi [91.153.122.179]) by emh01.mail.saunalahti.fi (Postfix) with SMTP id 8D14B4BBB8; Thu, 11 Sep 2008 17:03:50 +0300 (EEST) Date: Thu, 11 Sep 2008 17:03:50 +0300 From: Jaakko Heinonen To: Bruce Evans Message-ID: <20080911140349.GA2221@a91-153-122-179.elisa-laajakaista.fi> References: <200806020800.m528038T072838@freefall.freebsd.org> <20080722075718.GA1881@a91-153-120-204.elisa-laajakaista.fi> <20080722215249.K17453@delplex.bde.org> <20080723103424.GA1856@a91-153-120-204.elisa-laajakaista.fi> <20080724000618.Q16961@besplex.bde.org> <20080725072314.GA807@a91-153-120-204.elisa-laajakaista.fi> <20080725192315.D27178@delplex.bde.org> <20080903160736.GA12587@a91-153-122-179.elisa-laajakaista.fi> <20080909204354.Q3089@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080909204354.Q3089@besplex.bde.org> User-Agent: Mutt/1.5.18 (2008-05-17) X-Antivirus: VAMS Cc: freebsd-fs@freebsd.org Subject: Re: birthtime initialization X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Sep 2008 14:03:54 -0000 On 2008-09-09, Bruce Evans wrote: > > @@ -703,6 +703,17 @@ vn_stat(vp, sb, active_cred, file_cred, > > + vap->va_rdev = VNOVAL; > > Shouldn't this be NODEV? NODEV is ((dev_t)-1) and VNOVAL is plain (-1), > so their values are identical after assignment to va_rdev... Yes, it's probably better to use NODEV here... > > - sb->st_rdev = vap->va_rdev; > > + if (vap->va_rdev == VNOVAL) > > + sb->st_rdev = NODEV; > > + else > > + sb->st_rdev = vap->va_rdev; ...and leave out this change. > ... this change seems to have no effect on machines with 32-bit 2's complement > ints and to be wrong on other machines. Assignment of VNOVAL to va_rdev > changes its value from -1 to 0xFFFFFFFFU, so it can only compare equal > to VNOVAL if int has the same size as dev_t or there is stronger magic. > When the comparision is fixed to compare with the assigned value > (dev_t)VNOVAL == (dev_t)(-1) == NODEV, it is clear that the change has > no effect. Some file systems seem to have vap->va_rdev != VNOVAL comparisons in VOP_SETATTR(). Thanks. -- Jaakko