aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-08-30 03:20:39 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-10-15 21:44:08 -0400
commit745f691912b700ac98607b525f3c892204c7f12f (patch)
tree4988bdf45dec4bc9bffd432fc3e521b73836172f /fs/xfs/linux-2.6
parent48c872a9f3ec4cdc37801aae9ef16c80026503ea (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/linux-2.6')
-rw-r--r--fs/xfs/linux-2.6/xfs_export.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_linux.h1
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.h1
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c56
-rw-r--r--fs/xfs/linux-2.6/xfs_super.h3
-rw-r--r--fs/xfs/linux-2.6/xfs_vfs.c67
-rw-r--r--fs/xfs/linux-2.6/xfs_vfs.h121
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.c4
8 files changed, 36 insertions, 221 deletions
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
32static struct dentry dotdot = { .d_name.name = "..", .d_name.len = 2, }; 33static 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
21struct bhv_desc;
22struct xfs_mount; 21struct xfs_mount;
23struct xfs_iocore; 22struct xfs_iocore;
24struct xfs_inode; 23struct 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
204xfs_initialize_vnode( 205xfs_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
713xfs_fs_lockfs( 714xfs_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
719STATIC int 720STATIC 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
727STATIC int 728STATIC 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
850fail_unmount: 850fail_unmount:
851 bhv_vfs_unmount(vfsp, 0, NULL); 851 xfs_unmount(mp, 0, NULL);
852 852
853fail_vfsop: 853fail_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
108extern __uint64_t xfs_max_file_offset(unsigned int); 108extern __uint64_t xfs_max_file_offset(unsigned int);
109 109
110extern void xfs_initialize_vnode(struct xfs_mount *mp, bhv_vnode_t *vp,
111 struct xfs_inode *ip);
112
110extern void xfs_flush_inode(struct xfs_inode *); 113extern void xfs_flush_inode(struct xfs_inode *);
111extern void xfs_flush_device(struct xfs_inode *); 114extern 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
229vfs_deallocate( 228vfs_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
236void
237vfs_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
248void
249vfs_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
259void
260bhv_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
273void
274bhv_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
289void
290bhv_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;
29struct seq_file; 29struct seq_file;
30struct super_block; 30struct super_block;
31struct xfs_inode; 31struct xfs_inode;
32struct xfs_mount;
32struct xfs_mount_args; 33struct xfs_mount_args;
33 34
34typedef struct kstatfs bhv_statvfs_t; 35typedef 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
43typedef struct bhv_vfs { 44typedef 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
66typedef 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
117typedef int (*vfs_mount_t)(bhv_desc_t *,
118 struct xfs_mount_args *, struct cred *);
119typedef int (*vfs_parseargs_t)(bhv_desc_t *, char *,
120 struct xfs_mount_args *, int);
121typedef int (*vfs_showargs_t)(bhv_desc_t *, struct seq_file *);
122typedef int (*vfs_unmount_t)(bhv_desc_t *, int, struct cred *);
123typedef int (*vfs_mntupdate_t)(bhv_desc_t *, int *,
124 struct xfs_mount_args *);
125typedef int (*vfs_root_t)(bhv_desc_t *, struct inode **);
126typedef int (*vfs_statvfs_t)(bhv_desc_t *, bhv_statvfs_t *,
127 struct inode *);
128typedef int (*vfs_sync_t)(bhv_desc_t *, int, struct cred *);
129typedef int (*vfs_vget_t)(bhv_desc_t *, struct inode **, struct fid *);
130typedef void (*vfs_init_vnode_t)(bhv_desc_t *,
131 struct inode *, struct xfs_inode *, int);
132typedef void (*vfs_force_shutdown_t)(bhv_desc_t *, int, char *, int);
133typedef void (*vfs_freeze_t)(bhv_desc_t *);
134
135typedef 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
184extern int vfs_mount(bhv_desc_t *, struct xfs_mount_args *, struct cred *);
185extern int vfs_parseargs(bhv_desc_t *, char *, struct xfs_mount_args *, int);
186extern int vfs_showargs(bhv_desc_t *, struct seq_file *);
187extern int vfs_unmount(bhv_desc_t *, int, struct cred *);
188extern int vfs_mntupdate(bhv_desc_t *, int *, struct xfs_mount_args *);
189extern int vfs_root(bhv_desc_t *, struct inode **);
190extern int vfs_statvfs(bhv_desc_t *, bhv_statvfs_t *, struct inode *);
191extern int vfs_sync(bhv_desc_t *, int, struct cred *);
192extern int vfs_vget(bhv_desc_t *, struct inode **, struct fid *);
193extern void vfs_init_vnode(bhv_desc_t *, struct inode *, struct xfs_inode *, int);
194extern void vfs_force_shutdown(bhv_desc_t *, int, char *, int);
195extern 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
200typedef 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
210extern bhv_vfs_t *vfs_allocate(struct super_block *); 100extern bhv_vfs_t *vfs_allocate(struct super_block *);
211extern bhv_vfs_t *vfs_from_sb(struct super_block *); 101extern bhv_vfs_t *vfs_from_sb(struct super_block *);
212extern void vfs_deallocate(bhv_vfs_t *); 102extern void vfs_deallocate(bhv_vfs_t *);
213extern void vfs_insertbhv(bhv_vfs_t *, bhv_desc_t *, bhv_vfsops_t *, void *);
214
215extern void vfs_insertops(bhv_vfs_t *, bhv_module_vfsops_t *);
216
217extern void bhv_insert_all_vfsops(struct bhv_vfs *);
218extern void bhv_remove_all_vfsops(struct bhv_vfs *, int);
219extern 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
87bhv_vnode_t * 85bhv_vnode_t *