Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Apr 2016 03:21:01 +0000 (UTC)
From:      Kevin Lo <kevlo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r297479 - head/sys/fs/ext2fs
Message-ID:  <201604010321.u313L1bP059226@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevlo
Date: Fri Apr  1 03:21:01 2016
New Revision: 297479
URL: https://svnweb.freebsd.org/changeset/base/297479

Log:
  Update comment: Linux does set a randomized generation number of an inode
  on ext2/3/4.
  
  While here use arc4random() instead of random().
  
  Reviewed by:	pfg
  MFC after:	3 days

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- head/sys/fs/ext2fs/ext2_alloc.c	Fri Apr  1 01:39:44 2016	(r297478)
+++ head/sys/fs/ext2fs/ext2_alloc.c	Fri Apr  1 03:21:01 2016	(r297479)
@@ -406,10 +406,8 @@ ext2_valloc(struct vnode *pvp, int mode,
 
 	/*
 	 * Set up a new generation number for this inode.
-	 * XXX check if this makes sense in ext2
 	 */
-	if (ip->i_gen == 0 || ++ip->i_gen == 0)
-		ip->i_gen = random() / 2 + 1;
+	ip->i_gen = arc4random();
 
 	vfs_timestamp(&ts);
 	ip->i_birthtime = ts.tv_sec;



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