Use the same algorithm as ffs for generation numbers.

This commit is contained in:
Bruce Evans 1997-12-02 11:42:28 +00:00
parent 23906a782b
commit 1dd78fb7ef
5 changed files with 9 additions and 24 deletions

View File

@ -58,8 +58,6 @@
#include <gnu/ext2fs/fs.h>
#include <gnu/ext2fs/ext2_extern.h>
extern u_long nextgennumber;
static void ext2_fserr __P((struct ext2_sb_info *, u_int, char *));
/*
@ -426,9 +424,8 @@ ext2_valloc(pvp, mode, cred, vpp)
* Set up a new generation number for this inode.
* XXX check if this makes sense in ext2
*/
if (++nextgennumber < (u_long)time.tv_sec)
nextgennumber = time.tv_sec;
ip->i_gen = nextgennumber;
if (ip->i_gen == 0 || ++ip->i_gen == 0)
ip->i_gen = random() / 2 + 1;
/*
printf("ext2_valloc: allocated inode %d\n", ino);
*/

View File

@ -102,7 +102,6 @@ VFS_SET(ext2fs_vfsops, ext2fs, MOUNT_EXT2FS, 0);
#define bsd_malloc malloc
#define bsd_free free
extern u_long nextgennumber;
static int ext2fs_inode_hash_lock;
static int compute_sb_data __P((struct vnode * devvp,
@ -1005,9 +1004,7 @@ printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino)));
* already have one. This should only happen on old filesystems.
*/
if (ip->i_gen == 0) {
if (++nextgennumber < (u_long)time.tv_sec)
nextgennumber = time.tv_sec;
ip->i_gen = nextgennumber;
ip->i_gen = random() / 2 + 1;
if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
ip->i_flag |= IN_MODIFIED;
}

View File

@ -58,8 +58,6 @@
#include <gnu/ext2fs/fs.h>
#include <gnu/ext2fs/ext2_extern.h>
extern u_long nextgennumber;
static void ext2_fserr __P((struct ext2_sb_info *, u_int, char *));
/*
@ -426,9 +424,8 @@ ext2_valloc(pvp, mode, cred, vpp)
* Set up a new generation number for this inode.
* XXX check if this makes sense in ext2
*/
if (++nextgennumber < (u_long)time.tv_sec)
nextgennumber = time.tv_sec;
ip->i_gen = nextgennumber;
if (ip->i_gen == 0 || ++ip->i_gen == 0)
ip->i_gen = random() / 2 + 1;
/*
printf("ext2_valloc: allocated inode %d\n", ino);
*/

View File

@ -102,7 +102,6 @@ VFS_SET(ext2fs_vfsops, ext2fs, MOUNT_EXT2FS, 0);
#define bsd_malloc malloc
#define bsd_free free
extern u_long nextgennumber;
static int ext2fs_inode_hash_lock;
static int compute_sb_data __P((struct vnode * devvp,
@ -1005,9 +1004,7 @@ printf("ext2_vget(%d) dbn= %d ", ino, fsbtodb(fs, ino_to_fsba(fs, ino)));
* already have one. This should only happen on old filesystems.
*/
if (ip->i_gen == 0) {
if (++nextgennumber < (u_long)time.tv_sec)
nextgennumber = time.tv_sec;
ip->i_gen = nextgennumber;
ip->i_gen = random() / 2 + 1;
if ((vp->v_mount->mnt_flag & MNT_RDONLY) == 0)
ip->i_flag |= IN_MODIFIED;
}

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)lfs_alloc.c 8.7 (Berkeley) 5/14/95
* $Id: lfs_alloc.c,v 1.18 1997/10/16 10:49:41 phk Exp $
* $Id: lfs_alloc.c,v 1.19 1997/10/16 11:58:30 phk Exp $
*/
#include "opt_quota.h"
@ -55,8 +55,6 @@
#include <ufs/lfs/lfs.h>
#include <ufs/lfs/lfs_extern.h>
extern u_long nextgennumber;
/* Allocate a new inode. */
/* ARGSUSED */
int
@ -128,9 +126,8 @@ lfs_valloc(pvp, mode, cred, vpp)
ip->i_din.di_inumber = new_ino;
/* Set a new generation number for this inode. */
if (++nextgennumber < (u_long)time.tv_sec)
nextgennumber = time.tv_sec;
ip->i_gen = nextgennumber;
if (ip->i_gen == 0 || ++ip->i_gen == 0)
ip->i_gen = random() / 2 + 1;
/* Insert into the inode hash table. */
ufs_ihashins(ip);