diff options
| author | Christoph Hellwig <hch@infradead.org> | 2007-08-30 03:20:39 -0400 |
|---|---|---|
| committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 21:44:08 -0400 |
| commit | 745f691912b700ac98607b525f3c892204c7f12f (patch) | |
| tree | 4988bdf45dec4bc9bffd432fc3e521b73836172f /fs/xfs | |
| parent | 48c872a9f3ec4cdc37801aae9ef16c80026503ea (diff) | |
[XFS] call common xfs vfs-level helpers directly and remove vfs operations
Also remove the now dead behavior code.
SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29505a
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')
| -rw-r--r-- | fs/xfs/Makefile-linux-2.6 | 2 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_export.c | 4 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_linux.h | 1 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.h | 1 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 56 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_super.h | 3 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_vfs.c | 67 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_vfs.h | 121 | ||||
| -rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.c | 4 | ||||
| -rw-r--r-- | fs/xfs/xfs_behavior.c | 183 | ||||
| -rw-r--r-- | fs/xfs/xfs_behavior.h | 185 | ||||
| -rw-r--r-- | fs/xfs/xfs_iget.c | 6 | ||||
| -rw-r--r-- | fs/xfs/xfs_inode.c | 2 | ||||
| -rw-r--r-- | fs/xfs/xfs_mount.c | 12 | ||||
| -rw-r--r-- | fs/xfs/xfs_mount.h | 21 | ||||
| -rw-r--r-- | fs/xfs/xfs_vfsops.c | 9 | ||||
| -rw-r--r-- | fs/xfs/xfs_vfsops.h | 3 | ||||
| -rw-r--r-- | fs/xfs/xfs_vfsops_bhv.c | 145 |
18 files changed, 51 insertions, 774 deletions
diff --git a/fs/xfs/Makefile-linux-2.6 b/fs/xfs/Makefile-linux-2.6 index 0e474785ebae..85b0de65bd9b 100644 --- a/fs/xfs/Makefile-linux-2.6 +++ b/fs/xfs/Makefile-linux-2.6 | |||
| @@ -49,7 +49,6 @@ xfs-y += xfs_alloc.o \ | |||
| 49 | xfs_alloc_btree.o \ | 49 | xfs_alloc_btree.o \ |
| 50 | xfs_attr.o \ | 50 | xfs_attr.o \ |
| 51 | xfs_attr_leaf.o \ | 51 | xfs_attr_leaf.o \ |
| 52 | xfs_behavior.o \ | ||
| 53 | xfs_bit.o \ | 52 | xfs_bit.o \ |
| 54 | xfs_bmap.o \ | 53 | xfs_bmap.o \ |
| 55 | xfs_bmap_btree.o \ | 54 | xfs_bmap_btree.o \ |
| @@ -88,7 +87,6 @@ xfs-y += xfs_alloc.o \ | |||
| 88 | xfs_trans_item.o \ | 87 | xfs_trans_item.o \ |
| 89 | xfs_utils.o \ | 88 | xfs_utils.o \ |
| 90 | xfs_vfsops.o \ | 89 | xfs_vfsops.o \ |
| 91 | xfs_vfsops_bhv.o \ | ||
| 92 | xfs_vnodeops.o \ | 90 | xfs_vnodeops.o \ |
| 93 | xfs_rw.o \ | 91 | xfs_rw.o \ |
| 94 | xfs_dmops.o \ | 92 | xfs_dmops.o \ |
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c index 0919021d56c4..4ed28a6767bb 100644 --- a/fs/xfs/linux-2.6/xfs_export.c +++ b/fs/xfs/linux-2.6/xfs_export.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include "xfs_vnodeops.h" | 28 | #include "xfs_vnodeops.h" |
| 29 | #include "xfs_bmap_btree.h" | 29 | #include "xfs_bmap_btree.h" |
| 30 | #include "xfs_inode.h" | 30 | #include "xfs_inode.h" |
| 31 | #include "xfs_vfsops.h" | ||
| 31 | 32 | ||
| 32 | static struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, }; | 33 | static struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, }; |
| 33 | 34 | ||
| @@ -143,10 +144,9 @@ xfs_fs_get_dentry( | |||
| 143 | bhv_vnode_t *vp; | 144 | bhv_vnode_t *vp; |
| 144 | struct inode *inode; | 145 | struct inode *inode; |
| 145 | struct dentry *result; | 146 | struct dentry *result; |
| 146 | bhv_vfs_t *vfsp = vfs_from_sb(sb); | ||
| 147 | int error; | 147 | int error; |
| 148 | 148 | ||
| 149 | error = bhv_vfs_vget(vfsp, &vp, (fid_t *)data); | 149 | error = xfs_vget(XFS_M(sb), &vp, (fid_t *)data); |
| 150 | if (error || vp == NULL) | 150 | if (error || vp == NULL) |
| 151 | return ERR_PTR(-ESTALE) ; | 151 | return ERR_PTR(-ESTALE) ; |
| 152 | 152 | ||
diff --git a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h index ab634a775d23..dc3752de22da 100644 --- a/fs/xfs/linux-2.6/xfs_linux.h +++ b/fs/xfs/linux-2.6/xfs_linux.h | |||
| @@ -83,7 +83,6 @@ | |||
| 83 | #include <asm/byteorder.h> | 83 | #include <asm/byteorder.h> |
| 84 | #include <asm/unaligned.h> | 84 | #include <asm/unaligned.h> |
| 85 | 85 | ||
| 86 | #include <xfs_behavior.h> | ||
| 87 | #include <xfs_vfs.h> | 86 | #include <xfs_vfs.h> |
| 88 | #include <xfs_cred.h> | 87 | #include <xfs_cred.h> |
| 89 | #include <xfs_vnode.h> | 88 | #include <xfs_vnode.h> |
diff --git a/fs/xfs/linux-2.6/xfs_lrw.h b/fs/xfs/linux-2.6/xfs_lrw.h index 4cd85c3360f5..4b7747a828d9 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.h +++ b/fs/xfs/linux-2.6/xfs_lrw.h | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | #ifndef __XFS_LRW_H__ | 18 | #ifndef __XFS_LRW_H__ |
| 19 | #define __XFS_LRW_H__ | 19 | #define __XFS_LRW_H__ |
| 20 | 20 | ||
| 21 | struct bhv_desc; | ||
| 22 | struct xfs_mount; | 21 | struct xfs_mount; |
| 23 | struct xfs_iocore; | 22 | struct xfs_iocore; |
| 24 | struct xfs_inode; | 23 | struct xfs_inode; |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 0cb149ad65cc..24bc0afb003c 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
| @@ -47,6 +47,7 @@ | |||
| 47 | #include "xfs_buf_item.h" | 47 | #include "xfs_buf_item.h" |
| 48 | #include "xfs_utils.h" | 48 | #include "xfs_utils.h" |
| 49 | #include "xfs_vnodeops.h" | 49 | #include "xfs_vnodeops.h" |
| 50 | #include "xfs_vfsops.h" | ||
| 50 | #include "xfs_version.h" | 51 | #include "xfs_version.h" |
| 51 | 52 | ||
| 52 | #include <linux/namei.h> | 53 | #include <linux/namei.h> |
| @@ -204,8 +205,7 @@ void | |||
| 204 | xfs_initialize_vnode( | 205 | xfs_initialize_vnode( |
| 205 | struct xfs_mount *mp, | 206 | struct xfs_mount *mp, |
| 206 | bhv_vnode_t *vp, | 207 | bhv_vnode_t *vp, |
| 207 | struct xfs_inode *ip, | 208 | struct xfs_inode *ip) |
| 208 | int unlock) | ||
| 209 | { | 209 | { |
| 210 | struct inode *inode = vn_to_inode(vp); | 210 | struct inode *inode = vn_to_inode(vp); |
| 211 | 211 | ||
| @@ -221,7 +221,7 @@ xfs_initialize_vnode( | |||
| 221 | * second time once the inode is properly set up, and then we can | 221 | * second time once the inode is properly set up, and then we can |
| 222 | * finish our work. | 222 | * finish our work. |
| 223 | */ | 223 | */ |
| 224 | if (ip->i_d.di_mode != 0 && unlock && (inode->i_state & I_NEW)) { | 224 | if (ip->i_d.di_mode != 0 && (inode->i_state & I_NEW)) { |
| 225 | xfs_revalidate_inode(mp, vp, ip); | 225 | xfs_revalidate_inode(mp, vp, ip); |
| 226 | xfs_set_inodeops(inode); | 226 | xfs_set_inodeops(inode); |
| 227 | 227 | ||
| @@ -535,9 +535,8 @@ vfs_sync_worker( | |||
| 535 | int error; | 535 | int error; |
| 536 | 536 | ||
| 537 | if (!(vfsp->vfs_flag & VFS_RDONLY)) | 537 | if (!(vfsp->vfs_flag & VFS_RDONLY)) |
| 538 | error = bhv_vfs_sync(vfsp, SYNC_FSDATA | SYNC_BDFLUSH | \ | 538 | error = xfs_sync(XFS_VFSTOM(vfsp), SYNC_FSDATA | SYNC_BDFLUSH | \ |
| 539 | SYNC_ATTR | SYNC_REFCACHE | SYNC_SUPER, | 539 | SYNC_ATTR | SYNC_REFCACHE | SYNC_SUPER); |
| 540 | NULL); | ||
| 541 | vfsp->vfs_sync_seq++; | 540 | vfsp->vfs_sync_seq++; |
| 542 | wake_up(&vfsp->vfs_wait_single_sync_task); | 541 | wake_up(&vfsp->vfs_wait_single_sync_task); |
| 543 | } | 542 | } |
| @@ -614,11 +613,12 @@ xfs_fs_put_super( | |||
| 614 | struct super_block *sb) | 613 | struct super_block *sb) |
| 615 | { | 614 | { |
| 616 | bhv_vfs_t *vfsp = vfs_from_sb(sb); | 615 | bhv_vfs_t *vfsp = vfs_from_sb(sb); |
| 616 | struct xfs_mount *mp = XFS_M(sb); | ||
| 617 | int error; | 617 | int error; |
| 618 | 618 | ||
| 619 | xfs_fs_stop_syncd(vfsp); | 619 | xfs_fs_stop_syncd(vfsp); |
| 620 | bhv_vfs_sync(vfsp, SYNC_ATTR | SYNC_DELWRI, NULL); | 620 | xfs_sync(mp, SYNC_ATTR | SYNC_DELWRI); |
| 621 | error = bhv_vfs_unmount(vfsp, 0, NULL); | 621 | error = xfs_unmount(mp, 0, NULL); |
| 622 | if (error) { | 622 | if (error) { |
| 623 | printk("XFS: unmount got error=%d\n", error); | 623 | printk("XFS: unmount got error=%d\n", error); |
| 624 | printk("%s: vfs=0x%p left dangling!\n", __FUNCTION__, vfsp); | 624 | printk("%s: vfs=0x%p left dangling!\n", __FUNCTION__, vfsp); |
| @@ -632,7 +632,7 @@ xfs_fs_write_super( | |||
| 632 | struct super_block *sb) | 632 | struct super_block *sb) |
| 633 | { | 633 | { |
| 634 | if (!(sb->s_flags & MS_RDONLY)) | 634 | if (!(sb->s_flags & MS_RDONLY)) |
| 635 | bhv_vfs_sync(vfs_from_sb(sb), SYNC_FSDATA, NULL); | 635 | xfs_sync(XFS_M(sb), SYNC_FSDATA); |
| 636 | sb->s_dirt = 0; | 636 | sb->s_dirt = 0; |
| 637 | } | 637 | } |
| 638 | 638 | ||
| @@ -642,6 +642,7 @@ xfs_fs_sync_super( | |||
| 642 | int wait) | 642 | int wait) |
| 643 | { | 643 | { |
| 644 | bhv_vfs_t *vfsp = vfs_from_sb(sb); | 644 | bhv_vfs_t *vfsp = vfs_from_sb(sb); |
| 645 | struct xfs_mount *mp = XFS_M(sb); | ||
| 645 | int error; | 646 | int error; |
| 646 | int flags; | 647 | int flags; |
| 647 | 648 | ||
| @@ -658,7 +659,7 @@ xfs_fs_sync_super( | |||
| 658 | } else | 659 | } else |
| 659 | flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); | 660 | flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); |
| 660 | 661 | ||
| 661 | error = bhv_vfs_sync(vfsp, flags, NULL); | 662 | error = xfs_sync(mp, flags); |
| 662 | sb->s_dirt = 0; | 663 | sb->s_dirt = 0; |
| 663 | 664 | ||
| 664 | if (unlikely(laptop_mode)) { | 665 | if (unlikely(laptop_mode)) { |
| @@ -688,7 +689,7 @@ xfs_fs_statfs( | |||
| 688 | struct dentry *dentry, | 689 | struct dentry *dentry, |
| 689 | struct kstatfs *statp) | 690 | struct kstatfs *statp) |
| 690 | { | 691 | { |
| 691 | return -bhv_vfs_statvfs(vfs_from_sb(dentry->d_sb), statp, | 692 | return -xfs_statvfs(XFS_M(dentry->d_sb), statp, |
| 692 | vn_from_inode(dentry->d_inode)); | 693 | vn_from_inode(dentry->d_inode)); |
| 693 | } | 694 | } |
| 694 | 695 | ||
| @@ -698,13 +699,13 @@ xfs_fs_remount( | |||
| 698 | int *flags, | 699 | int *flags, |
| 699 | char *options) | 700 | char *options) |
| 700 | { | 701 | { |
| 701 | bhv_vfs_t *vfsp = vfs_from_sb(sb); | 702 | struct xfs_mount *mp = XFS_M(sb); |
| 702 | struct xfs_mount_args *args = xfs_args_allocate(sb, 0); | 703 | struct xfs_mount_args *args = xfs_args_allocate(sb, 0); |
| 703 | int error; | 704 | int error; |
| 704 | 705 | ||
| 705 | error = bhv_vfs_parseargs(vfsp, options, args, 1); | 706 | error = xfs_parseargs(mp, options, args, 1); |
| 706 | if (!error) | 707 | if (!error) |
| 707 | error = bhv_vfs_mntupdate(vfsp, flags, args); | 708 | error = xfs_mntupdate(mp, flags, args); |
| 708 | kmem_free(args, sizeof(*args)); | 709 | kmem_free(args, sizeof(*args)); |
| 709 | return -error; | 710 | return -error; |
| 710 | } | 711 | } |
| @@ -713,7 +714,7 @@ STATIC void | |||
| 713 | xfs_fs_lockfs( | 714 | xfs_fs_lockfs( |
| 714 | struct super_block *sb) | 715 | struct super_block *sb) |
| 715 | { | 716 | { |
| 716 | bhv_vfs_freeze(vfs_from_sb(sb)); | 717 | xfs_freeze(XFS_M(sb)); |
| 717 | } | 718 | } |
| 718 | 719 | ||
| 719 | STATIC int | 720 | STATIC int |
| @@ -721,7 +722,7 @@ xfs_fs_show_options( | |||
| 721 | struct seq_file *m, | 722 | struct seq_file *m, |
| 722 | struct vfsmount *mnt) | 723 | struct vfsmount *mnt) |
| 723 | { | 724 | { |
| 724 | return -bhv_vfs_showargs(vfs_from_sb(mnt->mnt_sb), m); | 725 | return -xfs_showargs(XFS_M(mnt->mnt_sb), m); |
| 725 | } | 726 | } |
| 726 | 727 | ||
| 727 | STATIC int | 728 | STATIC int |
| @@ -783,30 +784,29 @@ xfs_fs_fill_super( | |||
| 783 | { | 784 | { |
| 784 | struct inode *rootvp; | 785 | struct inode *rootvp; |
| 785 | struct bhv_vfs *vfsp = vfs_allocate(sb); | 786 | struct bhv_vfs *vfsp = vfs_allocate(sb); |
| 787 | struct xfs_mount *mp = NULL; | ||
| 786 | struct xfs_mount_args *args = xfs_args_allocate(sb, silent); | 788 | struct xfs_mount_args *args = xfs_args_allocate(sb, silent); |
| 787 | struct kstatfs statvfs; | 789 | struct kstatfs statvfs; |
| 788 | int error; | 790 | int error; |
| 789 | 791 | ||
| 790 | bhv_insert_all_vfsops(vfsp); | 792 | mp = xfs_mount_init(); |
| 793 | mp->m_vfsp = vfsp; | ||
| 794 | vfsp->vfs_mount = mp; | ||
| 791 | 795 | ||
| 792 | error = bhv_vfs_parseargs(vfsp, (char *)data, args, 0); | 796 | error = xfs_parseargs(mp, (char *)data, args, 0); |
| 793 | if (error) { | 797 | if (error) |
| 794 | bhv_remove_all_vfsops(vfsp, 1); | ||
| 795 | goto fail_vfsop; | 798 | goto fail_vfsop; |
| 796 | } | ||
| 797 | 799 | ||
| 798 | sb_min_blocksize(sb, BBSIZE); | 800 | sb_min_blocksize(sb, BBSIZE); |
| 799 | sb->s_export_op = &xfs_export_operations; | 801 | sb->s_export_op = &xfs_export_operations; |
| 800 | sb->s_qcop = &xfs_quotactl_operations; | 802 | sb->s_qcop = &xfs_quotactl_operations; |
| 801 | sb->s_op = &xfs_super_operations; | 803 | sb->s_op = &xfs_super_operations; |
| 802 | 804 | ||
| 803 | error = bhv_vfs_mount(vfsp, args, NULL); | 805 | error = xfs_mount(mp, args, NULL); |
| 804 | if (error) { | 806 | if (error) |
| 805 | bhv_remove_all_vfsops(vfsp, 1); | ||
| 806 | goto fail_vfsop; | 807 | goto fail_vfsop; |
| 807 | } | ||
| 808 | 808 | ||
| 809 | error = bhv_vfs_statvfs(vfsp, &statvfs, NULL); | 809 | error = xfs_statvfs(mp, &statvfs, NULL); |
| 810 | if (error) | 810 | if (error) |
| 811 | goto fail_unmount; | 811 | goto fail_unmount; |
| 812 | 812 | ||
| @@ -818,7 +818,7 @@ xfs_fs_fill_super( | |||
| 818 | sb->s_time_gran = 1; | 818 | sb->s_time_gran = 1; |
| 819 | set_posix_acl_flag(sb); | 819 | set_posix_acl_flag(sb); |
| 820 | 820 | ||
| 821 | error = bhv_vfs_root(vfsp, &rootvp); | 821 | error = xfs_root(mp, &rootvp); |
| 822 | if (error) | 822 | if (error) |
| 823 | goto fail_unmount; | 823 | goto fail_unmount; |
| 824 | 824 | ||
| @@ -848,7 +848,7 @@ fail_vnrele: | |||
| 848 | } | 848 | } |
| 849 | 849 | ||
| 850 | fail_unmount: | 850 | fail_unmount: |
| 851 | bhv_vfs_unmount(vfsp, 0, NULL); | 851 | xfs_unmount(mp, 0, NULL); |
| 852 | 852 | ||
| 853 | fail_vfsop: | 853 | fail_vfsop: |
| 854 | vfs_deallocate(vfsp); | 854 | vfs_deallocate(vfsp); |
diff --git a/fs/xfs/linux-2.6/xfs_super.h b/fs/xfs/linux-2.6/xfs_super.h index dba6f1cc348a..529ada86f2c9 100644 --- a/fs/xfs/linux-2.6/xfs_super.h +++ b/fs/xfs/linux-2.6/xfs_super.h | |||
| @@ -107,6 +107,9 @@ struct block_device; | |||
| 107 | 107 | ||
| 108 | extern __uint64_t xfs_max_file_offset(unsigned int); | 108 | extern __uint64_t xfs_max_file_offset(unsigned int); |
| 109 | 109 | ||
| 110 | extern void xfs_initialize_vnode(struct xfs_mount *mp, bhv_vnode_t *vp, | ||
| 111 | struct xfs_inode *ip); | ||
| 112 | |||
| 110 | extern void xfs_flush_inode(struct xfs_inode *); | 113 | extern void xfs_flush_inode(struct xfs_inode *); |
| 111 | extern void xfs_flush_device(struct xfs_inode *); | 114 | extern void xfs_flush_device(struct xfs_inode *); |
| 112 | 115 | ||
diff --git a/fs/xfs/linux-2.6/xfs_vfs.c b/fs/xfs/linux-2.6/xfs_vfs.c index 5f616ccaea8d..573e52a24072 100644 --- a/fs/xfs/linux-2.6/xfs_vfs.c +++ b/fs/xfs/linux-2.6/xfs_vfs.c | |||
| @@ -204,7 +204,6 @@ vfs_allocate( | |||
| 204 | struct bhv_vfs *vfsp; | 204 | struct bhv_vfs *vfsp; |
| 205 | 205 | ||
| 206 | vfsp = kmem_zalloc(sizeof(bhv_vfs_t), KM_SLEEP); | 206 | vfsp = kmem_zalloc(sizeof(bhv_vfs_t), KM_SLEEP); |
| 207 | bhv_head_init(VFS_BHVHEAD(vfsp), "vfs"); | ||
| 208 | INIT_LIST_HEAD(&vfsp->vfs_sync_list); | 207 | INIT_LIST_HEAD(&vfsp->vfs_sync_list); |
| 209 | spin_lock_init(&vfsp->vfs_sync_lock); | 208 | spin_lock_init(&vfsp->vfs_sync_lock); |
| 210 | init_waitqueue_head(&vfsp->vfs_wait_single_sync_task); | 209 | init_waitqueue_head(&vfsp->vfs_wait_single_sync_task); |
| @@ -229,71 +228,5 @@ void | |||
| 229 | vfs_deallocate( | 228 | vfs_deallocate( |
| 230 | struct bhv_vfs *vfsp) | 229 | struct bhv_vfs *vfsp) |
| 231 | { | 230 | { |
| 232 | bhv_head_destroy(VFS_BHVHEAD(vfsp)); | ||
| 233 | kmem_free(vfsp, sizeof(bhv_vfs_t)); | 231 | kmem_free(vfsp, sizeof(bhv_vfs_t)); |
| 234 | } | 232 | } |
| 235 | |||
| 236 | void | ||
| 237 | vfs_insertops( | ||
| 238 | struct bhv_vfs *vfsp, | ||
| 239 | struct bhv_module_vfsops *vfsops) | ||
| 240 | { | ||
| 241 | struct bhv_desc *bdp; | ||
| 242 | |||
| 243 | bdp = kmem_alloc(sizeof(struct bhv_desc), KM_SLEEP); | ||
| 244 | bhv_desc_init(bdp, NULL, vfsp, vfsops); | ||
| 245 | bhv_insert(&vfsp->vfs_bh, bdp); | ||
| 246 | } | ||
| 247 | |||
| 248 | void | ||
| 249 | vfs_insertbhv( | ||
| 250 | struct bhv_vfs *vfsp, | ||
| 251 | struct bhv_desc *bdp, | ||
| 252 | struct bhv_vfsops *vfsops, | ||
| 253 | void *mount) | ||
| 254 | { | ||
| 255 | bhv_desc_init(bdp, mount, vfsp, vfsops); | ||
| 256 | bhv_insert_initial(&vfsp->vfs_bh, bdp); | ||
| 257 | } | ||
| 258 | |||
| 259 | void | ||
| 260 | bhv_remove_vfsops( | ||
| 261 | struct bhv_vfs *vfsp, | ||
| 262 | int pos) | ||
| 263 | { | ||
| 264 | struct bhv_desc *bhv; | ||
| 265 | |||
| 266 | bhv = bhv_lookup_range(&vfsp->vfs_bh, pos, pos); | ||
| 267 | if (!bhv) | ||
| 268 | return; | ||
| 269 | bhv_remove(&vfsp->vfs_bh, bhv); | ||
| 270 | kmem_free(bhv, sizeof(*bhv)); | ||
| 271 | } | ||
| 272 | |||
| 273 | void | ||
| 274 | bhv_remove_all_vfsops( | ||
| 275 | struct bhv_vfs *vfsp, | ||
| 276 | int freebase) | ||
| 277 | { | ||
| 278 | struct xfs_mount *mp; | ||
| 279 | |||
| 280 | bhv_remove_vfsops(vfsp, VFS_POSITION_QM); | ||
| 281 | if (!freebase) | ||
| 282 | return; | ||
| 283 | mp = XFS_VFSTOM(vfsp); | ||
| 284 | VFS_REMOVEBHV(vfsp, &mp->m_bhv); | ||
| 285 | xfs_mount_free(mp, 0); | ||
| 286 | kmem_free(mp, sizeof(xfs_mount_t)); | ||
| 287 | } | ||
| 288 | |||
| 289 | void | ||
| 290 | bhv_insert_all_vfsops( | ||
| 291 | struct bhv_vfs *vfsp) | ||
| 292 | { | ||
| 293 | struct xfs_mount *mp; | ||
| 294 | |||
| 295 | mp = xfs_mount_init(); | ||
| 296 | vfs_insertbhv(vfsp, &mp->m_bhv, &xfs_vfsops, mp); | ||
| 297 | vfs_insertdmapi(vfsp); | ||
| 298 | vfs_insertquota(vfsp); | ||
| 299 | } | ||
diff --git a/fs/xfs/linux-2.6/xfs_vfs.h b/fs/xfs/linux-2.6/xfs_vfs.h index e63b2d012f0c..04303cb911c7 100644 --- a/fs/xfs/linux-2.6/xfs_vfs.h +++ b/fs/xfs/linux-2.6/xfs_vfs.h | |||
| @@ -29,6 +29,7 @@ struct cred; | |||
| 29 | struct seq_file; | 29 | struct seq_file; |
| 30 | struct super_block; | 30 | struct super_block; |
| 31 | struct xfs_inode; | 31 | struct xfs_inode; |
| 32 | struct xfs_mount; | ||
| 32 | struct xfs_mount_args; | 33 | struct xfs_mount_args; |
| 33 | 34 | ||
| 34 | typedef struct kstatfs bhv_statvfs_t; | 35 | typedef struct kstatfs bhv_statvfs_t; |
| @@ -41,10 +42,10 @@ typedef struct bhv_vfs_sync_work { | |||
| 41 | } bhv_vfs_sync_work_t; | 42 | } bhv_vfs_sync_work_t; |
| 42 | 43 | ||
| 43 | typedef struct bhv_vfs { | 44 | typedef struct bhv_vfs { |
| 45 | struct xfs_mount *vfs_mount; | ||
| 44 | u_int vfs_flag; /* flags */ | 46 | u_int vfs_flag; /* flags */ |
| 45 | xfs_fsid_t vfs_fsid; /* file system ID */ | 47 | xfs_fsid_t vfs_fsid; /* file system ID */ |
| 46 | xfs_fsid_t *vfs_altfsid; /* An ID fixed for life of FS */ | 48 | xfs_fsid_t *vfs_altfsid; /* An ID fixed for life of FS */ |
| 47 | bhv_head_t vfs_bh; /* head of vfs behavior chain */ | ||
| 48 | struct super_block *vfs_super; /* generic superblock pointer */ | 49 | struct super_block *vfs_super; /* generic superblock pointer */ |
| 49 | struct task_struct *vfs_sync_task; /* generalised sync thread */ | 50 | struct task_struct *vfs_sync_task; /* generalised sync thread */ |
| 50 | bhv_vfs_sync_work_t vfs_sync_work; /* work item for VFS_SYNC */ | 51 | bhv_vfs_sync_work_t vfs_sync_work; /* work item for VFS_SYNC */ |
| @@ -54,27 +55,6 @@ typedef struct bhv_vfs { | |||
| 54 | wait_queue_head_t vfs_wait_single_sync_task; | 55 | wait_queue_head_t vfs_wait_single_sync_task; |
| 55 | } bhv_vfs_t; | 56 | } bhv_vfs_t; |
| 56 | 57 | ||
| 57 | #define bhvtovfs(bdp) ( (struct bhv_vfs *)BHV_VOBJ(bdp) ) | ||
| 58 | #define bhvtovfsops(bdp) ( (struct bhv_vfsops *)BHV_OPS(bdp) ) | ||
| 59 | #define VFS_BHVHEAD(vfs) ( &(vfs)->vfs_bh ) | ||
| 60 | #define VFS_REMOVEBHV(vfs, bdp) ( bhv_remove(VFS_BHVHEAD(vfs), bdp) ) | ||
| 61 | |||
| 62 | #define VFS_POSITION_BASE BHV_POSITION_BASE /* chain bottom */ | ||
| 63 | #define VFS_POSITION_TOP BHV_POSITION_TOP /* chain top */ | ||
| 64 | #define VFS_POSITION_INVALID BHV_POSITION_INVALID /* invalid pos. num */ | ||
| 65 | |||
| 66 | typedef enum { | ||
| 67 | VFS_BHV_UNKNOWN, /* not specified */ | ||
| 68 | VFS_BHV_XFS, /* xfs */ | ||
| 69 | VFS_BHV_QM, /* quota manager */ | ||
| 70 | VFS_BHV_IO, /* IO path */ | ||
| 71 | VFS_BHV_END /* housekeeping end-of-range */ | ||
| 72 | } bhv_vfs_type_t; | ||
| 73 | |||
| 74 | #define VFS_POSITION_XFS (BHV_POSITION_BASE) | ||
| 75 | #define VFS_POSITION_QM (VFS_POSITION_BASE+20) | ||
| 76 | #define VFS_POSITION_IO (VFS_POSITION_BASE+30) | ||
| 77 | |||
| 78 | #define VFS_RDONLY 0x0001 /* read-only vfs */ | 58 | #define VFS_RDONLY 0x0001 /* read-only vfs */ |
| 79 | #define VFS_GRPID 0x0002 /* group-ID assigned from directory */ | 59 | #define VFS_GRPID 0x0002 /* group-ID assigned from directory */ |
| 80 | #define VFS_DMI 0x0004 /* filesystem has the DMI enabled */ | 60 | #define VFS_DMI 0x0004 /* filesystem has the DMI enabled */ |
| @@ -114,108 +94,11 @@ typedef enum { | |||
| 114 | #define SHUTDOWN_REMOTE_REQ 0x0010 /* shutdown came from remote cell */ | 94 | #define SHUTDOWN_REMOTE_REQ 0x0010 /* shutdown came from remote cell */ |
| 115 | #define SHUTDOWN_DEVICE_REQ 0x0020 /* failed all paths to the device */ | 95 | #define SHUTDOWN_DEVICE_REQ 0x0020 /* failed all paths to the device */ |
| 116 | 96 | ||
| 117 | typedef int (*vfs_mount_t)(bhv_desc_t *, | ||
| 118 | struct xfs_mount_args *, struct cred *); | ||
| 119 | typedef int (*vfs_parseargs_t)(bhv_desc_t *, char *, | ||
| 120 | struct xfs_mount_args *, int); | ||
| 121 | typedef int (*vfs_showargs_t)(bhv_desc_t *, struct seq_file *); | ||
| 122 | typedef int (*vfs_unmount_t)(bhv_desc_t *, int, struct cred *); | ||
| 123 | typedef int (*vfs_mntupdate_t)(bhv_desc_t *, int *, | ||
| 124 | struct xfs_mount_args *); | ||
| 125 | typedef int (*vfs_root_t)(bhv_desc_t *, struct inode **); | ||
| 126 | typedef int (*vfs_statvfs_t)(bhv_desc_t *, bhv_statvfs_t *, | ||
| 127 | struct inode *); | ||
| 128 | typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *); | ||
| 129 | typedef int (*vfs_vget_t)(bhv_desc_t *, struct inode **, struct fid *); | ||
| 130 | typedef void (*vfs_init_vnode_t)(bhv_desc_t *, | ||
| 131 | struct inode *, struct xfs_inode *, int); | ||
| 132 | typedef void (*vfs_force_shutdown_t)(bhv_desc_t *, int, char *, int); | ||
| 133 | typedef void (*vfs_freeze_t)(bhv_desc_t *); | ||
| 134 | |||
| 135 | typedef struct bhv_vfsops { | ||
| 136 | bhv_position_t vf_position; /* behavior chain position */ | ||
| 137 | vfs_mount_t vfs_mount; /* mount file system */ | ||
| 138 | vfs_parseargs_t vfs_parseargs; /* parse mount options */ | ||
| 139 | vfs_showargs_t vfs_showargs; /* unparse mount options */ | ||
| 140 | vfs_unmount_t vfs_unmount; /* unmount file system */ | ||
| 141 | vfs_mntupdate_t vfs_mntupdate; /* update file system options */ | ||
| 142 | vfs_root_t vfs_root; /* get root vnode */ | ||
| 143 | vfs_statvfs_t vfs_statvfs; /* file system statistics */ | ||
| 144 | vfs_sync_t vfs_sync; /* flush files */ | ||
| 145 | vfs_vget_t vfs_vget; /* get vnode from fid */ | ||
| 146 | vfs_init_vnode_t vfs_init_vnode; /* initialize a new vnode */ | ||
| 147 | vfs_force_shutdown_t vfs_force_shutdown; /* crash and burn */ | ||
| 148 | vfs_freeze_t vfs_freeze; /* freeze fs for snapshot */ | ||
| 149 | } bhv_vfsops_t; | ||
| 150 | |||
| 151 | /* | ||
| 152 | * Virtual filesystem operations, operating from head bhv. | ||
| 153 | */ | ||
| 154 | #define VFSHEAD(v) ((v)->vfs_bh.bh_first) | ||
| 155 | #define bhv_vfs_mount(v, ma,cr) vfs_mount(VFSHEAD(v), ma,cr) | ||
| 156 | #define bhv_vfs_parseargs(v, o,ma,f) vfs_parseargs(VFSHEAD(v), o,ma,f) | ||
| 157 | #define bhv_vfs_showargs(v, m) vfs_showargs(VFSHEAD(v), m) | ||
| 158 | #define bhv_vfs_unmount(v, f,cr) vfs_unmount(VFSHEAD(v), f,cr) | ||
| 159 | #define bhv_vfs_mntupdate(v, fl,args) vfs_mntupdate(VFSHEAD(v), fl,args) | ||
| 160 | #define bhv_vfs_root(v, vpp) vfs_root(VFSHEAD(v), vpp) | ||
| 161 | #define bhv_vfs_statvfs(v, sp,vp) vfs_statvfs(VFSHEAD(v), sp,vp) | ||
| 162 | #define bhv_vfs_sync(v, flag,cr) vfs_sync(VFSHEAD(v), flag,cr) | ||
| 163 | #define bhv_vfs_vget(v, vpp,fidp) vfs_vget(VFSHEAD(v), vpp,fidp) | ||
| 164 | #define bhv_vfs_init_vnode(v, vp,b,ul) vfs_init_vnode(VFSHEAD(v), vp,b,ul) | ||
| 165 | #define bhv_vfs_force_shutdown(v,u,f,l) vfs_force_shutdown(VFSHEAD(v), u,f,l) | ||
| 166 | #define bhv_vfs_freeze(v) vfs_freeze(VFSHEAD(v)) | ||
| 167 | |||
| 168 | /* | ||
| 169 | * Virtual filesystem operations, operating from next bhv. | ||
| 170 | */ | ||
| 171 | #define bhv_next_vfs_mount(b, ma,cr) vfs_mount(b, ma,cr) | ||
| 172 | #define bhv_next_vfs_parseargs(b, o,ma,f) vfs_parseargs(b, o,ma,f) | ||
| 173 | #define bhv_next_vfs_showargs(b, m) vfs_showargs(b, m) | ||
| 174 | #define bhv_next_vfs_unmount(b, f,cr) vfs_unmount(b, f,cr) | ||
| 175 | #define bhv_next_vfs_mntupdate(b, fl,args) vfs_mntupdate(b, fl, args) | ||
| 176 | #define bhv_next_vfs_root(b, vpp) vfs_root(b, vpp) | ||
| 177 | #define bhv_next_vfs_statvfs(b, sp,vp) vfs_statvfs(b, sp,vp) | ||
| 178 | #define bhv_next_vfs_sync(b, flag,cr) vfs_sync(b, flag,cr) | ||
| 179 | #define bhv_next_vfs_vget(b, vpp,fidp) vfs_vget(b, vpp,fidp) | ||
| 180 | #define bhv_next_vfs_init_vnode(b, vp,b2,ul) vfs_init_vnode(b, vp,b2,ul) | ||
| 181 | #define bhv_next_force_shutdown(b, fl,f,l) vfs_force_shutdown(b, fl,f,l) | ||
| 182 | #define bhv_next_vfs_freeze(b) vfs_freeze(b) | ||
| 183 | |||
| 184 | extern int vfs_mount(bhv_desc_t *, struct xfs_mount_args *, struct cred *); | ||
| 185 | extern int vfs_parseargs(bhv_desc_t *, char *, struct xfs_mount_args *, int); | ||
| 186 | extern int vfs_showargs(bhv_desc_t *, struct seq_file *); | ||
| 187 | extern int vfs_unmount(bhv_desc_t *, int, struct cred *); | ||
| 188 | extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *); | ||
| 189 | extern int vfs_root(bhv_desc_t *, struct inode **); | ||
| 190 | extern int vfs_statvfs(bhv_desc_t *, bhv_statvfs_t *, struct inode *); | ||
| 191 | extern int vfs_sync(bhv_desc_t *, int, struct cred *); | ||
| 192 | extern int vfs_vget(bhv_desc_t *, struct inode **, struct fid *); | ||
| 193 | extern void vfs_init_vnode(bhv_desc_t *, struct inode *, struct xfs_inode *, int); | ||
| 194 | extern void vfs_force_shutdown(bhv_desc_t *, int, char *, int); | ||
| 195 | extern void vfs_freeze(bhv_desc_t *); | ||
| 196 | |||
| 197 | #define vfs_test_for_freeze(vfs) ((vfs)->vfs_super->s_frozen) | 97 | #define vfs_test_for_freeze(vfs) ((vfs)->vfs_super->s_frozen) |
| 198 | #define vfs_wait_for_freeze(vfs,l) vfs_check_frozen((vfs)->vfs_super, (l)) | 98 | #define vfs_wait_for_freeze(vfs,l) vfs_check_frozen((vfs)->vfs_super, (l)) |
| 199 | 99 | ||
| 200 | typedef struct bhv_module_vfsops { | ||
| 201 | struct bhv_vfsops bhv_common; | ||
| 202 | void * bhv_custom; | ||
| 203 | } bhv_module_vfsops_t; | ||
| 204 | |||
| 205 | #define vfs_bhv_lookup(v, id) (bhv_lookup_range(&(v)->vfs_bh, (id), (id))) | ||
| 206 | #define vfs_bhv_custom(b) (((bhv_module_vfsops_t*)BHV_OPS(b))->bhv_custom) | ||
| 207 | #define vfs_bhv_set_custom(b,o) ((b)->bhv_custom = (void *)(o)) | ||
| 208 | #define vfs_bhv_clr_custom(b) ((b)->bhv_custom = NULL) | ||
| 209 | |||
| 210 | extern bhv_vfs_t *vfs_allocate(struct super_block *); | 100 | extern bhv_vfs_t *vfs_allocate(struct super_block *); |
| 211 | extern bhv_vfs_t *vfs_from_sb(struct super_block *); | 101 | extern bhv_vfs_t *vfs_from_sb(struct super_block *); |
| 212 | extern void vfs_deallocate(bhv_vfs_t *); | 102 | extern void vfs_deallocate(bhv_vfs_t *); |
| 213 | extern void vfs_insertbhv(bhv_vfs_t *, bhv_desc_t *, bhv_vfsops_t *, void *); | ||
| 214 | |||
| 215 | extern void vfs_insertops(bhv_vfs_t *, bhv_module_vfsops_t *); | ||
| 216 | |||
| 217 | extern void bhv_insert_all_vfsops(struct bhv_vfs *); | ||
| 218 | extern void bhv_remove_all_vfsops(struct bhv_vfs *, int); | ||
| 219 | extern void bhv_remove_vfsops(struct bhv_vfs *, int); | ||
| 220 | 103 | ||
| 221 | #endif /* __XFS_VFS_H__ */ | 104 | #endif /* __XFS_VFS_H__ */ |
diff --git a/fs/xfs/linux-2.6/xfs_vnode.c b/fs/xfs/linux-2.6/xfs_vnode.c index b7ff26780a0c..814169fd7e1e 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.c +++ b/fs/xfs/linux-2.6/xfs_vnode.c | |||
| @@ -78,10 +78,8 @@ vn_ioerror( | |||
| 78 | char *f, | 78 | char *f, |
| 79 | int l) | 79 | int l) |
| 80 | { | 80 | { |
| 81 | bhv_vfs_t *vfsp = XFS_MTOVFS(ip->i_mount); | ||
| 82 | |||
| 83 | if (unlikely(error == -ENODEV)) | 81 | if (unlikely(error == -ENODEV)) |
| 84 | bhv_vfs_force_shutdown(vfsp, SHUTDOWN_DEVICE_REQ, f, l); | 82 | xfs_do_force_shutdown(ip->i_mount, SHUTDOWN_DEVICE_REQ, f, l); |
| 85 | } | 83 | } |
| 86 | 84 | ||
| 87 | bhv_vnode_t * | 85 | bhv_vnode_t * |
diff --git a/fs/xfs/xfs_behavior.c b/fs/xfs/xfs_behavior.c deleted file mode 100644 index 0dc17219d412..000000000000 --- a/fs/xfs/xfs_behavior.c +++ /dev/null | |||
| @@ -1,183 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. | ||
| 3 | * All Rights Reserved. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU General Public License as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it would be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write the Free Software Foundation, | ||
| 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | #include "xfs.h" | ||
| 19 | |||
| 20 | /* | ||
| 21 | * Source file used to associate/disassociate behaviors with virtualized | ||
| 22 | * objects. See xfs_behavior.h for more information about behaviors, etc. | ||
| 23 | * | ||
| 24 | * The implementation is split between functions in this file and macros | ||
| 25 | * in xfs_behavior.h. | ||
| 26 | */ | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Insert a new behavior descriptor into a behavior chain. | ||
| 30 | * | ||
| 31 | * The behavior chain is ordered based on the 'position' number which | ||
| 32 | * lives in the first field of the ops vector (higher numbers first). | ||
| 33 | * | ||
| 34 | * Attempts to insert duplicate ops result in an EINVAL return code. | ||
| 35 | * Otherwise, return 0 to indicate success. | ||
| 36 | */ | ||
| 37 | int | ||
| 38 | bhv_insert(bhv_head_t *bhp, bhv_desc_t *bdp) | ||
| 39 | { | ||
| 40 | bhv_desc_t *curdesc, *prev; | ||
| 41 | int position; | ||
| 42 | |||
| 43 | /* | ||
| 44 | * Validate the position value of the new behavior. | ||
| 45 | */ | ||
| 46 | position = BHV_POSITION(bdp); | ||
| 47 | ASSERT(position >= BHV_POSITION_BASE && position <= BHV_POSITION_TOP); | ||
| 48 | |||
| 49 | /* | ||
| 50 | * Find location to insert behavior. Check for duplicates. | ||
| 51 | */ | ||
| 52 | prev = NULL; | ||
| 53 | for (curdesc = bhp->bh_first; | ||
| 54 | curdesc != NULL; | ||
| 55 | curdesc = curdesc->bd_next) { | ||
| 56 | |||
| 57 | /* Check for duplication. */ | ||
| 58 | if (curdesc->bd_ops == bdp->bd_ops) { | ||
| 59 | ASSERT(0); | ||
| 60 | return EINVAL; | ||
| 61 | } | ||
| 62 | |||
| 63 | /* Find correct position */ | ||
| 64 | if (position >= BHV_POSITION(curdesc)) { | ||
| 65 | ASSERT(position != BHV_POSITION(curdesc)); | ||
| 66 | break; /* found it */ | ||
| 67 | } | ||
| 68 | |||
| 69 | prev = curdesc; | ||
| 70 | } | ||
| 71 | |||
| 72 | if (prev == NULL) { | ||
| 73 | /* insert at front of chain */ | ||
| 74 | bdp->bd_next = bhp->bh_first; | ||
| 75 | bhp->bh_first = bdp; | ||
| 76 | } else { | ||
| 77 | /* insert after prev */ | ||
| 78 | bdp->bd_next = prev->bd_next; | ||
| 79 | prev->bd_next = bdp; | ||
| 80 | } | ||
| 81 | |||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | |||
| 85 | /* | ||
| 86 | * Remove a behavior descriptor from a position in a behavior chain; | ||
| 87 | * the position is guaranteed not to be the first position. | ||
| 88 | * Should only be called by the bhv_remove() macro. | ||
| 89 | */ | ||
| 90 | void | ||
| 91 | bhv_remove_not_first(bhv_head_t *bhp, bhv_desc_t *bdp) | ||
| 92 | { | ||
| 93 | bhv_desc_t *curdesc, *prev; | ||
| 94 | |||
| 95 | ASSERT(bhp->bh_first != NULL); | ||
| 96 | ASSERT(bhp->bh_first->bd_next != NULL); | ||
| 97 | |||
| 98 | prev = bhp->bh_first; | ||
| 99 | for (curdesc = bhp->bh_first->bd_next; | ||
| 100 | curdesc != NULL; | ||
| 101 | curdesc = curdesc->bd_next) { | ||
| 102 | |||
| 103 | if (curdesc == bdp) | ||
| 104 | break; /* found it */ | ||
| 105 | prev = curdesc; | ||
| 106 | } | ||
| 107 | |||
| 108 | ASSERT(curdesc == bdp); | ||
| 109 | prev->bd_next = bdp->bd_next; /* remove from after prev */ | ||
| 110 | } | ||
| 111 | |||
| 112 | /* | ||
| 113 | * Looks for the first behavior within a specified range of positions. | ||
| 114 | * Return the associated behavior descriptor. Or NULL, if none found. | ||
| 115 | */ | ||
| 116 | bhv_desc_t * | ||
| 117 | bhv_lookup_range(bhv_head_t *bhp, int low, int high) | ||
| 118 | { | ||
| 119 | bhv_desc_t *curdesc; | ||
| 120 | |||
| 121 | for (curdesc = bhp->bh_first; | ||
| 122 | curdesc != NULL; | ||
| 123 | curdesc = curdesc->bd_next) { | ||
| 124 | |||
| 125 | int position = BHV_POSITION(curdesc); | ||
| 126 | |||
| 127 | if (position <= high) { | ||
| 128 | if (position >= low) | ||
| 129 | return curdesc; | ||
| 130 | return NULL; | ||
| 131 | } | ||
| 132 | } | ||
| 133 | |||
| 134 | return NULL; | ||
| 135 | } | ||
| 136 | |||
| 137 | /* | ||
| 138 | * Return the base behavior in the chain, or NULL if the chain | ||
| 139 | * is empty. | ||
| 140 | * | ||
| 141 | * The caller has not read locked the behavior chain, so acquire the | ||
| 142 | * lock before traversing the chain. | ||
| 143 | */ | ||
| 144 | bhv_desc_t * | ||
| 145 | bhv_base(bhv_head_t *bhp) | ||
| 146 | { | ||
| 147 | bhv_desc_t *curdesc; | ||
| 148 | |||
| 149 | for (curdesc = bhp->bh_first; | ||
| 150 | curdesc != NULL; | ||
| 151 | curdesc = curdesc->bd_next) { | ||
| 152 | |||
| 153 | if (curdesc->bd_next == NULL) { | ||
| 154 | return curdesc; | ||
| 155 | } | ||
| 156 | } | ||
| 157 | |||
| 158 | return NULL; | ||
| 159 | } | ||
| 160 | |||
| 161 | void | ||
| 162 | bhv_head_init( | ||
| 163 | bhv_head_t *bhp, | ||
| 164 | char *name) | ||
| 165 | { | ||
| 166 | bhp->bh_first = NULL; | ||
| 167 | } | ||
| 168 | |||
| 169 | void | ||
| 170 | bhv_insert_initial( | ||
| 171 | bhv_head_t *bhp, | ||
| 172 | bhv_desc_t *bdp) | ||
| 173 | { | ||
| 174 | ASSERT(bhp->bh_first == NULL); | ||
| 175 | (bhp)->bh_first = bdp; | ||
| 176 | } | ||
| 177 | |||
| 178 | void | ||
| 179 | bhv_head_destroy( | ||
| 180 | bhv_head_t *bhp) | ||
| 181 | { | ||
| 182 | ASSERT(bhp->bh_first == NULL); | ||
| 183 | } | ||
diff --git a/fs/xfs/xfs_behavior.h b/fs/xfs/xfs_behavior.h deleted file mode 100644 index e7ca1fed955a..000000000000 --- a/fs/xfs/xfs_behavior.h +++ /dev/null | |||
| @@ -1,185 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. | ||
| 3 | * All Rights Reserved. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or | ||
| 6 | * modify it under the terms of the GNU General Public License as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it would be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write the Free Software Foundation, | ||
| 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 17 | */ | ||
| 18 | #ifndef __XFS_BEHAVIOR_H__ | ||
| 19 | #define __XFS_BEHAVIOR_H__ | ||
| 20 | |||
| 21 | /* | ||
| 22 | * Header file used to associate behaviors with virtualized objects. | ||
| 23 | * | ||
| 24 | * A virtualized object is an internal, virtualized representation of | ||
| 25 | * OS entities such as persistent files, processes, or sockets. Examples | ||
| 26 | * of virtualized objects include vnodes, vprocs, and vsockets. Often | ||
| 27 | * a virtualized object is referred to simply as an "object." | ||
| 28 | * | ||
| 29 | * A behavior is essentially an implementation layer associated with | ||
| 30 | * an object. Multiple behaviors for an object are chained together, | ||
| 31 | * the order of chaining determining the order of invocation. Each | ||
| 32 | * behavior of a given object implements the same set of interfaces | ||
| 33 | * (e.g., the VOP interfaces). | ||
| 34 | * | ||
| 35 | * Behaviors may be dynamically inserted into an object's behavior chain, | ||
| 36 | * such that the addition is transparent to consumers that already have | ||
| 37 | * references to the object. Typically, a given behavior will be inserted | ||
| 38 | * at a particular location in the behavior chain. Insertion of new | ||
| 39 | * behaviors is synchronized with operations-in-progress (oip's) so that | ||
| 40 | * the oip's always see a consistent view of the chain. | ||
| 41 | * | ||
| 42 | * The term "interposition" is used to refer to the act of inserting | ||
| 43 | * a behavior such that it interposes on (i.e., is inserted in front | ||
| 44 | * of) a particular other behavior. A key example of this is when a | ||
| 45 | * system implementing distributed single system image wishes to | ||
| 46 | * interpose a distribution layer (providing distributed coherency) | ||
| 47 | * in front of an object that is otherwise only accessed locally. | ||
| 48 | * | ||
| 49 | * Note that the traditional vnode/inode combination is simply a virtualized | ||
| 50 | * object that has exactly one associated behavior. | ||
| 51 | * | ||
| 52 | * Behavior synchronization is logic which is necessary under certain | ||
| 53 | * circumstances that there is no conflict between ongoing operations | ||
| 54 | * traversing the behavior chain and those dynamically modifying the | ||
| 55 | * behavior chain. Because behavior synchronization adds extra overhead | ||
| 56 | * to virtual operation invocation, we want to restrict, as much as | ||
| 57 | * we can, the requirement for this extra code, to those situations | ||
| 58 | * in which it is truly necessary. | ||
| 59 | * | ||
| 60 | * Behavior synchronization is needed whenever there's at least one class | ||
| 61 | * of object in the system for which: | ||
| 62 | * 1) multiple behaviors for a given object are supported, | ||
| 63 | * -- AND -- | ||
| 64 | * 2a) insertion of a new behavior can happen dynamically at any time during | ||
| 65 | * the life of an active object, | ||
| 66 | * -- AND -- | ||
| 67 | * 3a) insertion of a new behavior needs to synchronize with existing | ||
| 68 | * ops-in-progress. | ||
| 69 | * -- OR -- | ||
| 70 | * 3b) multiple different behaviors can be dynamically inserted at | ||
| 71 | * any time during the life of an active object | ||
| 72 | * -- OR -- | ||
| 73 | * 3c) removal of a behavior can occur at any time during the life of | ||
| 74 | * an active object. | ||
| 75 | * -- OR -- | ||
| 76 | * 2b) removal of a behavior can occur at any time during the life of an | ||
| 77 | * active object | ||
| 78 | * | ||
| 79 | */ | ||
| 80 | |||
| 81 | /* | ||
| 82 | * Behavior head. Head of the chain of behaviors. | ||
| 83 | * Contained within each virtualized object data structure. | ||
| 84 | */ | ||
| 85 | typedef struct bhv_head { | ||
| 86 | struct bhv_desc *bh_first; /* first behavior in chain */ | ||
| 87 | } bhv_head_t; | ||
| 88 | |||
| 89 | /* | ||
| 90 | * Behavior descriptor. Descriptor associated with each behavior. | ||
| 91 | * Contained within the behavior's private data structure. | ||
| 92 | */ | ||
| 93 | typedef struct bhv_desc { | ||
| 94 | void *bd_pdata; /* private data for this behavior */ | ||
| 95 | void *bd_vobj; /* virtual object associated with */ | ||
| 96 | void *bd_ops; /* ops for this behavior */ | ||
| 97 | struct bhv_desc *bd_next; /* next behavior in chain */ | ||
| 98 | } bhv_desc_t; | ||
| 99 | |||
| 100 | /* | ||
| 101 | * Behavior identity field. A behavior's identity determines the position | ||
| 102 | * where it lives within a behavior chain, and it's always the first field | ||
| 103 | * of the behavior's ops vector. The optional id field further identifies the | ||
| 104 | * subsystem responsible for the behavior. | ||
| 105 | */ | ||
| 106 | typedef struct bhv_identity { | ||
| 107 | __u16 bi_id; /* owning subsystem id */ | ||
| 108 | __u16 bi_position; /* position in chain */ | ||
| 109 | } bhv_identity_t; | ||
| 110 | |||
| 111 | typedef bhv_identity_t bhv_position_t; | ||
| 112 | |||
| 113 | #define BHV_IDENTITY_INIT(id,pos) {id, pos} | ||
| 114 | #define BHV_IDENTITY_INIT_POSITION(pos) BHV_IDENTITY_INIT(0, pos) | ||
| 115 | |||
| 116 | /* | ||
| 117 | * Define boundaries of position values. | ||
| 118 | */ | ||
| 119 | #define BHV_POSITION_INVALID 0 /* invalid position number */ | ||
| 120 | #define BHV_POSITION_BASE 1 /* base (last) implementation layer */ | ||
| 121 | #define BHV_POSITION_TOP 63 /* top (first) implementation layer */ | ||
| 122 | |||
| 123 | /* | ||
| 124 | * Plumbing macros. | ||
| 125 | */ | ||
| 126 | #define BHV_HEAD_FIRST(bhp) (ASSERT((bhp)->bh_first), (bhp)->bh_first) | ||
| 127 | #define BHV_NEXT(bdp) (ASSERT((bdp)->bd_next), (bdp)->bd_next) | ||
| 128 | #define BHV_NEXTNULL(bdp) ((bdp)->bd_next) | ||
| 129 | #define BHV_VOBJ(bdp) (ASSERT((bdp)->bd_vobj), (bdp)->bd_vobj) | ||
| 130 | #define BHV_VOBJNULL(bdp) ((bdp)->bd_vobj) | ||
| 131 | #define BHV_PDATA(bdp) (bdp)->bd_pdata | ||
| 132 | #define BHV_OPS(bdp) (bdp)->bd_ops | ||
| 133 | #define BHV_IDENTITY(bdp) ((bhv_identity_t *)(bdp)->bd_ops) | ||
| 134 | #define BHV_POSITION(bdp) (BHV_IDENTITY(bdp)->bi_position) | ||
| 135 | |||
| 136 | extern void bhv_head_init(bhv_head_t *, char *); | ||
| 137 | extern void bhv_head_destroy(bhv_head_t *); | ||
| 138 | extern int bhv_insert(bhv_head_t *, bhv_desc_t *); | ||
| 139 | extern void bhv_insert_initial(bhv_head_t *, bhv_desc_t *); | ||
| 140 | |||
| 141 | /* | ||
| 142 | * Initialize a new behavior descriptor. | ||
| 143 | * Arguments: | ||
| 144 | * bdp - pointer to behavior descriptor | ||
| 145 | * pdata - pointer to behavior's private data | ||
| 146 | * vobj - pointer to associated virtual object | ||
| 147 | * ops - pointer to ops for this behavior | ||
| 148 | */ | ||
| 149 | #define bhv_desc_init(bdp, pdata, vobj, ops) \ | ||
| 150 | { \ | ||
| 151 | (bdp)->bd_pdata = pdata; \ | ||
| 152 | (bdp)->bd_vobj = vobj; \ | ||
| 153 | (bdp)->bd_ops = ops; \ | ||
| 154 | (bdp)->bd_next = NULL; \ | ||
| 155 | } | ||
| 156 | |||
| 157 | /* | ||
| 158 | * Remove a behavior descriptor from a behavior chain. | ||
| 159 | */ | ||
| 160 | #define bhv_remove(bhp, bdp) \ | ||
| 161 | { \ | ||
| 162 | if ((bhp)->bh_first == (bdp)) { \ | ||
| 163 | /* \ | ||
| 164 | * Remove from front of chain. \ | ||
| 165 | * Atomic wrt oip's. \ | ||
| 166 | */ \ | ||
| 167 | (bhp)->bh_first = (bdp)->bd_next; \ | ||
| 168 | } else { \ | ||
| 169 | /* remove from non-front of chain */ \ | ||
| 170 | bhv_remove_not_first(bhp, bdp); \ | ||
| 171 | } \ | ||
| 172 | (bdp)->bd_vobj = NULL; \ | ||
| 173 | } | ||
| 174 | |||
| 175 | /* | ||
| 176 | * Behavior module prototypes. | ||
| 177 | */ | ||
| 178 | extern void bhv_remove_not_first(bhv_head_t *bhp, bhv_desc_t *bdp); | ||
| 179 | extern bhv_desc_t * bhv_lookup_range(bhv_head_t *bhp, int low, int high); | ||
| 180 | extern bhv_desc_t * bhv_base(bhv_head_t *bhp); | ||
| 181 | |||
| 182 | /* No bhv locking on Linux */ | ||
| 183 | #define bhv_base_unlocked bhv_base | ||
| 184 | |||
| 185 | #endif /* __XFS_BEHAVIOR_H__ */ | ||
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 03f32c68731f..772bbc7a8ac9 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
| @@ -343,8 +343,7 @@ finish_inode: | |||
| 343 | * If we have a real type for an on-disk inode, we can set ops(&unlock) | 343 | * If we have a real type for an on-disk inode, we can set ops(&unlock) |
| 344 | * now. If it's a new inode being created, xfs_ialloc will handle it. | 344 | * now. If it's a new inode being created, xfs_ialloc will handle it. |
| 345 | */ | 345 | */ |
| 346 | bhv_vfs_init_vnode(XFS_MTOVFS(mp), vp, ip, 1); | 346 | xfs_initialize_vnode(mp, vp, ip); |
| 347 | |||
| 348 | return 0; | 347 | return 0; |
| 349 | } | 348 | } |
| 350 | 349 | ||
| @@ -370,7 +369,8 @@ xfs_iget( | |||
| 370 | XFS_STATS_INC(xs_ig_attempts); | 369 | XFS_STATS_INC(xs_ig_attempts); |
| 371 | 370 | ||
| 372 | retry: | 371 | retry: |
| 373 | if ((inode = iget_locked(XFS_MTOVFS(mp)->vfs_super, ino))) { | 372 | inode = iget_locked(XFS_MTOVFS(mp)->vfs_super, ino); |
| 373 | if (inode) { | ||
| 374 | xfs_inode_t *ip; | 374 | xfs_inode_t *ip; |
| 375 | 375 | ||
| 376 | vp = vn_from_inode(inode); | 376 | vp = vn_from_inode(inode); |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index b82f4e43ef3e..0c376bd9e173 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
| @@ -1272,7 +1272,7 @@ xfs_ialloc( | |||
| 1272 | xfs_trans_log_inode(tp, ip, flags); | 1272 | xfs_trans_log_inode(tp, ip, flags); |
| 1273 | 1273 | ||
| 1274 | /* now that we have an i_mode we can setup inode ops and unlock */ | 1274 | /* now that we have an i_mode we can setup inode ops and unlock */ |
| 1275 | bhv_vfs_init_vnode(XFS_MTOVFS(tp->t_mountp), vp, ip, 1); | 1275 | xfs_initialize_vnode(tp->t_mountp, vp, ip); |
| 1276 | 1276 | ||
| 1277 | *ipp = ip; | 1277 | *ipp = ip; |
| 1278 | return 0; | 1278 | return 0; |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 3e948f58ab82..4f3488a7dc06 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
| @@ -157,8 +157,7 @@ xfs_mount_init(void) | |||
| 157 | */ | 157 | */ |
| 158 | void | 158 | void |
| 159 | xfs_mount_free( | 159 | xfs_mount_free( |
| 160 | xfs_mount_t *mp, | 160 | xfs_mount_t *mp) |
| 161 | int remove_bhv) | ||
| 162 | { | 161 | { |
| 163 | if (mp->m_perag) { | 162 | if (mp->m_perag) { |
| 164 | int agno; | 163 | int agno; |
| @@ -186,13 +185,6 @@ xfs_mount_free( | |||
| 186 | if (mp->m_logname != NULL) | 185 | if (mp->m_logname != NULL) |
| 187 | kmem_free(mp->m_logname, strlen(mp->m_logname) + 1); | 186 | kmem_free(mp->m_logname, strlen(mp->m_logname) + 1); |
| 188 | 187 | ||
| 189 | if (remove_bhv) { | ||
| 190 | struct bhv_vfs *vfsp = XFS_MTOVFS(mp); | ||
| 191 | |||
| 192 | bhv_remove_all_vfsops(vfsp, 0); | ||
| 193 | VFS_REMOVEBHV(vfsp, &mp->m_bhv); | ||
| 194 | } | ||
| 195 | |||
| 196 | xfs_icsb_destroy_counters(mp); | 188 | xfs_icsb_destroy_counters(mp); |
| 197 | } | 189 | } |
| 198 | 190 | ||
| @@ -1287,7 +1279,7 @@ xfs_unmountfs(xfs_mount_t *mp, struct cred *cr) | |||
| 1287 | xfs_errortag_clearall_umount(fsid, mp->m_fsname, 0); | 1279 | xfs_errortag_clearall_umount(fsid, mp->m_fsname, 0); |
| 1288 | #endif | 1280 | #endif |
| 1289 | XFS_IODONE(vfsp); | 1281 | XFS_IODONE(vfsp); |
| 1290 | xfs_mount_free(mp, 1); | 1282 | xfs_mount_free(mp); |
| 1291 | return 0; | 1283 | return 0; |
| 1292 | } | 1284 | } |
| 1293 | 1285 | ||
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index 68d712574b81..8fefad022ae6 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
| @@ -64,8 +64,6 @@ struct xfs_extdelta; | |||
| 64 | struct xfs_swapext; | 64 | struct xfs_swapext; |
| 65 | struct xfs_mru_cache; | 65 | struct xfs_mru_cache; |
| 66 | 66 | ||
| 67 | extern struct bhv_vfsops xfs_vfsops; | ||
| 68 | |||
| 69 | #define AIL_LOCK_T lock_t | 67 | #define AIL_LOCK_T lock_t |
| 70 | #define AIL_LOCKINIT(x,y) spinlock_init(x,y) | 68 | #define AIL_LOCKINIT(x,y) spinlock_init(x,y) |
| 71 | #define AIL_LOCK_DESTROY(x) spinlock_destroy(x) | 69 | #define AIL_LOCK_DESTROY(x) spinlock_destroy(x) |
| @@ -330,7 +328,7 @@ extern void xfs_icsb_sync_counters_flags(struct xfs_mount *, int); | |||
| 330 | #endif | 328 | #endif |
| 331 | 329 | ||
| 332 | typedef struct xfs_mount { | 330 | typedef struct xfs_mount { |
| 333 | bhv_desc_t m_bhv; /* vfs xfs behavior */ | 331 | struct bhv_vfs *m_vfsp; |
| 334 | xfs_tid_t m_tid; /* next unused tid for fs */ | 332 | xfs_tid_t m_tid; /* next unused tid for fs */ |
| 335 | AIL_LOCK_T m_ail_lock; /* fs AIL mutex */ | 333 | AIL_LOCK_T m_ail_lock; /* fs AIL mutex */ |
| 336 | xfs_ail_entry_t m_ail; /* fs active log item list */ | 334 | xfs_ail_entry_t m_ail; /* fs active log item list */ |
| @@ -527,8 +525,10 @@ xfs_preferred_iosize(xfs_mount_t *mp) | |||
| 527 | #define XFS_LAST_UNMOUNT_WAS_CLEAN(mp) \ | 525 | #define XFS_LAST_UNMOUNT_WAS_CLEAN(mp) \ |
| 528 | ((mp)->m_flags & XFS_MOUNT_WAS_CLEAN) | 526 | ((mp)->m_flags & XFS_MOUNT_WAS_CLEAN) |
| 529 | #define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN) | 527 | #define XFS_FORCED_SHUTDOWN(mp) ((mp)->m_flags & XFS_MOUNT_FS_SHUTDOWN) |
| 528 | void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname, | ||
| 529 | int lnnum); | ||
| 530 | #define xfs_force_shutdown(m,f) \ | 530 | #define xfs_force_shutdown(m,f) \ |
| 531 | bhv_vfs_force_shutdown((XFS_MTOVFS(m)), f, __FILE__, __LINE__) | 531 | xfs_do_force_shutdown(m, f, __FILE__, __LINE__) |
| 532 | 532 | ||
| 533 | /* | 533 | /* |
| 534 | * Flags for xfs_mountfs | 534 | * Flags for xfs_mountfs |
| @@ -548,20 +548,13 @@ xfs_preferred_iosize(xfs_mount_t *mp) | |||
| 548 | #define XFS_MTOVFS(mp) xfs_mtovfs(mp) | 548 | #define XFS_MTOVFS(mp) xfs_mtovfs(mp) |
| 549 | static inline struct bhv_vfs *xfs_mtovfs(xfs_mount_t *mp) | 549 | static inline struct bhv_vfs *xfs_mtovfs(xfs_mount_t *mp) |
| 550 | { | 550 | { |
| 551 | return bhvtovfs(&mp->m_bhv); | 551 | return mp->m_vfsp; |
| 552 | } | ||
| 553 | |||
| 554 | #define XFS_BHVTOM(bdp) xfs_bhvtom(bdp) | ||
| 555 | static inline xfs_mount_t *xfs_bhvtom(bhv_desc_t *bdp) | ||
| 556 | { | ||
| 557 | return (xfs_mount_t *)BHV_PDATA(bdp); | ||
| 558 | } | 552 | } |
| 559 | 553 | ||
| 560 | #define XFS_VFSTOM(vfs) xfs_vfstom(vfs) | 554 | #define XFS_VFSTOM(vfs) xfs_vfstom(vfs) |
| 561 | static inline xfs_mount_t *xfs_vfstom(bhv_vfs_t *vfs) | 555 | static inline xfs_mount_t *xfs_vfstom(bhv_vfs_t *vfs) |
| 562 | { | 556 | { |
| 563 | return XFS_BHVTOM(bhv_lookup_range(VFS_BHVHEAD(vfs), | 557 | return vfs->vfs_mount; |
| 564 | VFS_POSITION_XFS, VFS_POSITION_XFS)); | ||
| 565 | } | 558 | } |
| 566 | 559 | ||
| 567 | #define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d) | 560 | #define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d) |
| @@ -633,7 +626,7 @@ typedef struct xfs_mod_sb { | |||
| 633 | extern xfs_mount_t *xfs_mount_init(void); | 626 | extern xfs_mount_t *xfs_mount_init(void); |
| 634 | extern void xfs_mod_sb(xfs_trans_t *, __int64_t); | 627 | extern void xfs_mod_sb(xfs_trans_t *, __int64_t); |
| 635 | extern int xfs_log_sbcount(xfs_mount_t *, uint); | 628 | extern int xfs_log_sbcount(xfs_mount_t *, uint); |
| 636 | extern void xfs_mount_free(xfs_mount_t *mp, int remove_bhv); | 629 | extern void xfs_mount_free(xfs_mount_t *mp); |
| 637 | extern int xfs_mountfs(struct bhv_vfs *, xfs_mount_t *mp, int); | 630 | extern int xfs_mountfs(struct bhv_vfs *, xfs_mount_t *mp, int); |
| 638 | extern void xfs_mountfs_check_barriers(xfs_mount_t *mp); | 631 | extern void xfs_mountfs_check_barriers(xfs_mount_t *mp); |
| 639 | 632 | ||
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index 2d672f317110..593e6e2b3921 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
| @@ -439,7 +439,6 @@ xfs_mount( | |||
| 439 | cred_t *credp) | 439 | cred_t *credp) |
| 440 | { | 440 | { |
| 441 | struct bhv_vfs *vfsp = XFS_MTOVFS(mp); | 441 | struct bhv_vfs *vfsp = XFS_MTOVFS(mp); |
| 442 | struct bhv_desc *p; | ||
| 443 | struct block_device *ddev, *logdev, *rtdev; | 442 | struct block_device *ddev, *logdev, *rtdev; |
| 444 | int flags = 0, error; | 443 | int flags = 0, error; |
| 445 | 444 | ||
| @@ -453,11 +452,7 @@ xfs_mount( | |||
| 453 | if (error) | 452 | if (error) |
| 454 | return error; | 453 | return error; |
| 455 | 454 | ||
| 456 | /* | 455 | mp->m_io_ops = xfs_iocore_xfs; |
| 457 | * Setup xfs_mount function vectors from available behaviors | ||
| 458 | */ | ||
| 459 | p = vfs_bhv_lookup(vfsp, VFS_POSITION_IO); | ||
| 460 | mp->m_io_ops = p ? *(xfs_ioops_t *) vfs_bhv_custom(p) : xfs_iocore_xfs; | ||
| 461 | 456 | ||
| 462 | if (args->flags & XFSMNT_QUIET) | 457 | if (args->flags & XFSMNT_QUIET) |
| 463 | flags |= XFS_MFSI_QUIET; | 458 | flags |= XFS_MFSI_QUIET; |
| @@ -741,7 +736,7 @@ xfs_mntupdate( | |||
| 741 | } | 736 | } |
| 742 | } else if (!(vfsp->vfs_flag & VFS_RDONLY)) { /* rw -> ro */ | 737 | } else if (!(vfsp->vfs_flag & VFS_RDONLY)) { /* rw -> ro */ |
| 743 | xfs_filestream_flush(mp); | 738 | xfs_filestream_flush(mp); |
| 744 | bhv_vfs_sync(vfsp, SYNC_DATA_QUIESCE, NULL); | 739 | xfs_sync(mp, SYNC_DATA_QUIESCE); |
| 745 | xfs_attr_quiesce(mp); | 740 | xfs_attr_quiesce(mp); |
| 746 | vfsp->vfs_flag |= VFS_RDONLY; | 741 | vfsp->vfs_flag |= VFS_RDONLY; |
| 747 | } | 742 | } |
diff --git a/fs/xfs/xfs_vfsops.h b/fs/xfs/xfs_vfsops.h index 994502eac19a..bc99e3eb7dbb 100644 --- a/fs/xfs/xfs_vfsops.h +++ b/fs/xfs/xfs_vfsops.h | |||
| @@ -24,8 +24,5 @@ int xfs_showargs(struct xfs_mount *mp, struct seq_file *m); | |||
| 24 | void xfs_freeze(struct xfs_mount *mp); | 24 | void xfs_freeze(struct xfs_mount *mp); |
| 25 | void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname, | 25 | void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname, |
| 26 | int lnnum); | 26 | int lnnum); |
| 27 | struct inode *xfs_get_inode(struct xfs_mount *mp, xfs_ino_t ino, int flags); | ||
| 28 | void xfs_initialize_vnode(struct xfs_mount *mp, bhv_vnode_t *vp, | ||
| 29 | struct xfs_inode *ip, int unlock); | ||
| 30 | 27 | ||
| 31 | #endif /* _XFS_VFSOPS_H */ | 28 | #endif /* _XFS_VFSOPS_H */ |
diff --git a/fs/xfs/xfs_vfsops_bhv.c b/fs/xfs/xfs_vfsops_bhv.c deleted file mode 100644 index 764b2aefb6bc..000000000000 --- a/fs/xfs/xfs_vfsops_bhv.c +++ /dev/null | |||
| @@ -1,145 +0,0 @@ | |||
| 1 | |||
| 2 | #include "xfs_linux.h" | ||
| 3 | #include "xfs_vfsops.h" | ||
| 4 | |||
| 5 | #include "xfs_inum.h" | ||
| 6 | #include "xfs_dmapi.h" | ||
| 7 | #include "xfs_sb.h" | ||
| 8 | #include "xfs_log.h" | ||
| 9 | #include "xfs_trans.h" | ||
| 10 | #include "xfs_ag.h" | ||
| 11 | #include "xfs_mount.h" | ||
| 12 | |||
| 13 | |||
| 14 | STATIC int | ||
| 15 | xfs_bhv_mount( | ||
| 16 | struct bhv_desc *bhvp, | ||
| 17 | struct xfs_mount_args *args, | ||
| 18 | cred_t *credp) | ||
| 19 | { | ||
| 20 | return xfs_mount(XFS_BHVTOM(bhvp), args, credp); | ||
| 21 | } | ||
| 22 | |||
| 23 | STATIC int | ||
| 24 | xfs_bhv_unmount( | ||
| 25 | bhv_desc_t *bdp, | ||
| 26 | int flags, | ||
| 27 | cred_t *credp) | ||
| 28 | { | ||
| 29 | return xfs_unmount(XFS_BHVTOM(bdp), flags, credp); | ||
| 30 | } | ||
| 31 | |||
| 32 | STATIC int | ||
| 33 | xfs_bhv_mntupdate( | ||
| 34 | bhv_desc_t *bdp, | ||
| 35 | int *flags, | ||
| 36 | struct xfs_mount_args *args) | ||
| 37 | { | ||
| 38 | return xfs_mntupdate(XFS_BHVTOM(bdp), flags, args); | ||
| 39 | } | ||
| 40 | |||
| 41 | STATIC int | ||
| 42 | xfs_bhv_root( | ||
| 43 | bhv_desc_t *bdp, | ||
| 44 | bhv_vnode_t **vpp) | ||
| 45 | { | ||
| 46 | return xfs_root(XFS_BHVTOM(bdp), vpp); | ||
| 47 | } | ||
| 48 | |||
| 49 | STATIC int | ||
| 50 | xfs_bhv_statvfs( | ||
| 51 | bhv_desc_t *bdp, | ||
| 52 | bhv_statvfs_t *statp, | ||
| 53 | bhv_vnode_t *vp) | ||
| 54 | { | ||
| 55 | return xfs_statvfs(XFS_BHVTOM(bdp), statp, vp); | ||
| 56 | } | ||
| 57 | |||
| 58 | STATIC int | ||
| 59 | xfs_bhv_sync( | ||
| 60 | bhv_desc_t *bdp, | ||
| 61 | int flags, | ||
| 62 | cred_t *credp) | ||
| 63 | { | ||
| 64 | return xfs_sync(XFS_BHVTOM(bdp), flags); | ||
| 65 | } | ||
| 66 | |||
| 67 | STATIC int | ||
| 68 | xfs_bhv_vget( | ||
| 69 | bhv_desc_t *bdp, | ||
| 70 | bhv_vnode_t **vpp, | ||
| 71 | fid_t *fidp) | ||
| 72 | { | ||
| 73 | return xfs_vget(XFS_BHVTOM(bdp), vpp, fidp); | ||
| 74 | } | ||
| 75 | |||
| 76 | STATIC int | ||
| 77 | xfs_bhv_parseargs( | ||
| 78 | struct bhv_desc *bhv, | ||
| 79 | char *options, | ||
| 80 | struct xfs_mount_args *args, | ||
| 81 | int update) | ||
| 82 | { | ||
| 83 | return xfs_parseargs(XFS_BHVTOM(bhv), options, args, update); | ||
| 84 | } | ||
| 85 | |||
| 86 | STATIC int | ||
| 87 | xfs_bhv_showargs( | ||
| 88 | struct bhv_desc *bhv, | ||
| 89 | struct seq_file *m) | ||
| 90 | { | ||
| 91 | return xfs_showargs(XFS_BHVTOM(bhv), m); | ||
| 92 | } | ||
| 93 | |||
| 94 | STATIC void | ||
| 95 | xfs_bhv_freeze( | ||
| 96 | bhv_desc_t *bdp) | ||
| 97 | { | ||
| 98 | return xfs_freeze(XFS_BHVTOM(bdp)); | ||
| 99 | } | ||
| 100 | |||
| 101 | STATIC void | ||
| 102 | xfs_bhv_force_shutdown( | ||
| 103 | bhv_desc_t *bdp, | ||
| 104 | int flags, | ||
| 105 | char *fname, | ||
| 106 | int lnnum) | ||
| 107 | { | ||
| 108 | return xfs_do_force_shutdown(XFS_BHVTOM(bdp), flags, fname, lnnum); | ||
| 109 | } | ||
| 110 | |||
| 111 | STATIC struct inode * | ||
| 112 | xfs_bhv_get_inode( | ||
| 113 | bhv_desc_t *bdp, | ||
| 114 | xfs_ino_t ino, | ||
| 115 | int flags) | ||
| 116 | { | ||
| 117 | return xfs_get_inode(XFS_BHVTOM(bdp), ino, flags); | ||
| 118 | } | ||
| 119 | |||
| 120 | STATIC void | ||
| 121 | xfs_bhv_initialize_vnode( | ||
| 122 | bhv_desc_t *bdp, | ||
| 123 | bhv_vnode_t *vp, | ||
| 124 | struct xfs_inode *ip, | ||
| 125 | int unlock) | ||
| 126 | { | ||
| 127 | return xfs_initialize_vnode(XFS_BHVTOM(bdp), vp, ip, unlock); | ||
| 128 | } | ||
| 129 | |||
| 130 | bhv_vfsops_t xfs_vfsops = { | ||
| 131 | BHV_IDENTITY_INIT(VFS_BHV_XFS,VFS_POSITION_XFS), | ||
| 132 | .vfs_parseargs = xfs_bhv_parseargs, | ||
| 133 | .vfs_showargs = xfs_bhv_showargs, | ||
| 134 | .vfs_mount = xfs_bhv_mount, | ||
| 135 | .vfs_unmount = xfs_bhv_unmount, | ||
| 136 | .vfs_mntupdate = xfs_bhv_mntupdate, | ||
| 137 | .vfs_root = xfs_bhv_root, | ||
| 138 | .vfs_statvfs = xfs_bhv_statvfs, | ||
| 139 | .vfs_sync = xfs_bhv_sync, | ||
| 140 | .vfs_vget = xfs_bhv_vget, | ||
| 141 | .vfs_get_inode = xfs_bhv_get_inode, | ||
| 142 | .vfs_init_vnode = xfs_bhv_initialize_vnode, | ||
| 143 | .vfs_force_shutdown = xfs_bhv_force_shutdown, | ||
| 144 | .vfs_freeze = xfs_bhv_freeze, | ||
| 145 | }; | ||
