File tree Expand file tree Collapse file tree 3 files changed +2
-15
lines changed Expand file tree Collapse file tree 3 files changed +2
-15
lines changed Original file line number Diff line number Diff line change 15
15
#include <linux/writeback.h>
16
16
#include <linux/uio.h>
17
17
#include <linux/fiemap.h>
18
+ #include <linux/random.h>
18
19
#include "nilfs.h"
19
20
#include "btnode.h"
20
21
#include "segment.h"
@@ -320,7 +321,6 @@ static int nilfs_insert_inode_locked(struct inode *inode,
320
321
struct inode * nilfs_new_inode (struct inode * dir , umode_t mode )
321
322
{
322
323
struct super_block * sb = dir -> i_sb ;
323
- struct the_nilfs * nilfs = sb -> s_fs_info ;
324
324
struct inode * inode ;
325
325
struct nilfs_inode_info * ii ;
326
326
struct nilfs_root * root ;
@@ -381,9 +381,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
381
381
/* ii->i_dir_acl = 0; */
382
382
ii -> i_dir_start_lookup = 0 ;
383
383
nilfs_set_inode_flags (inode );
384
- spin_lock (& nilfs -> ns_next_gen_lock );
385
- inode -> i_generation = nilfs -> ns_next_generation ++ ;
386
- spin_unlock (& nilfs -> ns_next_gen_lock );
384
+ inode -> i_generation = get_random_u32 ();
387
385
if (nilfs_insert_inode_locked (inode , root , ino ) < 0 ) {
388
386
err = - EIO ;
389
387
goto failed_after_creation ;
Original file line number Diff line number Diff line change 12
12
#include <linux/slab.h>
13
13
#include <linux/blkdev.h>
14
14
#include <linux/backing-dev.h>
15
- #include <linux/random.h>
16
15
#include <linux/log2.h>
17
16
#include <linux/crc32.h>
18
17
#include "nilfs.h"
@@ -69,7 +68,6 @@ struct the_nilfs *alloc_nilfs(struct super_block *sb)
69
68
INIT_LIST_HEAD (& nilfs -> ns_dirty_files );
70
69
INIT_LIST_HEAD (& nilfs -> ns_gc_inodes );
71
70
spin_lock_init (& nilfs -> ns_inode_lock );
72
- spin_lock_init (& nilfs -> ns_next_gen_lock );
73
71
spin_lock_init (& nilfs -> ns_last_segment_lock );
74
72
nilfs -> ns_cptree = RB_ROOT ;
75
73
spin_lock_init (& nilfs -> ns_cptree_lock );
@@ -754,9 +752,6 @@ int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb)
754
752
nilfs -> ns_blocksize_bits = sb -> s_blocksize_bits ;
755
753
nilfs -> ns_blocksize = blocksize ;
756
754
757
- get_random_bytes (& nilfs -> ns_next_generation ,
758
- sizeof (nilfs -> ns_next_generation ));
759
-
760
755
err = nilfs_store_disk_layout (nilfs , sbp );
761
756
if (err )
762
757
goto failed_sbh ;
Original file line number Diff line number Diff line change 71
71
* @ns_dirty_files: list of dirty files
72
72
* @ns_inode_lock: lock protecting @ns_dirty_files
73
73
* @ns_gc_inodes: dummy inodes to keep live blocks
74
- * @ns_next_generation: next generation number for inodes
75
- * @ns_next_gen_lock: lock protecting @ns_next_generation
76
74
* @ns_mount_opt: mount options
77
75
* @ns_resuid: uid for reserved blocks
78
76
* @ns_resgid: gid for reserved blocks
@@ -161,10 +159,6 @@ struct the_nilfs {
161
159
/* GC inode list */
162
160
struct list_head ns_gc_inodes ;
163
161
164
- /* Inode allocator */
165
- u32 ns_next_generation ;
166
- spinlock_t ns_next_gen_lock ;
167
-
168
162
/* Mount options */
169
163
unsigned long ns_mount_opt ;
170
164
You can’t perform that action at this time.
0 commit comments