summaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/ifile.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-12 15:56:43 +0100
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-20 02:05:48 +0100
commit79739565e15f2adbc482207a0800fc127c84d1a0 (patch)
tree10d61f5a31e4de5c90a6c9c10f0f0bc8e68d1550 /fs/nilfs2/ifile.c
parentnilfs2: add size option of private object to metadata file allocator (diff)
downloadlinux-79739565e15f2adbc482207a0800fc127c84d1a0.tar.xz
linux-79739565e15f2adbc482207a0800fc127c84d1a0.zip
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/ifile.c')
-rw-r--r--fs/nilfs2/ifile.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c
index de86401f209f..c1c1fd30c315 100644
--- a/fs/nilfs2/ifile.c
+++ b/fs/nilfs2/ifile.c
@@ -148,3 +148,24 @@ int nilfs_ifile_get_inode_block(struct inode *ifile, ino_t ino,
}
return err;
}
+
+/**
+ * nilfs_ifile_new - create inode file
+ * @sbi: nilfs_sb_info struct
+ * @inode_size: size of an inode
+ */
+struct inode *nilfs_ifile_new(struct nilfs_sb_info *sbi, size_t inode_size)
+{
+ struct inode *ifile;
+ int err;
+
+ ifile = nilfs_mdt_new(sbi->s_nilfs, sbi->s_super, NILFS_IFILE_INO, 0);
+ if (ifile) {
+ err = nilfs_palloc_init_blockgroup(ifile, inode_size);
+ if (unlikely(err)) {
+ nilfs_mdt_destroy(ifile);
+ return NULL;
+ }
+ }
+ return ifile;
+}