diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_iops.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 103 |
1 files changed, 99 insertions, 4 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index cc0f21af48fe..ace56bd3a5fb 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -710,7 +710,7 @@ out_error: | |||
710 | return error; | 710 | return error; |
711 | } | 711 | } |
712 | 712 | ||
713 | const struct inode_operations xfs_inode_operations = { | 713 | static const struct inode_operations xfs_inode_operations = { |
714 | .permission = xfs_vn_permission, | 714 | .permission = xfs_vn_permission, |
715 | .truncate = xfs_vn_truncate, | 715 | .truncate = xfs_vn_truncate, |
716 | .getattr = xfs_vn_getattr, | 716 | .getattr = xfs_vn_getattr, |
@@ -722,7 +722,7 @@ const struct inode_operations xfs_inode_operations = { | |||
722 | .fallocate = xfs_vn_fallocate, | 722 | .fallocate = xfs_vn_fallocate, |
723 | }; | 723 | }; |
724 | 724 | ||
725 | const struct inode_operations xfs_dir_inode_operations = { | 725 | static const struct inode_operations xfs_dir_inode_operations = { |
726 | .create = xfs_vn_create, | 726 | .create = xfs_vn_create, |
727 | .lookup = xfs_vn_lookup, | 727 | .lookup = xfs_vn_lookup, |
728 | .link = xfs_vn_link, | 728 | .link = xfs_vn_link, |
@@ -747,7 +747,7 @@ const struct inode_operations xfs_dir_inode_operations = { | |||
747 | .listxattr = xfs_vn_listxattr, | 747 | .listxattr = xfs_vn_listxattr, |
748 | }; | 748 | }; |
749 | 749 | ||
750 | const struct inode_operations xfs_dir_ci_inode_operations = { | 750 | static const struct inode_operations xfs_dir_ci_inode_operations = { |
751 | .create = xfs_vn_create, | 751 | .create = xfs_vn_create, |
752 | .lookup = xfs_vn_ci_lookup, | 752 | .lookup = xfs_vn_ci_lookup, |
753 | .link = xfs_vn_link, | 753 | .link = xfs_vn_link, |
@@ -772,7 +772,7 @@ const struct inode_operations xfs_dir_ci_inode_operations = { | |||
772 | .listxattr = xfs_vn_listxattr, | 772 | .listxattr = xfs_vn_listxattr, |
773 | }; | 773 | }; |
774 | 774 | ||
775 | const struct inode_operations xfs_symlink_inode_operations = { | 775 | static const struct inode_operations xfs_symlink_inode_operations = { |
776 | .readlink = generic_readlink, | 776 | .readlink = generic_readlink, |
777 | .follow_link = xfs_vn_follow_link, | 777 | .follow_link = xfs_vn_follow_link, |
778 | .put_link = xfs_vn_put_link, | 778 | .put_link = xfs_vn_put_link, |
@@ -784,3 +784,98 @@ const struct inode_operations xfs_symlink_inode_operations = { | |||
784 | .removexattr = generic_removexattr, | 784 | .removexattr = generic_removexattr, |
785 | .listxattr = xfs_vn_listxattr, | 785 | .listxattr = xfs_vn_listxattr, |
786 | }; | 786 | }; |
787 | |||
788 | STATIC void | ||
789 | xfs_diflags_to_iflags( | ||
790 | struct inode *inode, | ||
791 | struct xfs_inode *ip) | ||
792 | { | ||
793 | if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE) | ||
794 | inode->i_flags |= S_IMMUTABLE; | ||
795 | else | ||
796 | inode->i_flags &= ~S_IMMUTABLE; | ||
797 | if (ip->i_d.di_flags & XFS_DIFLAG_APPEND) | ||
798 | inode->i_flags |= S_APPEND; | ||
799 | else | ||
800 | inode->i_flags &= ~S_APPEND; | ||
801 | if (ip->i_d.di_flags & XFS_DIFLAG_SYNC) | ||
802 | inode->i_flags |= S_SYNC; | ||
803 | else | ||
804 | inode->i_flags &= ~S_SYNC; | ||
805 | if (ip->i_d.di_flags & XFS_DIFLAG_NOATIME) | ||
806 | inode->i_flags |= S_NOATIME; | ||
807 | else | ||
808 | inode->i_flags &= ~S_NOATIME; | ||
809 | } | ||
810 | |||
811 | /* | ||
812 | * Initialize the Linux inode, set up the operation vectors and | ||
813 | * unlock the inode. | ||
814 | * | ||
815 | * When reading existing inodes from disk this is called directly | ||
816 | * from xfs_iget, when creating a new inode it is called from | ||
817 | * xfs_ialloc after setting up the inode. | ||
818 | */ | ||
819 | void | ||
820 | xfs_setup_inode( | ||
821 | struct xfs_inode *ip) | ||
822 | { | ||
823 | struct inode *inode = ip->i_vnode; | ||
824 | |||
825 | inode->i_mode = ip->i_d.di_mode; | ||
826 | inode->i_nlink = ip->i_d.di_nlink; | ||
827 | inode->i_uid = ip->i_d.di_uid; | ||
828 | inode->i_gid = ip->i_d.di_gid; | ||
829 | |||
830 | switch (inode->i_mode & S_IFMT) { | ||
831 | case S_IFBLK: | ||
832 | case S_IFCHR: | ||
833 | inode->i_rdev = | ||
834 | MKDEV(sysv_major(ip->i_df.if_u2.if_rdev) & 0x1ff, | ||
835 | sysv_minor(ip->i_df.if_u2.if_rdev)); | ||
836 | break; | ||
837 | default: | ||
838 | inode->i_rdev = 0; | ||
839 | break; | ||
840 | } | ||
841 | |||
842 | inode->i_generation = ip->i_d.di_gen; | ||
843 | i_size_write(inode, ip->i_d.di_size); | ||
844 | inode->i_atime.tv_sec = ip->i_d.di_atime.t_sec; | ||
845 | inode->i_atime.tv_nsec = ip->i_d.di_atime.t_nsec; | ||
846 | inode->i_mtime.tv_sec = ip->i_d.di_mtime.t_sec; | ||
847 | inode->i_mtime.tv_nsec = ip->i_d.di_mtime.t_nsec; | ||
848 | inode->i_ctime.tv_sec = ip->i_d.di_ctime.t_sec; | ||
849 | inode->i_ctime.tv_nsec = ip->i_d.di_ctime.t_nsec; | ||
850 | xfs_diflags_to_iflags(inode, ip); | ||
851 | xfs_iflags_clear(ip, XFS_IMODIFIED); | ||
852 | |||
853 | switch (inode->i_mode & S_IFMT) { | ||
854 | case S_IFREG: | ||
855 | inode->i_op = &xfs_inode_operations; | ||
856 | inode->i_fop = &xfs_file_operations; | ||
857 | inode->i_mapping->a_ops = &xfs_address_space_operations; | ||
858 | break; | ||
859 | case S_IFDIR: | ||
860 | if (xfs_sb_version_hasasciici(&XFS_M(inode->i_sb)->m_sb)) | ||
861 | inode->i_op = &xfs_dir_ci_inode_operations; | ||
862 | else | ||
863 | inode->i_op = &xfs_dir_inode_operations; | ||
864 | inode->i_fop = &xfs_dir_file_operations; | ||
865 | break; | ||
866 | case S_IFLNK: | ||
867 | inode->i_op = &xfs_symlink_inode_operations; | ||
868 | if (!(ip->i_df.if_flags & XFS_IFINLINE)) | ||
869 | inode->i_mapping->a_ops = &xfs_address_space_operations; | ||
870 | break; | ||
871 | default: | ||
872 | inode->i_op = &xfs_inode_operations; | ||
873 | init_special_inode(inode, inode->i_mode, inode->i_rdev); | ||
874 | break; | ||
875 | } | ||
876 | |||
877 | xfs_iflags_clear(ip, XFS_INEW); | ||
878 | barrier(); | ||
879 | |||
880 | unlock_new_inode(inode); | ||
881 | } | ||