aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/cpfile.c
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-09-04 23:20:59 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-10-22 20:24:38 -0400
commitf1e89c86fdd0f5e59f6768146c86437934202033 (patch)
treec5ba8766a3a029f0c10d6d0d09a57a7e28b7a51b /fs/nilfs2/cpfile.c
parentc1c1d7092072093ad960db2f6c08f06705c57fa4 (diff)
nilfs2: use iget for all metadata files
This makes use of iget5_locked to allocate or get inode for metadata files to stop using own inode allocator. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/cpfile.c')
-rw-r--r--fs/nilfs2/cpfile.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c
index 18737818db63..03de1da8795b 100644
--- a/fs/nilfs2/cpfile.c
+++ b/fs/nilfs2/cpfile.c
@@ -933,27 +933,40 @@ int nilfs_cpfile_get_stat(struct inode *cpfile, struct nilfs_cpstat *cpstat)
933} 933}
934 934
935/** 935/**
936 * nilfs_cpfile_read - read cpfile inode 936 * nilfs_cpfile_read - read or get cpfile inode
937 * @cpfile: cpfile inode 937 * @sb: super block instance
938 * @raw_inode: on-disk cpfile inode
939 */
940int nilfs_cpfile_read(struct inode *cpfile, struct nilfs_inode *raw_inode)
941{
942 return nilfs_read_inode_common(cpfile, raw_inode);
943}
944
945/**
946 * nilfs_cpfile_new - create cpfile
947 * @nilfs: nilfs object
948 * @cpsize: size of a checkpoint entry 938 * @cpsize: size of a checkpoint entry
939 * @raw_inode: on-disk cpfile inode
940 * @inodep: buffer to store the inode
949 */ 941 */
950struct inode *nilfs_cpfile_new(struct the_nilfs *nilfs, size_t cpsize) 942int nilfs_cpfile_read(struct super_block *sb, size_t cpsize,
943 struct nilfs_inode *raw_inode, struct inode **inodep)
951{ 944{
952 struct inode *cpfile; 945 struct inode *cpfile;
946 int err;
953 947
954 cpfile = nilfs_mdt_new(nilfs, NULL, NILFS_CPFILE_INO, 0); 948 cpfile = nilfs_iget_locked(sb, NULL, NILFS_CPFILE_INO);
955 if (cpfile) 949 if (unlikely(!cpfile))
956 nilfs_mdt_set_entry_size(cpfile, cpsize, 950 return -ENOMEM;
957 sizeof(struct nilfs_cpfile_header)); 951 if (!(cpfile->i_state & I_NEW))
958 return cpfile; 952 goto out;
953
954 err = nilfs_mdt_init(cpfile, NILFS_MDT_GFP, 0);
955 if (err)
956 goto failed;
957
958 nilfs_mdt_set_entry_size(cpfile, cpsize,
959 sizeof(struct nilfs_cpfile_header));
960
961 err = nilfs_read_inode_common(cpfile, raw_inode);
962 if (err)
963 goto failed;
964
965 unlock_new_inode(cpfile);
966 out:
967 *inodep = cpfile;
968 return 0;
969 failed:
970 iget_failed(cpfile);
971 return err;
959} 972}