diff options
author | kevlo <kevlo@FreeBSD.org> | 2016-04-14 01:24:00 +0000 |
---|---|---|
committer | kevlo <kevlo@FreeBSD.org> | 2016-04-14 01:24:00 +0000 |
commit | a2a5fb1296917bfec1a728f61262c100847c7bef (patch) | |
tree | 811c70437bca7cf5d9565380003093cb880f481f /sys/fs | |
parent | a977dbd919a61168a6d1991ab2d4c3754b7774ee (diff) | |
download | FreeBSD-src-a2a5fb1296917bfec1a728f61262c100847c7bef.zip FreeBSD-src-a2a5fb1296917bfec1a728f61262c100847c7bef.tar.gz |
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
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/ext2fs/ext2_alloc.c | 4 | ||||
-rw-r--r-- | sys/fs/ext2fs/ext2_vfsops.c | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/sys/fs/ext2fs/ext2_alloc.c b/sys/fs/ext2fs/ext2_alloc.c index 2bf7772..448b051 100644 --- a/sys/fs/ext2fs/ext2_alloc.c +++ b/sys/fs/ext2fs/ext2_alloc.c @@ -406,10 +406,8 @@ ext2_valloc(struct vnode *pvp, int mode, struct ucred *cred, struct vnode **vpp) /* * 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; diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index fab98a5..a1f3c51 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -308,8 +308,8 @@ ext2_check_sb_compat(struct ext2fs *es, struct cdev *dev, int ronly) } /* - * 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 mount *mp) /* * 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), |