diff options
Diffstat (limited to 'fs/nilfs2/ifile.c')
| -rw-r--r-- | fs/nilfs2/ifile.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/fs/nilfs2/ifile.c b/fs/nilfs2/ifile.c index de86401f209f..922d9dd42c8f 100644 --- a/fs/nilfs2/ifile.c +++ b/fs/nilfs2/ifile.c | |||
| @@ -29,6 +29,17 @@ | |||
| 29 | #include "alloc.h" | 29 | #include "alloc.h" |
| 30 | #include "ifile.h" | 30 | #include "ifile.h" |
| 31 | 31 | ||
| 32 | |||
| 33 | struct nilfs_ifile_info { | ||
| 34 | struct nilfs_mdt_info mi; | ||
| 35 | struct nilfs_palloc_cache palloc_cache; | ||
| 36 | }; | ||
| 37 | |||
| 38 | static inline struct nilfs_ifile_info *NILFS_IFILE_I(struct inode *ifile) | ||
| 39 | { | ||
| 40 | return (struct nilfs_ifile_info *)NILFS_MDT(ifile); | ||
| 41 | } | ||
| 42 | |||
| 32 | /** | 43 | /** |
| 33 | * nilfs_ifile_create_inode - create a new disk inode | 44 | * nilfs_ifile_create_inode - create a new disk inode |
| 34 | * @ifile: ifile inode | 45 | * @ifile: ifile inode |
| @@ -148,3 +159,27 @@ int nilfs_ifile_get_inode_block(struct inode *ifile, ino_t ino, | |||
| 148 | } | 159 | } |
| 149 | return err; | 160 | return err; |
| 150 | } | 161 | } |
| 162 | |||
| 163 | /** | ||
| 164 | * nilfs_ifile_new - create inode file | ||
| 165 | * @sbi: nilfs_sb_info struct | ||
| 166 | * @inode_size: size of an inode | ||
| 167 | */ | ||
| 168 | struct inode *nilfs_ifile_new(struct nilfs_sb_info *sbi, size_t inode_size) | ||
| 169 | { | ||
| 170 | struct inode *ifile; | ||
| 171 | int err; | ||
| 172 | |||
| 173 | ifile = nilfs_mdt_new(sbi->s_nilfs, sbi->s_super, NILFS_IFILE_INO, | ||
| 174 | sizeof(struct nilfs_ifile_info)); | ||
| 175 | if (ifile) { | ||
| 176 | err = nilfs_palloc_init_blockgroup(ifile, inode_size); | ||
| 177 | if (unlikely(err)) { | ||
| 178 | nilfs_mdt_destroy(ifile); | ||
| 179 | return NULL; | ||
| 180 | } | ||
| 181 | nilfs_palloc_setup_cache(ifile, | ||
| 182 | &NILFS_IFILE_I(ifile)->palloc_cache); | ||
| 183 | } | ||
| 184 | return ifile; | ||
| 185 | } | ||
