Commit 2879ed66e4c6da1dfc6bb0bd04566b61824f9256

Authored by Ryusuke Konishi
1 parent 090fd5b101

nilfs2: remove own inode allocator and destructor for metadata files

This finally removes own inode allocator and destructor functions for
metadata files.  Several routines, nilfs_mdt_new(),
nilfs_mdt_new_common(), nilfs_mdt_clear(), nilfs_mdt_destroy(), and
nilfs_alloc_inode_common() will be gone.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

Showing 4 changed files with 2 additions and 124 deletions Side-by-side Diff

... ... @@ -36,7 +36,6 @@
36 36  
37 37 #define NILFS_MDT_MAX_RA_BLOCKS (16 - 1)
38 38  
39   -#define INIT_UNUSED_INODE_FIELDS
40 39  
41 40 static int
42 41 nilfs_mdt_insert_new_block(struct inode *inode, unsigned long block,
... ... @@ -435,93 +434,6 @@
435 434 return 0;
436 435 }
437 436  
438   -/*
439   - * NILFS2 uses pseudo inodes for meta data files such as DAT, cpfile, sufile,
440   - * ifile, or gcinodes. This allows the B-tree code and segment constructor
441   - * to treat them like regular files, and this helps to simplify the
442   - * implementation.
443   - * On the other hand, some of the pseudo inodes have an irregular point:
444   - * They don't have valid inode->i_sb pointer because their lifetimes are
445   - * longer than those of the super block structs; they may continue for
446   - * several consecutive mounts/umounts. This would need discussions.
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   - */
454   -struct inode *
455   -nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb,
456   - ino_t ino)
457   -{
458   - struct inode *inode = nilfs_alloc_inode_common(nilfs);
459   -
460   - if (!inode)
461   - return NULL;
462   - else {
463   - struct address_space * const mapping = &inode->i_data;
464   -
465   - inode->i_sb = sb; /* sb may be NULL for some meta data files */
466   - inode->i_blkbits = nilfs->ns_blocksize_bits;
467   - inode->i_flags = 0;
468   - atomic_set(&inode->i_count, 1);
469   - inode->i_nlink = 1;
470   - inode->i_ino = ino;
471   -
472   -#ifdef INIT_UNUSED_INODE_FIELDS
473   - atomic_set(&inode->i_writecount, 0);
474   - inode->i_size = 0;
475   - inode->i_blocks = 0;
476   - inode->i_bytes = 0;
477   - inode->i_generation = 0;
478   -#ifdef CONFIG_QUOTA
479   - memset(&inode->i_dquot, 0, sizeof(inode->i_dquot));
480   -#endif
481   - inode->i_pipe = NULL;
482   - inode->i_bdev = NULL;
483   - inode->i_cdev = NULL;
484   - inode->i_rdev = 0;
485   -#ifdef CONFIG_SECURITY
486   - inode->i_security = NULL;
487   -#endif
488   - inode->dirtied_when = 0;
489   -
490   - INIT_LIST_HEAD(&inode->i_list);
491   - INIT_LIST_HEAD(&inode->i_sb_list);
492   - inode->i_state = 0;
493   -#endif
494   -
495   - spin_lock_init(&inode->i_lock);
496   - mutex_init(&inode->i_mutex);
497   - init_rwsem(&inode->i_alloc_sem);
498   -
499   - mapping->host = NULL; /* instead of inode */
500   - mapping->flags = 0;
501   - mapping->assoc_mapping = NULL;
502   -
503   - inode->i_mapping = mapping;
504   - }
505   -
506   - return inode;
507   -}
508   -
509   -struct inode *nilfs_mdt_new(struct the_nilfs *nilfs, struct super_block *sb,
510   - ino_t ino, size_t objsz)
511   -{
512   - struct inode *inode;
513   -
514   - inode = nilfs_mdt_new_common(nilfs, sb, ino);
515   - if (!inode)
516   - return NULL;
517   -
518   - if (nilfs_mdt_init(inode, NILFS_MDT_GFP, objsz) < 0) {
519   - nilfs_destroy_inode(inode);
520   - return NULL;
521   - }
522   - return inode;
523   -}
524   -
525 437 void nilfs_mdt_set_entry_size(struct inode *inode, unsigned entry_size,
526 438 unsigned header_size)
527 439 {
... ... @@ -687,28 +599,5 @@
687 599 truncate_inode_pages(&shadow->frozen_data, 0);
688 600 truncate_inode_pages(&shadow->frozen_btnodes, 0);
689 601 up_write(&mi->mi_sem);
690   -}
691   -
692   -static void nilfs_mdt_clear(struct inode *inode)
693   -{
694   - struct nilfs_inode_info *ii = NILFS_I(inode);
695   -
696   - invalidate_mapping_pages(inode->i_mapping, 0, -1);
697   - truncate_inode_pages(inode->i_mapping, 0);
698   -
699   - if (test_bit(NILFS_I_BMAP, &ii->i_state))
700   - nilfs_bmap_clear(ii->i_bmap);
701   - nilfs_btnode_cache_clear(&ii->i_btnode_cache);
702   -}
703   -
704   -void nilfs_mdt_destroy(struct inode *inode)
705   -{
706   - struct nilfs_mdt_info *mdi = NILFS_MDT(inode);
707   -
708   - if (mdi->mi_palloc_cache)
709   - nilfs_palloc_destroy_cache(inode);
710   - nilfs_mdt_clear(inode);
711   -
712   - nilfs_destroy_inode(inode);
713 602 }
... ... @@ -82,11 +82,6 @@
82 82 int nilfs_mdt_fetch_dirty(struct inode *);
83 83  
84 84 int nilfs_mdt_init(struct inode *inode, gfp_t gfp_mask, size_t objsz);
85   -struct inode *nilfs_mdt_new(struct the_nilfs *, struct super_block *, ino_t,
86   - size_t);
87   -struct inode *nilfs_mdt_new_common(struct the_nilfs *, struct super_block *,
88   - ino_t);
89   -void nilfs_mdt_destroy(struct inode *);
90 85 void nilfs_mdt_set_entry_size(struct inode *, unsigned, unsigned);
91 86  
92 87 int nilfs_mdt_setup_shadow_map(struct inode *inode,
... ... @@ -266,7 +266,6 @@
266 266 extern void nilfs_dirty_inode(struct inode *);
267 267  
268 268 /* super.c */
269   -extern struct inode *nilfs_alloc_inode_common(struct the_nilfs *);
270 269 extern struct inode *nilfs_alloc_inode(struct super_block *);
271 270 extern void nilfs_destroy_inode(struct inode *);
272 271 extern void nilfs_error(struct super_block *, const char *, const char *, ...)
... ... @@ -146,7 +146,7 @@
146 146 }
147 147  
148 148  
149   -struct inode *nilfs_alloc_inode_common(struct the_nilfs *nilfs)
  149 +struct inode *nilfs_alloc_inode(struct super_block *sb)
150 150 {
151 151 struct nilfs_inode_info *ii;
152 152  
153 153  
... ... @@ -157,13 +157,8 @@
157 157 ii->i_state = 0;
158 158 ii->i_cno = 0;
159 159 ii->vfs_inode.i_version = 1;
160   - nilfs_btnode_cache_init(&ii->i_btnode_cache, nilfs->ns_bdi);
  160 + nilfs_btnode_cache_init(&ii->i_btnode_cache, sb->s_bdi);
161 161 return &ii->vfs_inode;
162   -}
163   -
164   -struct inode *nilfs_alloc_inode(struct super_block *sb)
165   -{
166   - return nilfs_alloc_inode_common(NILFS_SB(sb)->s_nilfs);
167 162 }
168 163  
169 164 void nilfs_destroy_inode(struct inode *inode)