aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/dat.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-12 09:56:43 -0500
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-19 20:05:48 -0500
commit79739565e15f2adbc482207a0800fc127c84d1a0 (patch)
tree10d61f5a31e4de5c90a6c9c10f0f0bc8e68d1550 /fs/nilfs2/dat.c
parent5731e191f254af9135ad843119804a500528ecf3 (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/dat.c')
-rw-r--r--fs/nilfs2/dat.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c
index 1ff8e15bd36b..239a42234999 100644
--- a/fs/nilfs2/dat.c
+++ b/fs/nilfs2/dat.c
@@ -425,3 +425,26 @@ ssize_t nilfs_dat_get_vinfo(struct inode *dat, void *buf, unsigned visz,
425 425
426 return nvi; 426 return nvi;
427} 427}
428
429/**
430 * nilfs_dat_new - create dat file
431 * @nilfs: nilfs object
432 * @entry_size: size of a dat entry
433 */
434struct inode *nilfs_dat_new(struct the_nilfs *nilfs, size_t entry_size)
435{
436 static struct lock_class_key dat_lock_key;
437 struct inode *dat;
438 int err;
439
440 dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO, 0);
441 if (dat) {
442 err = nilfs_palloc_init_blockgroup(dat, entry_size);
443 if (unlikely(err)) {
444 nilfs_mdt_destroy(dat);
445 return NULL;
446 }
447 lockdep_set_class(&NILFS_MDT(dat)->mi_sem, &dat_lock_key);
448 }
449 return dat;
450}