svn commit: r252484 - head/sys/ufs/ffs

Pedro F. Giffuni pfg at FreeBSD.org
Mon Jul 1 21:43:40 UTC 2013


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);


More information about the svn-src-all mailing list