aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-12 08:42:04 -0500
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-11-19 20:05:48 -0500
commit5731e191f254af9135ad843119804a500528ecf3 (patch)
tree1ababce01647674af0e9c6bfb36f5ab5e96ab76c /fs
parent9cb4e0d2b99e8b0e5e269d898ae6ab1967647c5a (diff)
nilfs2: add size option of private object to metadata file allocator
This adds an optional "object size" argument to nilfs_mdt_new_common() function; the argument specifies the size of private object attached to a newly allocated metadata file inode. This will afford space to keep local variables for meta data files. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs')
-rw-r--r--fs/nilfs2/gcinode.c3
-rw-r--r--fs/nilfs2/mdt.c19
-rw-r--r--fs/nilfs2/mdt.h5
-rw-r--r--fs/nilfs2/super.c2
-rw-r--r--fs/nilfs2/the_nilfs.c8
5 files changed, 24 insertions, 13 deletions
diff --git a/fs/nilfs2/gcinode.c b/fs/nilfs2/gcinode.c
index e6de0a27ab5d..32b04da03829 100644
--- a/fs/nilfs2/gcinode.c
+++ b/fs/nilfs2/gcinode.c
@@ -212,9 +212,10 @@ void nilfs_destroy_gccache(struct the_nilfs *nilfs)
212static struct inode *alloc_gcinode(struct the_nilfs *nilfs, ino_t ino, 212static struct inode *alloc_gcinode(struct the_nilfs *nilfs, ino_t ino,
213 __u64 cno) 213 __u64 cno)
214{ 214{
215 struct inode *inode = nilfs_mdt_new_common(nilfs, NULL, ino, GFP_NOFS); 215 struct inode *inode;
216 struct nilfs_inode_info *ii; 216 struct nilfs_inode_info *ii;
217 217
218 inode = nilfs_mdt_new_common(nilfs, NULL, ino, GFP_NOFS, 0);
218 if (!inode) 219 if (!inode)
219 return NULL; 220 return NULL;
220 221
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c
index f6326112d647..62074e8d25cb 100644
--- a/fs/nilfs2/mdt.c
+++ b/fs/nilfs2/mdt.c
@@ -445,9 +445,17 @@ static const struct file_operations def_mdt_fops;
445 * longer than those of the super block structs; they may continue for 445 * longer than those of the super block structs; they may continue for
446 * several consecutive mounts/umounts. This would need discussions. 446 * several consecutive mounts/umounts. This would need discussions.
447 */ 447 */
448/**
449 * nilfs_mdt_new_common - allocate a pseudo inode for metadata file
450 * @nilfs: nilfs object
451 * @sb: super block instance the metadata file belongs to
452 * @ino: inode number
453 * @gfp_mask: gfp mask for data pages
454 * @objsz: size of the private object attached to inode->i_private
455 */
448struct inode * 456struct inode *
449nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb, 457nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb,
450 ino_t ino, gfp_t gfp_mask) 458 ino_t ino, gfp_t gfp_mask, size_t objsz)
451{ 459{
452 struct inode *inode = nilfs_alloc_inode_common(nilfs); 460 struct inode *inode = nilfs_alloc_inode_common(nilfs);
453 461
@@ -455,8 +463,9 @@ nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb,
455 return NULL; 463 return NULL;
456 else { 464 else {
457 struct address_space * const mapping = &inode->i_data; 465 struct address_space * const mapping = &inode->i_data;
458 struct nilfs_mdt_info *mi = kzalloc(sizeof(*mi), GFP_NOFS); 466 struct nilfs_mdt_info *mi;
459 467
468 mi = kzalloc(max(sizeof(*mi), objsz), GFP_NOFS);
460 if (!mi) { 469 if (!mi) {
461 nilfs_destroy_inode(inode); 470 nilfs_destroy_inode(inode);
462 return NULL; 471 return NULL;
@@ -513,11 +522,11 @@ nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb,
513} 522}
514 523
515struct inode *nilfs_mdt_new(struct the_nilfs *nilfs, struct super_block *sb, 524struct inode *nilfs_mdt_new(struct the_nilfs *nilfs, struct super_block *sb,
516 ino_t ino) 525 ino_t ino, size_t objsz)
517{ 526{
518 struct inode *inode = nilfs_mdt_new_common(nilfs, sb, ino, 527 struct inode *inode;
519 NILFS_MDT_GFP);
520 528
529 inode = nilfs_mdt_new_common(nilfs, sb, ino, NILFS_MDT_GFP, objsz);
521 if (!inode) 530 if (!inode)
522 return NULL; 531 return NULL;
523 532
diff --git a/fs/nilfs2/mdt.h b/fs/nilfs2/mdt.h
index 431599733c9b..3eb40e8d50ff 100644
--- a/fs/nilfs2/mdt.h
+++ b/fs/nilfs2/mdt.h
@@ -74,9 +74,10 @@ int nilfs_mdt_forget_block(struct inode *, unsigned long);
74int nilfs_mdt_mark_block_dirty(struct inode *, unsigned long); 74int nilfs_mdt_mark_block_dirty(struct inode *, unsigned long);
75int nilfs_mdt_fetch_dirty(struct inode *); 75int nilfs_mdt_fetch_dirty(struct inode *);
76 76
77struct inode *nilfs_mdt_new(struct the_nilfs *, struct super_block *, ino_t); 77struct inode *nilfs_mdt_new(struct the_nilfs *, struct super_block *, ino_t,
78 size_t);
78struct inode *nilfs_mdt_new_common(struct the_nilfs *, struct super_block *, 79struct inode *nilfs_mdt_new_common(struct the_nilfs *, struct super_block *,
79 ino_t, gfp_t); 80 ino_t, gfp_t, size_t);
80void nilfs_mdt_destroy(struct inode *); 81void nilfs_mdt_destroy(struct inode *);
81void nilfs_mdt_clear(struct inode *); 82void nilfs_mdt_clear(struct inode *);
82void nilfs_mdt_set_entry_size(struct inode *, unsigned, unsigned); 83void nilfs_mdt_set_entry_size(struct inode *, unsigned, unsigned);
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c
index b6837f48636f..77f2e47ff81c 100644
--- a/fs/nilfs2/super.c
+++ b/fs/nilfs2/super.c
@@ -363,7 +363,7 @@ int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno)
363 list_add(&sbi->s_list, &nilfs->ns_supers); 363 list_add(&sbi->s_list, &nilfs->ns_supers);
364 up_write(&nilfs->ns_super_sem); 364 up_write(&nilfs->ns_super_sem);
365 365
366 sbi->s_ifile = nilfs_mdt_new(nilfs, sbi->s_super, NILFS_IFILE_INO); 366 sbi->s_ifile = nilfs_mdt_new(nilfs, sbi->s_super, NILFS_IFILE_INO, 0);
367 if (!sbi->s_ifile) 367 if (!sbi->s_ifile)
368 return -ENOMEM; 368 return -ENOMEM;
369 369
diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index ad391a8c3e7e..a80bbb7c5afc 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -187,19 +187,19 @@ static int nilfs_load_super_root(struct the_nilfs *nilfs,
187 inode_size = nilfs->ns_inode_size; 187 inode_size = nilfs->ns_inode_size;
188 188
189 err = -ENOMEM; 189 err = -ENOMEM;
190 nilfs->ns_dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO); 190 nilfs->ns_dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO, 0);
191 if (unlikely(!nilfs->ns_dat)) 191 if (unlikely(!nilfs->ns_dat))
192 goto failed; 192 goto failed;
193 193
194 nilfs->ns_gc_dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO); 194 nilfs->ns_gc_dat = nilfs_mdt_new(nilfs, NULL, NILFS_DAT_INO, 0);
195 if (unlikely(!nilfs->ns_gc_dat)) 195 if (unlikely(!nilfs->ns_gc_dat))
196 goto failed_dat; 196 goto failed_dat;
197 197
198 nilfs->ns_cpfile = nilfs_mdt_new(nilfs, NULL, NILFS_CPFILE_INO); 198 nilfs->ns_cpfile = nilfs_mdt_new(nilfs, NULL, NILFS_CPFILE_INO, 0);
199 if (unlikely(!nilfs->ns_cpfile)) 199 if (unlikely(!nilfs->ns_cpfile))
200 goto failed_gc_dat; 200 goto failed_gc_dat;
201 201
202 nilfs->ns_sufile = nilfs_mdt_new(nilfs, NULL, NILFS_SUFILE_INO); 202 nilfs->ns_sufile = nilfs_mdt_new(nilfs, NULL, NILFS_SUFILE_INO, 0);
203 if (unlikely(!nilfs->ns_sufile)) 203 if (unlikely(!nilfs->ns_sufile))
204 goto failed_cpfile; 204 goto failed_cpfile;
205 205