diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-12 09:56:43 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 20:05:48 -0500 |
commit | 79739565e15f2adbc482207a0800fc127c84d1a0 (patch) | |
tree | 10d61f5a31e4de5c90a6c9c10f0f0bc8e68d1550 /fs/nilfs2/the_nilfs.c | |
parent | 5731e191f254af9135ad843119804a500528ecf3 (diff) |
nilfs2: separate constructor of metadata files
This will displace nilfs_mdt_new() constructor with individual
metadata file constructors like nilfs_dat_new(), new_sufile_new(),
nilfs_cpfile_new(), and nilfs_ifile_new().
This makes it possible for each metadata file to have own
intialization code.
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 | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c index a80bbb7c5afc..d4a731fd4e32 100644 --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c | |||
@@ -166,7 +166,6 @@ void put_nilfs(struct the_nilfs *nilfs) | |||
166 | static int nilfs_load_super_root(struct the_nilfs *nilfs, | 166 | static int nilfs_load_super_root(struct the_nilfs *nilfs, |
167 | struct nilfs_sb_info *sbi, sector_t sr_block) | 167 | struct nilfs_sb_info *sbi, sector_t sr_block) |
168 | { | 168 | { |
169 | static struct lock_class_key dat_lock_key; | ||
170 | struct buffer_head *bh_sr; | 169 | struct buffer_head *bh_sr; |
171 | struct nilfs_super_root *raw_sr; | 170 | struct nilfs_super_root *raw_sr; |
172 | struct nilfs_super_block **sbp = nilfs->ns_sbp; | 171 | struct nilfs_super_block **sbp = nilfs->ns_sbp; |
@@ -187,38 +186,23 @@ static int nilfs_load_super_root(struct the_nilfs *nilfs, | |||
187 | inode_size = nilfs->ns_inode_size; | 186 | inode_size = nilfs->ns_inode_size; |
188 | 187 | ||
189 | err = -ENOMEM; | 188 | err = -ENOMEM; |
190 | nilfs->ns_dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO, 0); | 189 | nilfs->ns_dat = nilfs_dat_new(nilfs, dat_entry_size); |
191 | if (unlikely(!nilfs->ns_dat)) | 190 | if (unlikely(!nilfs->ns_dat)) |
192 | goto failed; | 191 | goto failed; |
193 | 192 | ||
194 | nilfs->ns_gc_dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO, 0); | 193 | nilfs->ns_gc_dat = nilfs_dat_new(nilfs, dat_entry_size); |
195 | if (unlikely(!nilfs->ns_gc_dat)) | 194 | if (unlikely(!nilfs->ns_gc_dat)) |
196 | goto failed_dat; | 195 | goto failed_dat; |
197 | 196 | ||
198 | nilfs->ns_cpfile = nilfs_mdt_new(nilfs, NULL, NILFS_CPFILE_INO, 0); | 197 | nilfs->ns_cpfile = nilfs_cpfile_new(nilfs, checkpoint_size); |
199 | if (unlikely(!nilfs->ns_cpfile)) | 198 | if (unlikely(!nilfs->ns_cpfile)) |
200 | goto failed_gc_dat; | 199 | goto failed_gc_dat; |
201 | 200 | ||
202 | nilfs->ns_sufile = nilfs_mdt_new(nilfs, NULL, NILFS_SUFILE_INO, 0); | 201 | nilfs->ns_sufile = nilfs_sufile_new(nilfs, segment_usage_size); |
203 | if (unlikely(!nilfs->ns_sufile)) | 202 | if (unlikely(!nilfs->ns_sufile)) |
204 | goto failed_cpfile; | 203 | goto failed_cpfile; |
205 | 204 | ||
206 | err = nilfs_palloc_init_blockgroup(nilfs->ns_dat, dat_entry_size); | ||
207 | if (unlikely(err)) | ||
208 | goto failed_sufile; | ||
209 | |||
210 | err = nilfs_palloc_init_blockgroup(nilfs->ns_gc_dat, dat_entry_size); | ||
211 | if (unlikely(err)) | ||
212 | goto failed_sufile; | ||
213 | |||
214 | lockdep_set_class(&NILFS_MDT(nilfs->ns_dat)->mi_sem, &dat_lock_key); | ||
215 | lockdep_set_class(&NILFS_MDT(nilfs->ns_gc_dat)->mi_sem, &dat_lock_key); | ||
216 | |||
217 | nilfs_mdt_set_shadow(nilfs->ns_dat, nilfs->ns_gc_dat); | 205 | nilfs_mdt_set_shadow(nilfs->ns_dat, nilfs->ns_gc_dat); |
218 | nilfs_mdt_set_entry_size(nilfs->ns_cpfile, checkpoint_size, | ||
219 | sizeof(struct nilfs_cpfile_header)); | ||
220 | nilfs_mdt_set_entry_size(nilfs->ns_sufile, segment_usage_size, | ||
221 | sizeof(struct nilfs_sufile_header)); | ||
222 | 206 | ||
223 | err = nilfs_mdt_read_inode_direct( | 207 | err = nilfs_mdt_read_inode_direct( |
224 | nilfs->ns_dat, bh_sr, NILFS_SR_DAT_OFFSET(inode_size)); | 208 | nilfs->ns_dat, bh_sr, NILFS_SR_DAT_OFFSET(inode_size)); |