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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to