Commit 49fa7a590208b439cc74f2cafdb15568abb3f8d1
1 parent
c3ea56c800
Exists in
master
and in
39 other branches
nilfs2: add palloc cache to ifile
This adds the palloc cache to ifile. The palloc cache is allocated on the extended region of nilfs_mdt_info struct. The struct nilfs_ifile_info defines the extended on memory structure of ifile. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Showing 1 changed file with 15 additions and 1 deletions Side-by-side Diff
fs/nilfs2/ifile.c
... | ... | @@ -29,6 +29,17 @@ |
29 | 29 | #include "alloc.h" |
30 | 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 | 44 | * nilfs_ifile_create_inode - create a new disk inode |
34 | 45 | * @ifile: ifile inode |
35 | 46 | |
... | ... | @@ -159,13 +170,16 @@ |
159 | 170 | struct inode *ifile; |
160 | 171 | int err; |
161 | 172 | |
162 | - ifile = nilfs_mdt_new(sbi->s_nilfs, sbi->s_super, NILFS_IFILE_INO, 0); | |
173 | + ifile = nilfs_mdt_new(sbi->s_nilfs, sbi->s_super, NILFS_IFILE_INO, | |
174 | + sizeof(struct nilfs_ifile_info)); | |
163 | 175 | if (ifile) { |
164 | 176 | err = nilfs_palloc_init_blockgroup(ifile, inode_size); |
165 | 177 | if (unlikely(err)) { |
166 | 178 | nilfs_mdt_destroy(ifile); |
167 | 179 | return NULL; |
168 | 180 | } |
181 | + nilfs_palloc_setup_cache(ifile, | |
182 | + &NILFS_IFILE_I(ifile)->palloc_cache); | |
169 | 183 | } |
170 | 184 | return ifile; |
171 | 185 | } |