Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jul 2013 21:43:40 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252484 - head/sys/ufs/ffs
Message-ID:  <201307012143.r61Lhemi067176@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Mon Jul  1 21:43:40 2013
New Revision: 252484
URL: http://svnweb.freebsd.org/changeset/base/252484

Log:
  Change i_gen in UFS to an unsigned type.
  
  Revert the simplification of the i_gen calculation.
  It is still a good idea to avoid zero values and for the case
  of old filesystems there is probably no advantage in using
  the complete 32 bits anyways.
  
  Discussed with:	bde
  MFC after:	4 weeks

Modified:
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- head/sys/ufs/ffs/ffs_vfsops.c	Mon Jul  1 21:41:12 2013	(r252483)
+++ head/sys/ufs/ffs/ffs_vfsops.c	Mon Jul  1 21:43:40 2013	(r252484)
@@ -1791,7 +1791,7 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags
 	 * already have one. This should only happen on old filesystems.
 	 */
 	if (ip->i_gen == 0) {
-		ip->i_gen = arc4random();
+		ip->i_gen = arc4random()/2 + 1;
 		if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0) {
 			ip->i_flag |= IN_MODIFIED;
 			DIP_SET(ip, i_gen, ip->i_gen);



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