diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-03-08 21:05:08 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2011-03-08 21:05:08 -0500 |
commit | 9b1fc4e4973469dd3fab27ba5d78eca1cd5c13fe (patch) | |
tree | 0f51872d41cbc1e43db2fafab0074c107dfce7e7 /fs/nilfs2/the_nilfs.c | |
parent | 693dd321222f03b17668f88ceb0f7d518900191e (diff) |
nilfs2: move next generation counter into nilfs object
Moves s_next_generation counter and a spinlock protecting it to nilfs
object from nilfs_sb_info structure.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/the_nilfs.c')
-rw-r--r-- | fs/nilfs2/the_nilfs.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index 40239a932dec..1bf695e887a7 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/blkdev.h> | 26 | #include <linux/blkdev.h> |
27 | #include <linux/backing-dev.h> | 27 | #include <linux/backing-dev.h> |
28 | #include <linux/random.h> | ||
28 | #include <linux/crc32.h> | 29 | #include <linux/crc32.h> |
29 | #include "nilfs.h" | 30 | #include "nilfs.h" |
30 | #include "segment.h" | 31 | #include "segment.h" |
@@ -78,6 +79,7 @@ struct the_nilfs *alloc_nilfs(struct block_device *bdev) | |||
78 | INIT_LIST_HEAD(&nilfs->ns_dirty_files); | 79 | INIT_LIST_HEAD(&nilfs->ns_dirty_files); |
79 | INIT_LIST_HEAD(&nilfs->ns_gc_inodes); | 80 | INIT_LIST_HEAD(&nilfs->ns_gc_inodes); |
80 | spin_lock_init(&nilfs->ns_inode_lock); | 81 | spin_lock_init(&nilfs->ns_inode_lock); |
82 | spin_lock_init(&nilfs->ns_next_gen_lock); | ||
81 | spin_lock_init(&nilfs->ns_last_segment_lock); | 83 | spin_lock_init(&nilfs->ns_last_segment_lock); |
82 | nilfs->ns_cptree = RB_ROOT; | 84 | nilfs->ns_cptree = RB_ROOT; |
83 | spin_lock_init(&nilfs->ns_cptree_lock); | 85 | spin_lock_init(&nilfs->ns_cptree_lock); |
@@ -593,6 +595,9 @@ int init_nilfs(struct the_nilfs *nilfs, struct nilfs_sb_info *sbi, char *data) | |||
593 | nilfs->ns_blocksize_bits = sb->s_blocksize_bits; | 595 | nilfs->ns_blocksize_bits = sb->s_blocksize_bits; |
594 | nilfs->ns_blocksize = blocksize; | 596 | nilfs->ns_blocksize = blocksize; |
595 | 597 | ||
598 | get_random_bytes(&nilfs->ns_next_generation, | ||
599 | sizeof(nilfs->ns_next_generation)); | ||
600 | |||
596 | err = nilfs_store_disk_layout(nilfs, sbp); | 601 | err = nilfs_store_disk_layout(nilfs, sbp); |
597 | if (err) | 602 | if (err) |
598 | goto failed_sbh; | 603 | goto failed_sbh; |