Author: kevlo
Date: Thu Apr 14 01:24:00 2016
New Revision: 297950
URL: https://svnweb.freebsd.org/changeset/base/297950

Log:
  MFC r297479, r297695:
  
  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

Modified:
  stable/10/sys/fs/ext2fs/ext2_alloc.c
  stable/10/sys/fs/ext2fs/ext2_vfsops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- stable/10/sys/fs/ext2fs/ext2_alloc.c        Thu Apr 14 01:20:15 2016        
(r297949)
+++ stable/10/sys/fs/ext2fs/ext2_alloc.c        Thu Apr 14 01:24:00 2016        
(r297950)
@@ -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;

Modified: stable/10/sys/fs/ext2fs/ext2_vfsops.c
==============================================================================
--- stable/10/sys/fs/ext2fs/ext2_vfsops.c       Thu Apr 14 01:20:15 2016        
(r297949)
+++ stable/10/sys/fs/ext2fs/ext2_vfsops.c       Thu Apr 14 01:24:00 2016        
(r297950)
@@ -308,8 +308,8 @@ ext2_check_sb_compat(struct ext2fs *es, 
 }
 
 /*
- * This computes the fields of the  ext2_sb_info structure from the
- * data in the ext2_super_block structure read in.
+ * This computes the fields of the m_ext2fs structure from the
+ * data in the ext2fs structure read in.
  */
 static int
 compute_sb_data(struct vnode *devvp, struct ext2fs *es,
@@ -600,7 +600,7 @@ ext2_mountfs(struct vnode *devvp, struct
 
        /*
         * I don't know whether this is the right strategy. Note that
-        * we dynamically allocate both an ext2_sb_info and an ext2_super_block
+        * we dynamically allocate both an m_ext2fs and an ext2fs
         * while Linux keeps the super block in a locked buffer.
         */
        ump->um_e2fs = malloc(sizeof(struct m_ext2fs),
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to