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 1515#include <linux/writeback.h>
1616#include <linux/uio.h>
1717#include <linux/fiemap.h>
18+ #include <linux/random.h>
1819#include "nilfs.h"
1920#include "btnode.h"
2021#include "segment.h"
@@ -320,7 +321,6 @@ static int nilfs_insert_inode_locked(struct inode *inode,
320321struct inode * nilfs_new_inode (struct inode * dir , umode_t mode )
321322{
322323 struct super_block * sb = dir -> i_sb ;
323- struct the_nilfs * nilfs = sb -> s_fs_info ;
324324 struct inode * inode ;
325325 struct nilfs_inode_info * ii ;
326326 struct nilfs_root * root ;
@@ -381,9 +381,7 @@ struct inode *nilfs_new_inode(struct inode *dir, umode_t mode)
381381 /* ii->i_dir_acl = 0; */
382382 ii -> i_dir_start_lookup = 0 ;
383383 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 ();
387385 if (nilfs_insert_inode_locked (inode , root , ino ) < 0 ) {
388386 err = - EIO ;
389387 goto failed_after_creation ;
Original file line number Diff line number Diff line change 1212#include <linux/slab.h>
1313#include <linux/blkdev.h>
1414#include <linux/backing-dev.h>
15- #include <linux/random.h>
1615#include <linux/log2.h>
1716#include <linux/crc32.h>
1817#include "nilfs.h"
@@ -69,7 +68,6 @@ struct the_nilfs *alloc_nilfs(struct super_block *sb)
6968 INIT_LIST_HEAD (& nilfs -> ns_dirty_files );
7069 INIT_LIST_HEAD (& nilfs -> ns_gc_inodes );
7170 spin_lock_init (& nilfs -> ns_inode_lock );
72- spin_lock_init (& nilfs -> ns_next_gen_lock );
7371 spin_lock_init (& nilfs -> ns_last_segment_lock );
7472 nilfs -> ns_cptree = RB_ROOT ;
7573 spin_lock_init (& nilfs -> ns_cptree_lock );
@@ -754,9 +752,6 @@ int init_nilfs(struct the_nilfs *nilfs, struct super_block *sb)
754752 nilfs -> ns_blocksize_bits = sb -> s_blocksize_bits ;
755753 nilfs -> ns_blocksize = blocksize ;
756754
757- get_random_bytes (& nilfs -> ns_next_generation ,
758- sizeof (nilfs -> ns_next_generation ));
759-
760755 err = nilfs_store_disk_layout (nilfs , sbp );
761756 if (err )
762757 goto failed_sbh ;
Original file line number Diff line number Diff line change 7171 * @ns_dirty_files: list of dirty files
7272 * @ns_inode_lock: lock protecting @ns_dirty_files
7373 * @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
7674 * @ns_mount_opt: mount options
7775 * @ns_resuid: uid for reserved blocks
7876 * @ns_resgid: gid for reserved blocks
@@ -161,10 +159,6 @@ struct the_nilfs {
161159 /* GC inode list */
162160 struct list_head ns_gc_inodes ;
163161
164- /* Inode allocator */
165- u32 ns_next_generation ;
166- spinlock_t ns_next_gen_lock ;
167-
168162 /* Mount options */
169163 unsigned long ns_mount_opt ;
170164
You can’t perform that action at this time.
0 commit comments