aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2008-08-13 02:23:13 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-08-13 02:23:13 -0400
commit41be8bed1f3168f34386f3a15d63682cfd586b8e (patch)
tree8cddec00890168b807853e5b6761625a3e194f3e /fs/xfs/linux-2.6/xfs_super.c
parent5ec7f8c7d14a3ea6bf920b3350f5c5d3527cb837 (diff)
[XFS] sanitize xfs_initialize_vnode
Sanitize setting up the Linux indode. Setting up the xfs_inode <-> inode link is opencoded in xfs_iget_core now because that's the only place it needs to be done, xfs_initialize_vnode is renamed to xfs_setup_inode and loses all superflous paramaters. The check for I_NEW is removed because it always is true and the di_mode check moves into xfs_iget_core because it's only needed there. xfs_set_inodeops and xfs_revalidate_inode are merged into xfs_setup_inode and the whole things is moved into xfs_iops.c where it belongs. SGI-PV: 981498 SGI-Modid: xfs-linux-melb:xfs-kern:31782a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Niv Sardi <xaiki@sgi.com> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c110
1 files changed, 0 insertions, 110 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 7605b071dc88..0eaad84a6803 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -581,116 +581,6 @@ xfs_max_file_offset(
581 return (((__uint64_t)pagefactor) << bitshift) - 1; 581 return (((__uint64_t)pagefactor) << bitshift) - 1;
582} 582}
583 583
584STATIC_INLINE void
585xfs_set_inodeops(
586 struct inode *inode)
587{
588 switch (inode->i_mode & S_IFMT) {
589 case S_IFREG:
590 inode->i_op = &xfs_inode_operations;
591 inode->i_fop = &xfs_file_operations;
592 inode->i_mapping->a_ops = &xfs_address_space_operations;
593 break;
594 case S_IFDIR:
595 if (xfs_sb_version_hasasciici(&XFS_M(inode->i_sb)->m_sb))
596 inode->i_op = &xfs_dir_ci_inode_operations;
597 else
598 inode->i_op = &xfs_dir_inode_operations;
599 inode->i_fop = &xfs_dir_file_operations;
600 break;
601 case S_IFLNK:
602 inode->i_op = &xfs_symlink_inode_operations;
603 if (!(XFS_I(inode)->i_df.if_flags & XFS_IFINLINE))
604 inode->i_mapping->a_ops = &xfs_address_space_operations;
605 break;
606 default:
607 inode->i_op = &xfs_inode_operations;
608 init_special_inode(inode, inode->i_mode, inode->i_rdev);
609 break;
610 }
611}
612
613STATIC_INLINE void
614xfs_revalidate_inode(
615 xfs_mount_t *mp,
616 struct inode *inode,
617 xfs_inode_t *ip)
618{
619
620 inode->i_mode = ip->i_d.di_mode;
621 inode->i_nlink = ip->i_d.di_nlink;
622 inode->i_uid = ip->i_d.di_uid;
623 inode->i_gid = ip->i_d.di_gid;
624
625 switch (inode->i_mode & S_IFMT) {
626 case S_IFBLK:
627 case S_IFCHR:
628 inode->i_rdev =
629 MKDEV(sysv_major(ip->i_df.if_u2.if_rdev) & 0x1ff,
630 sysv_minor(ip->i_df.if_u2.if_rdev));
631 break;
632 default:
633 inode->i_rdev = 0;
634 break;
635 }
636
637 inode->i_generation = ip->i_d.di_gen;
638 i_size_write(inode, ip->i_d.di_size);
639 inode->i_atime.tv_sec = ip->i_d.di_atime.t_sec;
640 inode->i_atime.tv_nsec = ip->i_d.di_atime.t_nsec;
641 inode->i_mtime.tv_sec = ip->i_d.di_mtime.t_sec;
642 inode->i_mtime.tv_nsec = ip->i_d.di_mtime.t_nsec;
643 inode->i_ctime.tv_sec = ip->i_d.di_ctime.t_sec;
644 inode->i_ctime.tv_nsec = ip->i_d.di_ctime.t_nsec;
645 if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE)
646 inode->i_flags |= S_IMMUTABLE;
647 else
648 inode->i_flags &= ~S_IMMUTABLE;
649 if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
650 inode->i_flags |= S_APPEND;
651 else
652 inode->i_flags &= ~S_APPEND;
653 if (ip->i_d.di_flags & XFS_DIFLAG_SYNC)
654 inode->i_flags |= S_SYNC;
655 else
656 inode->i_flags &= ~S_SYNC;
657 if (ip->i_d.di_flags & XFS_DIFLAG_NOATIME)
658 inode->i_flags |= S_NOATIME;
659 else
660 inode->i_flags &= ~S_NOATIME;
661 xfs_iflags_clear(ip, XFS_IMODIFIED);
662}
663
664void
665xfs_initialize_vnode(
666 struct xfs_mount *mp,
667 struct inode *inode,
668 struct xfs_inode *ip)
669{
670
671 if (!ip->i_vnode) {
672 ip->i_vnode = inode;
673 inode->i_private = ip;
674 }
675
676 /*
677 * We need to set the ops vectors, and unlock the inode, but if
678 * we have been called during the new inode create process, it is
679 * too early to fill in the Linux inode. We will get called a
680 * second time once the inode is properly set up, and then we can
681 * finish our work.
682 */
683 if (ip->i_d.di_mode != 0 && (inode->i_state & I_NEW)) {
684 xfs_revalidate_inode(mp, inode, ip);
685 xfs_set_inodeops(inode);
686
687 xfs_iflags_clear(ip, XFS_INEW);
688 barrier();
689
690 unlock_new_inode(inode);
691 }
692}
693
694int 584int
695xfs_blkdev_get( 585xfs_blkdev_get(
696 xfs_mount_t *mp, 586 xfs_mount_t *mp,