diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-30 03:20:31 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 21:43:55 -0400 |
commit | 48c872a9f3ec4cdc37801aae9ef16c80026503ea (patch) | |
tree | 51d377e7ced7298d96daf9008558e54177e47a30 /fs/xfs/xfs_vfsops.c | |
parent | b09cc77109dbf33463480952de10511a2b67bba6 (diff) |
[XFS] decontaminate vfs operations from behavior details
All vfs ops now take struct xfs_mount pointers and the behaviour related
glue is split out into methods of its own.
SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29504a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_vfsops.c')
-rw-r--r-- | fs/xfs/xfs_vfsops.c | 86 |
1 files changed, 27 insertions, 59 deletions
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index f62f6e486f23..2d672f317110 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -55,10 +55,9 @@ | |||
55 | #include "xfs_filestream.h" | 55 | #include "xfs_filestream.h" |
56 | #include "xfs_fsops.h" | 56 | #include "xfs_fsops.h" |
57 | #include "xfs_vnodeops.h" | 57 | #include "xfs_vnodeops.h" |
58 | #include "xfs_vfsops.h" | ||
58 | 59 | ||
59 | 60 | ||
60 | STATIC int xfs_sync(bhv_desc_t *, int, cred_t *); | ||
61 | |||
62 | int | 61 | int |
63 | xfs_init(void) | 62 | xfs_init(void) |
64 | { | 63 | { |
@@ -433,15 +432,14 @@ xfs_finish_flags( | |||
433 | * they are present. The data subvolume has already been opened by | 432 | * they are present. The data subvolume has already been opened by |
434 | * get_sb_bdev() and is stored in vfsp->vfs_super->s_bdev. | 433 | * get_sb_bdev() and is stored in vfsp->vfs_super->s_bdev. |
435 | */ | 434 | */ |
436 | STATIC int | 435 | int |
437 | xfs_mount( | 436 | xfs_mount( |
438 | struct bhv_desc *bhvp, | 437 | struct xfs_mount *mp, |
439 | struct xfs_mount_args *args, | 438 | struct xfs_mount_args *args, |
440 | cred_t *credp) | 439 | cred_t *credp) |
441 | { | 440 | { |
442 | struct bhv_vfs *vfsp = bhvtovfs(bhvp); | 441 | struct bhv_vfs *vfsp = XFS_MTOVFS(mp); |
443 | struct bhv_desc *p; | 442 | struct bhv_desc *p; |
444 | struct xfs_mount *mp = XFS_BHVTOM(bhvp); | ||
445 | struct block_device *ddev, *logdev, *rtdev; | 443 | struct block_device *ddev, *logdev, *rtdev; |
446 | int flags = 0, error; | 444 | int flags = 0, error; |
447 | 445 | ||
@@ -578,14 +576,13 @@ error0: | |||
578 | return error; | 576 | return error; |
579 | } | 577 | } |
580 | 578 | ||
581 | STATIC int | 579 | int |
582 | xfs_unmount( | 580 | xfs_unmount( |
583 | bhv_desc_t *bdp, | 581 | xfs_mount_t *mp, |
584 | int flags, | 582 | int flags, |
585 | cred_t *credp) | 583 | cred_t *credp) |
586 | { | 584 | { |
587 | bhv_vfs_t *vfsp = bhvtovfs(bdp); | 585 | bhv_vfs_t *vfsp = XFS_MTOVFS(mp); |
588 | xfs_mount_t *mp = XFS_BHVTOM(bdp); | ||
589 | xfs_inode_t *rip; | 586 | xfs_inode_t *rip; |
590 | bhv_vnode_t *rvp; | 587 | bhv_vnode_t *rvp; |
591 | int unmount_event_wanted = 0; | 588 | int unmount_event_wanted = 0; |
@@ -641,8 +638,7 @@ xfs_unmount( | |||
641 | * referenced vnodes as well. | 638 | * referenced vnodes as well. |
642 | */ | 639 | */ |
643 | if (XFS_FORCED_SHUTDOWN(mp)) { | 640 | if (XFS_FORCED_SHUTDOWN(mp)) { |
644 | error = xfs_sync(&mp->m_bhv, | 641 | error = xfs_sync(mp, SYNC_WAIT | SYNC_CLOSE); |
645 | (SYNC_WAIT | SYNC_CLOSE), credp); | ||
646 | ASSERT(error != EFSCORRUPTED); | 642 | ASSERT(error != EFSCORRUPTED); |
647 | } | 643 | } |
648 | xfs_unmountfs_needed = 1; | 644 | xfs_unmountfs_needed = 1; |
@@ -726,14 +722,13 @@ xfs_attr_quiesce( | |||
726 | xfs_unmountfs_writesb(mp); | 722 | xfs_unmountfs_writesb(mp); |
727 | } | 723 | } |
728 | 724 | ||
729 | STATIC int | 725 | int |
730 | xfs_mntupdate( | 726 | xfs_mntupdate( |
731 | bhv_desc_t *bdp, | 727 | struct xfs_mount *mp, |
732 | int *flags, | 728 | int *flags, |
733 | struct xfs_mount_args *args) | 729 | struct xfs_mount_args *args) |
734 | { | 730 | { |
735 | bhv_vfs_t *vfsp = bhvtovfs(bdp); | 731 | struct bhv_vfs *vfsp = XFS_MTOVFS(mp); |
736 | xfs_mount_t *mp = XFS_BHVTOM(bdp); | ||
737 | 732 | ||
738 | if (!(*flags & MS_RDONLY)) { /* rw/ro -> rw */ | 733 | if (!(*flags & MS_RDONLY)) { /* rw/ro -> rw */ |
739 | if (vfsp->vfs_flag & VFS_RDONLY) | 734 | if (vfsp->vfs_flag & VFS_RDONLY) |
@@ -843,14 +838,14 @@ fscorrupt_out2: | |||
843 | * vpp -- address of the caller's vnode pointer which should be | 838 | * vpp -- address of the caller's vnode pointer which should be |
844 | * set to the desired fs root vnode | 839 | * set to the desired fs root vnode |
845 | */ | 840 | */ |
846 | STATIC int | 841 | int |
847 | xfs_root( | 842 | xfs_root( |
848 | bhv_desc_t *bdp, | 843 | xfs_mount_t *mp, |
849 | bhv_vnode_t **vpp) | 844 | bhv_vnode_t **vpp) |
850 | { | 845 | { |
851 | bhv_vnode_t *vp; | 846 | bhv_vnode_t *vp; |
852 | 847 | ||
853 | vp = XFS_ITOV((XFS_BHVTOM(bdp))->m_rootip); | 848 | vp = XFS_ITOV(mp->m_rootip); |
854 | VN_HOLD(vp); | 849 | VN_HOLD(vp); |
855 | *vpp = vp; | 850 | *vpp = vp; |
856 | return 0; | 851 | return 0; |
@@ -863,19 +858,17 @@ xfs_root( | |||
863 | * the superblock lock in the mount structure to ensure a consistent | 858 | * the superblock lock in the mount structure to ensure a consistent |
864 | * snapshot of the counters returned. | 859 | * snapshot of the counters returned. |
865 | */ | 860 | */ |
866 | STATIC int | 861 | int |
867 | xfs_statvfs( | 862 | xfs_statvfs( |
868 | bhv_desc_t *bdp, | 863 | xfs_mount_t *mp, |
869 | bhv_statvfs_t *statp, | 864 | bhv_statvfs_t *statp, |
870 | bhv_vnode_t *vp) | 865 | bhv_vnode_t *vp) |
871 | { | 866 | { |
872 | __uint64_t fakeinos; | 867 | __uint64_t fakeinos; |
873 | xfs_extlen_t lsize; | 868 | xfs_extlen_t lsize; |
874 | xfs_mount_t *mp; | ||
875 | xfs_sb_t *sbp; | 869 | xfs_sb_t *sbp; |
876 | unsigned long s; | 870 | unsigned long s; |
877 | 871 | ||
878 | mp = XFS_BHVTOM(bdp); | ||
879 | sbp = &(mp->m_sb); | 872 | sbp = &(mp->m_sb); |
880 | 873 | ||
881 | statp->f_type = XFS_SB_MAGIC; | 874 | statp->f_type = XFS_SB_MAGIC; |
@@ -954,14 +947,11 @@ xfs_statvfs( | |||
954 | * filesystem. | 947 | * filesystem. |
955 | * | 948 | * |
956 | */ | 949 | */ |
957 | /*ARGSUSED*/ | 950 | int |
958 | STATIC int | ||
959 | xfs_sync( | 951 | xfs_sync( |
960 | bhv_desc_t *bdp, | 952 | xfs_mount_t *mp, |
961 | int flags, | 953 | int flags) |
962 | cred_t *credp) | ||
963 | { | 954 | { |
964 | xfs_mount_t *mp = XFS_BHVTOM(bdp); | ||
965 | int error; | 955 | int error; |
966 | 956 | ||
967 | /* | 957 | /* |
@@ -1652,13 +1642,12 @@ xfs_syncsub( | |||
1652 | /* | 1642 | /* |
1653 | * xfs_vget - called by DMAPI and NFSD to get vnode from file handle | 1643 | * xfs_vget - called by DMAPI and NFSD to get vnode from file handle |
1654 | */ | 1644 | */ |
1655 | STATIC int | 1645 | int |
1656 | xfs_vget( | 1646 | xfs_vget( |
1657 | bhv_desc_t *bdp, | 1647 | xfs_mount_t *mp, |
1658 | bhv_vnode_t **vpp, | 1648 | bhv_vnode_t **vpp, |
1659 | fid_t *fidp) | 1649 | fid_t *fidp) |
1660 | { | 1650 | { |
1661 | xfs_mount_t *mp = XFS_BHVTOM(bdp); | ||
1662 | xfs_fid_t *xfid = (struct xfs_fid *)fidp; | 1651 | xfs_fid_t *xfid = (struct xfs_fid *)fidp; |
1663 | xfs_inode_t *ip; | 1652 | xfs_inode_t *ip; |
1664 | int error; | 1653 | int error; |
@@ -1775,14 +1764,14 @@ suffix_strtoul(char *s, char **endp, unsigned int base) | |||
1775 | return simple_strtoul((const char *)s, endp, base) << shift_left_factor; | 1764 | return simple_strtoul((const char *)s, endp, base) << shift_left_factor; |
1776 | } | 1765 | } |
1777 | 1766 | ||
1778 | STATIC int | 1767 | int |
1779 | xfs_parseargs( | 1768 | xfs_parseargs( |
1780 | struct bhv_desc *bhv, | 1769 | struct xfs_mount *mp, |
1781 | char *options, | 1770 | char *options, |
1782 | struct xfs_mount_args *args, | 1771 | struct xfs_mount_args *args, |
1783 | int update) | 1772 | int update) |
1784 | { | 1773 | { |
1785 | bhv_vfs_t *vfsp = bhvtovfs(bhv); | 1774 | bhv_vfs_t *vfsp = XFS_MTOVFS(mp); |
1786 | char *this_char, *value, *eov; | 1775 | char *this_char, *value, *eov; |
1787 | int dsunit, dswidth, vol_dsunit, vol_dswidth; | 1776 | int dsunit, dswidth, vol_dsunit, vol_dswidth; |
1788 | int iosize; | 1777 | int iosize; |
@@ -2047,9 +2036,9 @@ done: | |||
2047 | return 0; | 2036 | return 0; |
2048 | } | 2037 | } |
2049 | 2038 | ||
2050 | STATIC int | 2039 | int |
2051 | xfs_showargs( | 2040 | xfs_showargs( |
2052 | struct bhv_desc *bhv, | 2041 | struct xfs_mount *mp, |
2053 | struct seq_file *m) | 2042 | struct seq_file *m) |
2054 | { | 2043 | { |
2055 | static struct proc_xfs_info { | 2044 | static struct proc_xfs_info { |
@@ -2067,7 +2056,6 @@ xfs_showargs( | |||
2067 | { 0, NULL } | 2056 | { 0, NULL } |
2068 | }; | 2057 | }; |
2069 | struct proc_xfs_info *xfs_infop; | 2058 | struct proc_xfs_info *xfs_infop; |
2070 | struct xfs_mount *mp = XFS_BHVTOM(bhv); | ||
2071 | struct bhv_vfs *vfsp = XFS_MTOVFS(mp); | 2059 | struct bhv_vfs *vfsp = XFS_MTOVFS(mp); |
2072 | 2060 | ||
2073 | for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) { | 2061 | for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) { |
@@ -2142,28 +2130,8 @@ xfs_showargs( | |||
2142 | */ | 2130 | */ |
2143 | STATIC void | 2131 | STATIC void |
2144 | xfs_freeze( | 2132 | xfs_freeze( |
2145 | bhv_desc_t *bdp) | 2133 | xfs_mount_t *mp) |
2146 | { | 2134 | { |
2147 | xfs_mount_t *mp = XFS_BHVTOM(bdp); | ||
2148 | |||
2149 | xfs_attr_quiesce(mp); | 2135 | xfs_attr_quiesce(mp); |
2150 | xfs_fs_log_dummy(mp); | 2136 | xfs_fs_log_dummy(mp); |
2151 | } | 2137 | } |
2152 | |||
2153 | |||
2154 | bhv_vfsops_t xfs_vfsops = { | ||
2155 | BHV_IDENTITY_INIT(VFS_BHV_XFS,VFS_POSITION_XFS), | ||
2156 | .vfs_parseargs = xfs_parseargs, | ||
2157 | .vfs_showargs = xfs_showargs, | ||
2158 | .vfs_mount = xfs_mount, | ||
2159 | .vfs_unmount = xfs_unmount, | ||
2160 | .vfs_mntupdate = xfs_mntupdate, | ||
2161 | .vfs_root = xfs_root, | ||
2162 | .vfs_statvfs = xfs_statvfs, | ||
2163 | .vfs_sync = xfs_sync, | ||
2164 | .vfs_vget = xfs_vget, | ||
2165 | .vfs_quotactl = (vfs_quotactl_t)fs_nosys, | ||
2166 | .vfs_init_vnode = xfs_initialize_vnode, | ||
2167 | .vfs_force_shutdown = xfs_do_force_shutdown, | ||
2168 | .vfs_freeze = xfs_freeze, | ||
2169 | }; | ||