diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-09-05 00:35:53 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-10-22 20:24:39 -0400 |
commit | 2879ed66e4c6da1dfc6bb0bd04566b61824f9256 (patch) | |
tree | f6d5b47abac374fb9ecd516eaea424d990821d83 /fs/nilfs2/mdt.c | |
parent | 090fd5b10165033d7c30afde0a7e59141d820602 (diff) |
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>
Diffstat (limited to 'fs/nilfs2/mdt.c')
-rw-r--r-- | fs/nilfs2/mdt.c | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index 0a2ccfc0d6f9..d60fdb097d52 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
@@ -36,7 +36,6 @@ | |||
36 | 36 | ||
37 | #define NILFS_MDT_MAX_RA_BLOCKS (16 - 1) | 37 | #define NILFS_MDT_MAX_RA_BLOCKS (16 - 1) |
38 | 38 | ||
39 | #define INIT_UNUSED_INODE_FIELDS | ||
40 | 39 | ||
41 | static int | 40 | static int |
42 | nilfs_mdt_insert_new_block(struct inode *inode, unsigned long block, | 41 | nilfs_mdt_insert_new_block(struct inode *inode, unsigned long block, |
@@ -435,93 +434,6 @@ int nilfs_mdt_init(struct inode *inode, gfp_t gfp_mask, size_t objsz) | |||
435 | return 0; | 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 | void nilfs_mdt_set_entry_size(struct inode *inode, unsigned entry_size, | 437 | void nilfs_mdt_set_entry_size(struct inode *inode, unsigned entry_size, |
526 | unsigned header_size) | 438 | unsigned header_size) |
527 | { | 439 | { |
@@ -688,26 +600,3 @@ void nilfs_mdt_clear_shadow_map(struct inode *inode) | |||
688 | truncate_inode_pages(&shadow->frozen_btnodes, 0); | 600 | truncate_inode_pages(&shadow->frozen_btnodes, 0); |
689 | up_write(&mi->mi_sem); | 601 | up_write(&mi->mi_sem); |
690 | } | 602 | } |
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 | } | ||