diff options
Diffstat (limited to 'fs/ufs/inode.c')
-rw-r--r-- | fs/ufs/inode.c | 58 |
1 files changed, 24 insertions, 34 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index ea2267316a72..c28b7522c9e7 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -552,6 +552,28 @@ struct address_space_operations ufs_aops = { | |||
552 | .bmap = ufs_bmap | 552 | .bmap = ufs_bmap |
553 | }; | 553 | }; |
554 | 554 | ||
555 | static void ufs_set_inode_ops(struct inode *inode) | ||
556 | { | ||
557 | if (S_ISREG(inode->i_mode)) { | ||
558 | inode->i_op = &ufs_file_inode_operations; | ||
559 | inode->i_fop = &ufs_file_operations; | ||
560 | inode->i_mapping->a_ops = &ufs_aops; | ||
561 | } else if (S_ISDIR(inode->i_mode)) { | ||
562 | inode->i_op = &ufs_dir_inode_operations; | ||
563 | inode->i_fop = &ufs_dir_operations; | ||
564 | inode->i_mapping->a_ops = &ufs_aops; | ||
565 | } else if (S_ISLNK(inode->i_mode)) { | ||
566 | if (!inode->i_blocks) | ||
567 | inode->i_op = &ufs_fast_symlink_inode_operations; | ||
568 | else { | ||
569 | inode->i_op = &page_symlink_inode_operations; | ||
570 | inode->i_mapping->a_ops = &ufs_aops; | ||
571 | } | ||
572 | } else | ||
573 | init_special_inode(inode, inode->i_mode, | ||
574 | ufs_get_inode_dev(inode->i_sb, UFS_I(inode))); | ||
575 | } | ||
576 | |||
555 | void ufs_read_inode (struct inode * inode) | 577 | void ufs_read_inode (struct inode * inode) |
556 | { | 578 | { |
557 | struct ufs_inode_info *ufsi = UFS_I(inode); | 579 | struct ufs_inode_info *ufsi = UFS_I(inode); |
@@ -626,23 +648,7 @@ void ufs_read_inode (struct inode * inode) | |||
626 | } | 648 | } |
627 | ufsi->i_osync = 0; | 649 | ufsi->i_osync = 0; |
628 | 650 | ||
629 | if (S_ISREG(inode->i_mode)) { | 651 | ufs_set_inode_ops(inode); |
630 | inode->i_op = &ufs_file_inode_operations; | ||
631 | inode->i_fop = &ufs_file_operations; | ||
632 | inode->i_mapping->a_ops = &ufs_aops; | ||
633 | } else if (S_ISDIR(inode->i_mode)) { | ||
634 | inode->i_op = &ufs_dir_inode_operations; | ||
635 | inode->i_fop = &ufs_dir_operations; | ||
636 | } else if (S_ISLNK(inode->i_mode)) { | ||
637 | if (!inode->i_blocks) | ||
638 | inode->i_op = &ufs_fast_symlink_inode_operations; | ||
639 | else { | ||
640 | inode->i_op = &page_symlink_inode_operations; | ||
641 | inode->i_mapping->a_ops = &ufs_aops; | ||
642 | } | ||
643 | } else | ||
644 | init_special_inode(inode, inode->i_mode, | ||
645 | ufs_get_inode_dev(sb, ufsi)); | ||
646 | 652 | ||
647 | brelse (bh); | 653 | brelse (bh); |
648 | 654 | ||
@@ -702,23 +708,7 @@ ufs2_inode : | |||
702 | } | 708 | } |
703 | ufsi->i_osync = 0; | 709 | ufsi->i_osync = 0; |
704 | 710 | ||
705 | if (S_ISREG(inode->i_mode)) { | 711 | ufs_set_inode_ops(inode); |
706 | inode->i_op = &ufs_file_inode_operations; | ||
707 | inode->i_fop = &ufs_file_operations; | ||
708 | inode->i_mapping->a_ops = &ufs_aops; | ||
709 | } else if (S_ISDIR(inode->i_mode)) { | ||
710 | inode->i_op = &ufs_dir_inode_operations; | ||
711 | inode->i_fop = &ufs_dir_operations; | ||
712 | } else if (S_ISLNK(inode->i_mode)) { | ||
713 | if (!inode->i_blocks) | ||
714 | inode->i_op = &ufs_fast_symlink_inode_operations; | ||
715 | else { | ||
716 | inode->i_op = &page_symlink_inode_operations; | ||
717 | inode->i_mapping->a_ops = &ufs_aops; | ||
718 | } | ||
719 | } else /* TODO : here ...*/ | ||
720 | init_special_inode(inode, inode->i_mode, | ||
721 | ufs_get_inode_dev(sb, ufsi)); | ||
722 | 712 | ||
723 | brelse(bh); | 713 | brelse(bh); |
724 | 714 | ||