diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_vnode.h')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 305 |
1 files changed, 117 insertions, 188 deletions
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index 95343637ab66..cb16774aea73 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
@@ -14,33 +14,6 @@ | |||
14 | * You should have received a copy of the GNU General Public License | 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, | 15 | * along with this program; if not, write the Free Software Foundation, |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | * | ||
18 | * Portions Copyright (c) 1989, 1993 | ||
19 | * The Regents of the University of California. All rights reserved. | ||
20 | * | ||
21 | * Redistribution and use in source and binary forms, with or without | ||
22 | * modification, are permitted provided that the following conditions | ||
23 | * are met: | ||
24 | * 1. Redistributions of source code must retain the above copyright | ||
25 | * notice, this list of conditions and the following disclaimer. | ||
26 | * 2. Redistributions in binary form must reproduce the above copyright | ||
27 | * notice, this list of conditions and the following disclaimer in the | ||
28 | * documentation and/or other materials provided with the distribution. | ||
29 | * 3. Neither the name of the University nor the names of its contributors | ||
30 | * may be used to endorse or promote products derived from this software | ||
31 | * without specific prior written permission. | ||
32 | * | ||
33 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
34 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
35 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
36 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
37 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
38 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
39 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
40 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
41 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
42 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
43 | * SUCH DAMAGE. | ||
44 | */ | 17 | */ |
45 | #ifndef __XFS_VNODE_H__ | 18 | #ifndef __XFS_VNODE_H__ |
46 | #define __XFS_VNODE_H__ | 19 | #define __XFS_VNODE_H__ |
@@ -51,7 +24,6 @@ struct vattr; | |||
51 | struct xfs_iomap; | 24 | struct xfs_iomap; |
52 | struct attrlist_cursor_kern; | 25 | struct attrlist_cursor_kern; |
53 | 26 | ||
54 | |||
55 | typedef xfs_ino_t vnumber_t; | 27 | typedef xfs_ino_t vnumber_t; |
56 | typedef struct dentry vname_t; | 28 | typedef struct dentry vname_t; |
57 | typedef bhv_head_t vn_bhv_head_t; | 29 | typedef bhv_head_t vn_bhv_head_t; |
@@ -66,7 +38,7 @@ typedef enum vflags { | |||
66 | * MP locking protocols: | 38 | * MP locking protocols: |
67 | * v_flag, v_vfsp VN_LOCK/VN_UNLOCK | 39 | * v_flag, v_vfsp VN_LOCK/VN_UNLOCK |
68 | */ | 40 | */ |
69 | typedef struct vnode { | 41 | typedef struct bhv_vnode { |
70 | vflags_t v_flag; /* vnode flags (see above) */ | 42 | vflags_t v_flag; /* vnode flags (see above) */ |
71 | struct bhv_vfs *v_vfsp; /* ptr to containing VFS */ | 43 | struct bhv_vfs *v_vfsp; /* ptr to containing VFS */ |
72 | vnumber_t v_number; /* in-core vnode number */ | 44 | vnumber_t v_number; /* in-core vnode number */ |
@@ -78,7 +50,7 @@ typedef struct vnode { | |||
78 | #endif | 50 | #endif |
79 | struct inode v_inode; /* Linux inode */ | 51 | struct inode v_inode; /* Linux inode */ |
80 | /* inode MUST be last */ | 52 | /* inode MUST be last */ |
81 | } vnode_t; | 53 | } bhv_vnode_t; |
82 | 54 | ||
83 | #define VN_ISLNK(vp) S_ISLNK((vp)->v_inode.i_mode) | 55 | #define VN_ISLNK(vp) S_ISLNK((vp)->v_inode.i_mode) |
84 | #define VN_ISREG(vp) S_ISREG((vp)->v_inode.i_mode) | 56 | #define VN_ISREG(vp) S_ISREG((vp)->v_inode.i_mode) |
@@ -86,9 +58,6 @@ typedef struct vnode { | |||
86 | #define VN_ISCHR(vp) S_ISCHR((vp)->v_inode.i_mode) | 58 | #define VN_ISCHR(vp) S_ISCHR((vp)->v_inode.i_mode) |
87 | #define VN_ISBLK(vp) S_ISBLK((vp)->v_inode.i_mode) | 59 | #define VN_ISBLK(vp) S_ISBLK((vp)->v_inode.i_mode) |
88 | 60 | ||
89 | #define v_fbhv v_bh.bh_first /* first behavior */ | ||
90 | #define v_fops v_bh.bh_first->bd_ops /* first behavior ops */ | ||
91 | |||
92 | #define VNODE_POSITION_BASE BHV_POSITION_BASE /* chain bottom */ | 61 | #define VNODE_POSITION_BASE BHV_POSITION_BASE /* chain bottom */ |
93 | #define VNODE_POSITION_TOP BHV_POSITION_TOP /* chain top */ | 62 | #define VNODE_POSITION_TOP BHV_POSITION_TOP /* chain top */ |
94 | #define VNODE_POSITION_INVALID BHV_POSITION_INVALID /* invalid pos. num */ | 63 | #define VNODE_POSITION_INVALID BHV_POSITION_INVALID /* invalid pos. num */ |
@@ -110,8 +79,8 @@ typedef enum { | |||
110 | /* | 79 | /* |
111 | * Macros for dealing with the behavior descriptor inside of the vnode. | 80 | * Macros for dealing with the behavior descriptor inside of the vnode. |
112 | */ | 81 | */ |
113 | #define BHV_TO_VNODE(bdp) ((vnode_t *)BHV_VOBJ(bdp)) | 82 | #define BHV_TO_VNODE(bdp) ((bhv_vnode_t *)BHV_VOBJ(bdp)) |
114 | #define BHV_TO_VNODE_NULL(bdp) ((vnode_t *)BHV_VOBJNULL(bdp)) | 83 | #define BHV_TO_VNODE_NULL(bdp) ((bhv_vnode_t *)BHV_VOBJNULL(bdp)) |
115 | 84 | ||
116 | #define VN_BHV_HEAD(vp) ((bhv_head_t *)(&((vp)->v_bh))) | 85 | #define VN_BHV_HEAD(vp) ((bhv_head_t *)(&((vp)->v_bh))) |
117 | #define vn_bhv_head_init(bhp,name) bhv_head_init(bhp,name) | 86 | #define vn_bhv_head_init(bhp,name) bhv_head_init(bhp,name) |
@@ -122,17 +91,17 @@ typedef enum { | |||
122 | /* | 91 | /* |
123 | * Vnode to Linux inode mapping. | 92 | * Vnode to Linux inode mapping. |
124 | */ | 93 | */ |
125 | static inline struct vnode *vn_from_inode(struct inode *inode) | 94 | static inline struct bhv_vnode *vn_from_inode(struct inode *inode) |
126 | { | 95 | { |
127 | return (vnode_t *)list_entry(inode, vnode_t, v_inode); | 96 | return (bhv_vnode_t *)list_entry(inode, bhv_vnode_t, v_inode); |
128 | } | 97 | } |
129 | static inline struct inode *vn_to_inode(struct vnode *vnode) | 98 | static inline struct inode *vn_to_inode(struct bhv_vnode *vnode) |
130 | { | 99 | { |
131 | return &vnode->v_inode; | 100 | return &vnode->v_inode; |
132 | } | 101 | } |
133 | 102 | ||
134 | /* | 103 | /* |
135 | * Values for the VOP_RWLOCK and VOP_RWUNLOCK flags parameter. | 104 | * Values for the vop_rwlock/rwunlock flags parameter. |
136 | */ | 105 | */ |
137 | typedef enum vrwlock { | 106 | typedef enum vrwlock { |
138 | VRWLOCK_NONE, | 107 | VRWLOCK_NONE, |
@@ -144,7 +113,7 @@ typedef enum vrwlock { | |||
144 | } vrwlock_t; | 113 | } vrwlock_t; |
145 | 114 | ||
146 | /* | 115 | /* |
147 | * Return values for VOP_INACTIVE. A return value of | 116 | * Return values for bhv_vop_inactive. A return value of |
148 | * VN_INACTIVE_NOCACHE implies that the file system behavior | 117 | * VN_INACTIVE_NOCACHE implies that the file system behavior |
149 | * has disassociated its state and bhv_desc_t from the vnode. | 118 | * has disassociated its state and bhv_desc_t from the vnode. |
150 | */ | 119 | */ |
@@ -152,7 +121,7 @@ typedef enum vrwlock { | |||
152 | #define VN_INACTIVE_NOCACHE 1 | 121 | #define VN_INACTIVE_NOCACHE 1 |
153 | 122 | ||
154 | /* | 123 | /* |
155 | * Values for the cmd code given to VOP_VNODE_CHANGE. | 124 | * Values for the cmd code given to vop_vnode_change. |
156 | */ | 125 | */ |
157 | typedef enum vchange { | 126 | typedef enum vchange { |
158 | VCHANGE_FLAGS_FRLOCKS = 0, | 127 | VCHANGE_FLAGS_FRLOCKS = 0, |
@@ -188,22 +157,22 @@ typedef int (*vop_getattr_t)(bhv_desc_t *, struct vattr *, int, | |||
188 | typedef int (*vop_setattr_t)(bhv_desc_t *, struct vattr *, int, | 157 | typedef int (*vop_setattr_t)(bhv_desc_t *, struct vattr *, int, |
189 | struct cred *); | 158 | struct cred *); |
190 | typedef int (*vop_access_t)(bhv_desc_t *, int, struct cred *); | 159 | typedef int (*vop_access_t)(bhv_desc_t *, int, struct cred *); |
191 | typedef int (*vop_lookup_t)(bhv_desc_t *, vname_t *, vnode_t **, | 160 | typedef int (*vop_lookup_t)(bhv_desc_t *, vname_t *, bhv_vnode_t **, |
192 | int, vnode_t *, struct cred *); | 161 | int, bhv_vnode_t *, struct cred *); |
193 | typedef int (*vop_create_t)(bhv_desc_t *, vname_t *, struct vattr *, | 162 | typedef int (*vop_create_t)(bhv_desc_t *, vname_t *, struct vattr *, |
194 | vnode_t **, struct cred *); | 163 | bhv_vnode_t **, struct cred *); |
195 | typedef int (*vop_remove_t)(bhv_desc_t *, vname_t *, struct cred *); | 164 | typedef int (*vop_remove_t)(bhv_desc_t *, vname_t *, struct cred *); |
196 | typedef int (*vop_link_t)(bhv_desc_t *, vnode_t *, vname_t *, | 165 | typedef int (*vop_link_t)(bhv_desc_t *, bhv_vnode_t *, vname_t *, |
197 | struct cred *); | ||
198 | typedef int (*vop_rename_t)(bhv_desc_t *, vname_t *, vnode_t *, vname_t *, | ||
199 | struct cred *); | 166 | struct cred *); |
167 | typedef int (*vop_rename_t)(bhv_desc_t *, vname_t *, bhv_vnode_t *, | ||
168 | vname_t *, struct cred *); | ||
200 | typedef int (*vop_mkdir_t)(bhv_desc_t *, vname_t *, struct vattr *, | 169 | typedef int (*vop_mkdir_t)(bhv_desc_t *, vname_t *, struct vattr *, |
201 | vnode_t **, struct cred *); | 170 | bhv_vnode_t **, struct cred *); |
202 | typedef int (*vop_rmdir_t)(bhv_desc_t *, vname_t *, struct cred *); | 171 | typedef int (*vop_rmdir_t)(bhv_desc_t *, vname_t *, struct cred *); |
203 | typedef int (*vop_readdir_t)(bhv_desc_t *, struct uio *, struct cred *, | 172 | typedef int (*vop_readdir_t)(bhv_desc_t *, struct uio *, struct cred *, |
204 | int *); | 173 | int *); |
205 | typedef int (*vop_symlink_t)(bhv_desc_t *, vname_t *, struct vattr *, | 174 | typedef int (*vop_symlink_t)(bhv_desc_t *, vname_t *, struct vattr *, |
206 | char *, vnode_t **, struct cred *); | 175 | char *, bhv_vnode_t **, struct cred *); |
207 | typedef int (*vop_readlink_t)(bhv_desc_t *, struct uio *, int, | 176 | typedef int (*vop_readlink_t)(bhv_desc_t *, struct uio *, int, |
208 | struct cred *); | 177 | struct cred *); |
209 | typedef int (*vop_fsync_t)(bhv_desc_t *, int, struct cred *, | 178 | typedef int (*vop_fsync_t)(bhv_desc_t *, int, struct cred *, |
@@ -224,7 +193,7 @@ typedef int (*vop_attr_remove_t)(bhv_desc_t *, const char *, | |||
224 | int, struct cred *); | 193 | int, struct cred *); |
225 | typedef int (*vop_attr_list_t)(bhv_desc_t *, char *, int, int, | 194 | typedef int (*vop_attr_list_t)(bhv_desc_t *, char *, int, int, |
226 | struct attrlist_cursor_kern *, struct cred *); | 195 | struct attrlist_cursor_kern *, struct cred *); |
227 | typedef void (*vop_link_removed_t)(bhv_desc_t *, vnode_t *, int); | 196 | typedef void (*vop_link_removed_t)(bhv_desc_t *, bhv_vnode_t *, int); |
228 | typedef void (*vop_vnode_change_t)(bhv_desc_t *, vchange_t, __psint_t); | 197 | typedef void (*vop_vnode_change_t)(bhv_desc_t *, vchange_t, __psint_t); |
229 | typedef void (*vop_ptossvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int); | 198 | typedef void (*vop_ptossvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int); |
230 | typedef void (*vop_pflushinvalvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int); | 199 | typedef void (*vop_pflushinvalvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, int); |
@@ -233,7 +202,7 @@ typedef int (*vop_pflushvp_t)(bhv_desc_t *, xfs_off_t, xfs_off_t, | |||
233 | typedef int (*vop_iflush_t)(bhv_desc_t *, int); | 202 | typedef int (*vop_iflush_t)(bhv_desc_t *, int); |
234 | 203 | ||
235 | 204 | ||
236 | typedef struct vnodeops { | 205 | typedef struct bhv_vnodeops { |
237 | bhv_position_t vn_position; /* position within behavior chain */ | 206 | bhv_position_t vn_position; /* position within behavior chain */ |
238 | vop_open_t vop_open; | 207 | vop_open_t vop_open; |
239 | vop_close_t vop_close; | 208 | vop_close_t vop_close; |
@@ -274,105 +243,80 @@ typedef struct vnodeops { | |||
274 | vop_pflushvp_t vop_flush_pages; | 243 | vop_pflushvp_t vop_flush_pages; |
275 | vop_release_t vop_release; | 244 | vop_release_t vop_release; |
276 | vop_iflush_t vop_iflush; | 245 | vop_iflush_t vop_iflush; |
277 | } vnodeops_t; | 246 | } bhv_vnodeops_t; |
278 | 247 | ||
279 | /* | 248 | /* |
280 | * VOP's. | 249 | * Virtual node operations, operating from head bhv. |
281 | */ | ||
282 | #define _VOP_(op, vp) (*((vnodeops_t *)(vp)->v_fops)->op) | ||
283 | |||
284 | #define VOP_OPEN(vp, cr, rv) \ | ||
285 | rv = _VOP_(vop_open, vp)((vp)->v_fbhv, cr) | ||
286 | #define VOP_CLOSE(vp, f, last, cr, rv) \ | ||
287 | rv = _VOP_(vop_close, vp)((vp)->v_fbhv, f, last, cr) | ||
288 | #define VOP_READ(vp,file,iov,segs,offset,ioflags,cr,rv) \ | ||
289 | rv = _VOP_(vop_read, vp)((vp)->v_fbhv,file,iov,segs,offset,ioflags,cr) | ||
290 | #define VOP_WRITE(vp,file,iov,segs,offset,ioflags,cr,rv) \ | ||
291 | rv = _VOP_(vop_write, vp)((vp)->v_fbhv,file,iov,segs,offset,ioflags,cr) | ||
292 | #define VOP_SENDFILE(vp,f,off,ioflags,cnt,act,targ,cr,rv) \ | ||
293 | rv = _VOP_(vop_sendfile, vp)((vp)->v_fbhv,f,off,ioflags,cnt,act,targ,cr) | ||
294 | #define VOP_SPLICE_READ(vp,f,o,pipe,cnt,fl,iofl,cr,rv) \ | ||
295 | rv = _VOP_(vop_splice_read, vp)((vp)->v_fbhv,f,o,pipe,cnt,fl,iofl,cr) | ||
296 | #define VOP_SPLICE_WRITE(vp,f,o,pipe,cnt,fl,iofl,cr,rv) \ | ||
297 | rv = _VOP_(vop_splice_write, vp)((vp)->v_fbhv,f,o,pipe,cnt,fl,iofl,cr) | ||
298 | #define VOP_BMAP(vp,of,sz,rw,b,n,rv) \ | ||
299 | rv = _VOP_(vop_bmap, vp)((vp)->v_fbhv,of,sz,rw,b,n) | ||
300 | #define VOP_GETATTR(vp, vap, f, cr, rv) \ | ||
301 | rv = _VOP_(vop_getattr, vp)((vp)->v_fbhv, vap, f, cr) | ||
302 | #define VOP_SETATTR(vp, vap, f, cr, rv) \ | ||
303 | rv = _VOP_(vop_setattr, vp)((vp)->v_fbhv, vap, f, cr) | ||
304 | #define VOP_ACCESS(vp, mode, cr, rv) \ | ||
305 | rv = _VOP_(vop_access, vp)((vp)->v_fbhv, mode, cr) | ||
306 | #define VOP_LOOKUP(vp,d,vpp,f,rdir,cr,rv) \ | ||
307 | rv = _VOP_(vop_lookup, vp)((vp)->v_fbhv,d,vpp,f,rdir,cr) | ||
308 | #define VOP_CREATE(dvp,d,vap,vpp,cr,rv) \ | ||
309 | rv = _VOP_(vop_create, dvp)((dvp)->v_fbhv,d,vap,vpp,cr) | ||
310 | #define VOP_REMOVE(dvp,d,cr,rv) \ | ||
311 | rv = _VOP_(vop_remove, dvp)((dvp)->v_fbhv,d,cr) | ||
312 | #define VOP_LINK(tdvp,fvp,d,cr,rv) \ | ||
313 | rv = _VOP_(vop_link, tdvp)((tdvp)->v_fbhv,fvp,d,cr) | ||
314 | #define VOP_RENAME(fvp,fnm,tdvp,tnm,cr,rv) \ | ||
315 | rv = _VOP_(vop_rename, fvp)((fvp)->v_fbhv,fnm,tdvp,tnm,cr) | ||
316 | #define VOP_MKDIR(dp,d,vap,vpp,cr,rv) \ | ||
317 | rv = _VOP_(vop_mkdir, dp)((dp)->v_fbhv,d,vap,vpp,cr) | ||
318 | #define VOP_RMDIR(dp,d,cr,rv) \ | ||
319 | rv = _VOP_(vop_rmdir, dp)((dp)->v_fbhv,d,cr) | ||
320 | #define VOP_READDIR(vp,uiop,cr,eofp,rv) \ | ||
321 | rv = _VOP_(vop_readdir, vp)((vp)->v_fbhv,uiop,cr,eofp) | ||
322 | #define VOP_SYMLINK(dvp,d,vap,tnm,vpp,cr,rv) \ | ||
323 | rv = _VOP_(vop_symlink, dvp) ((dvp)->v_fbhv,d,vap,tnm,vpp,cr) | ||
324 | #define VOP_READLINK(vp,uiop,fl,cr,rv) \ | ||
325 | rv = _VOP_(vop_readlink, vp)((vp)->v_fbhv,uiop,fl,cr) | ||
326 | #define VOP_FSYNC(vp,f,cr,b,e,rv) \ | ||
327 | rv = _VOP_(vop_fsync, vp)((vp)->v_fbhv,f,cr,b,e) | ||
328 | #define VOP_INACTIVE(vp, cr, rv) \ | ||
329 | rv = _VOP_(vop_inactive, vp)((vp)->v_fbhv, cr) | ||
330 | #define VOP_RELEASE(vp, rv) \ | ||
331 | rv = _VOP_(vop_release, vp)((vp)->v_fbhv) | ||
332 | #define VOP_FID2(vp, fidp, rv) \ | ||
333 | rv = _VOP_(vop_fid2, vp)((vp)->v_fbhv, fidp) | ||
334 | #define VOP_RWLOCK(vp,i) \ | ||
335 | (void)_VOP_(vop_rwlock, vp)((vp)->v_fbhv, i) | ||
336 | #define VOP_RWLOCK_TRY(vp,i) \ | ||
337 | _VOP_(vop_rwlock, vp)((vp)->v_fbhv, i) | ||
338 | #define VOP_RWUNLOCK(vp,i) \ | ||
339 | (void)_VOP_(vop_rwunlock, vp)((vp)->v_fbhv, i) | ||
340 | #define VOP_FRLOCK(vp,c,fl,flags,offset,fr,rv) \ | ||
341 | rv = _VOP_(vop_frlock, vp)((vp)->v_fbhv,c,fl,flags,offset,fr) | ||
342 | #define VOP_RECLAIM(vp, rv) \ | ||
343 | rv = _VOP_(vop_reclaim, vp)((vp)->v_fbhv) | ||
344 | #define VOP_ATTR_GET(vp, name, val, vallenp, fl, cred, rv) \ | ||
345 | rv = _VOP_(vop_attr_get, vp)((vp)->v_fbhv,name,val,vallenp,fl,cred) | ||
346 | #define VOP_ATTR_SET(vp, name, val, vallen, fl, cred, rv) \ | ||
347 | rv = _VOP_(vop_attr_set, vp)((vp)->v_fbhv,name,val,vallen,fl,cred) | ||
348 | #define VOP_ATTR_REMOVE(vp, name, flags, cred, rv) \ | ||
349 | rv = _VOP_(vop_attr_remove, vp)((vp)->v_fbhv,name,flags,cred) | ||
350 | #define VOP_ATTR_LIST(vp, buf, buflen, fl, cursor, cred, rv) \ | ||
351 | rv = _VOP_(vop_attr_list, vp)((vp)->v_fbhv,buf,buflen,fl,cursor,cred) | ||
352 | #define VOP_LINK_REMOVED(vp, dvp, linkzero) \ | ||
353 | (void)_VOP_(vop_link_removed, vp)((vp)->v_fbhv, dvp, linkzero) | ||
354 | #define VOP_VNODE_CHANGE(vp, cmd, val) \ | ||
355 | (void)_VOP_(vop_vnode_change, vp)((vp)->v_fbhv,cmd,val) | ||
356 | /* | ||
357 | * These are page cache functions that now go thru VOPs. | ||
358 | * 'last' parameter is unused and left in for IRIX compatibility | ||
359 | */ | ||
360 | #define VOP_TOSS_PAGES(vp, first, last, fiopt) \ | ||
361 | _VOP_(vop_tosspages, vp)((vp)->v_fbhv,first, last, fiopt) | ||
362 | /* | ||
363 | * 'last' parameter is unused and left in for IRIX compatibility | ||
364 | */ | ||
365 | #define VOP_FLUSHINVAL_PAGES(vp, first, last, fiopt) \ | ||
366 | _VOP_(vop_flushinval_pages, vp)((vp)->v_fbhv,first,last,fiopt) | ||
367 | /* | ||
368 | * 'last' parameter is unused and left in for IRIX compatibility | ||
369 | */ | 250 | */ |
370 | #define VOP_FLUSH_PAGES(vp, first, last, flags, fiopt, rv) \ | 251 | #define VNHEAD(vp) ((vp)->v_bh.bh_first) |
371 | rv = _VOP_(vop_flush_pages, vp)((vp)->v_fbhv,first,last,flags,fiopt) | 252 | #define VOP(op, vp) (*((bhv_vnodeops_t *)VNHEAD(vp)->bd_ops)->op) |
372 | #define VOP_IOCTL(vp, inode, filp, fl, cmd, arg, rv) \ | 253 | #define bhv_vop_open(vp, cr) VOP(vop_open, vp)(VNHEAD(vp),cr) |
373 | rv = _VOP_(vop_ioctl, vp)((vp)->v_fbhv,inode,filp,fl,cmd,arg) | 254 | #define bhv_vop_close(vp, f,last,cr) VOP(vop_close, vp)(VNHEAD(vp),f,last,cr) |
374 | #define VOP_IFLUSH(vp, flags, rv) \ | 255 | #define bhv_vop_read(vp,file,iov,segs,offset,ioflags,cr) \ |
375 | rv = _VOP_(vop_iflush, vp)((vp)->v_fbhv, flags) | 256 | VOP(vop_read, vp)(VNHEAD(vp),file,iov,segs,offset,ioflags,cr) |
257 | #define bhv_vop_write(vp,file,iov,segs,offset,ioflags,cr) \ | ||
258 | VOP(vop_write, vp)(VNHEAD(vp),file,iov,segs,offset,ioflags,cr) | ||
259 | #define bhv_vop_sendfile(vp,f,off,ioflags,cnt,act,targ,cr) \ | ||
260 | VOP(vop_sendfile, vp)(VNHEAD(vp),f,off,ioflags,cnt,act,targ,cr) | ||
261 | #define bhv_vop_splice_read(vp,f,o,pipe,cnt,fl,iofl,cr) \ | ||
262 | VOP(vop_splice_read, vp)(VNHEAD(vp),f,o,pipe,cnt,fl,iofl,cr) | ||
263 | #define bhv_vop_splice_write(vp,f,o,pipe,cnt,fl,iofl,cr) \ | ||
264 | VOP(vop_splice_write, vp)(VNHEAD(vp),f,o,pipe,cnt,fl,iofl,cr) | ||
265 | #define bhv_vop_bmap(vp,of,sz,rw,b,n) \ | ||
266 | VOP(vop_bmap, vp)(VNHEAD(vp),of,sz,rw,b,n) | ||
267 | #define bhv_vop_getattr(vp, vap,f,cr) \ | ||
268 | VOP(vop_getattr, vp)(VNHEAD(vp), vap,f,cr) | ||
269 | #define bhv_vop_setattr(vp, vap,f,cr) \ | ||
270 | VOP(vop_setattr, vp)(VNHEAD(vp), vap,f,cr) | ||
271 | #define bhv_vop_access(vp, mode,cr) VOP(vop_access, vp)(VNHEAD(vp), mode,cr) | ||
272 | #define bhv_vop_lookup(vp,d,vpp,f,rdir,cr) \ | ||
273 | VOP(vop_lookup, vp)(VNHEAD(vp),d,vpp,f,rdir,cr) | ||
274 | #define bhv_vop_create(dvp,d,vap,vpp,cr) \ | ||
275 | VOP(vop_create, dvp)(VNHEAD(dvp),d,vap,vpp,cr) | ||
276 | #define bhv_vop_remove(dvp,d,cr) VOP(vop_remove, dvp)(VNHEAD(dvp),d,cr) | ||
277 | #define bhv_vop_link(dvp,fvp,d,cr) VOP(vop_link, dvp)(VNHEAD(dvp),fvp,d,cr) | ||
278 | #define bhv_vop_rename(fvp,fnm,tdvp,tnm,cr) \ | ||
279 | VOP(vop_rename, fvp)(VNHEAD(fvp),fnm,tdvp,tnm,cr) | ||
280 | #define bhv_vop_mkdir(dp,d,vap,vpp,cr) \ | ||
281 | VOP(vop_mkdir, dp)(VNHEAD(dp),d,vap,vpp,cr) | ||
282 | #define bhv_vop_rmdir(dp,d,cr) VOP(vop_rmdir, dp)(VNHEAD(dp),d,cr) | ||
283 | #define bhv_vop_readdir(vp,uiop,cr,eofp) \ | ||
284 | VOP(vop_readdir, vp)(VNHEAD(vp),uiop,cr,eofp) | ||
285 | #define bhv_vop_symlink(dvp,d,vap,tnm,vpp,cr) \ | ||
286 | VOP(vop_symlink, dvp)(VNHEAD(dvp),d,vap,tnm,vpp,cr) | ||
287 | #define bhv_vop_readlink(vp,uiop,fl,cr) \ | ||
288 | VOP(vop_readlink, vp)(VNHEAD(vp),uiop,fl,cr) | ||
289 | #define bhv_vop_fsync(vp,f,cr,b,e) VOP(vop_fsync, vp)(VNHEAD(vp),f,cr,b,e) | ||
290 | #define bhv_vop_inactive(vp,cr) VOP(vop_inactive, vp)(VNHEAD(vp),cr) | ||
291 | #define bhv_vop_release(vp) VOP(vop_release, vp)(VNHEAD(vp)) | ||
292 | #define bhv_vop_fid2(vp,fidp) VOP(vop_fid2, vp)(VNHEAD(vp),fidp) | ||
293 | #define bhv_vop_rwlock(vp,i) VOP(vop_rwlock, vp)(VNHEAD(vp),i) | ||
294 | #define bhv_vop_rwlock_try(vp,i) VOP(vop_rwlock, vp)(VNHEAD(vp),i) | ||
295 | #define bhv_vop_rwunlock(vp,i) VOP(vop_rwunlock, vp)(VNHEAD(vp),i) | ||
296 | #define bhv_vop_frlock(vp,c,fl,flags,offset,fr) \ | ||
297 | VOP(vop_frlock, vp)(VNHEAD(vp),c,fl,flags,offset,fr) | ||
298 | #define bhv_vop_reclaim(vp) VOP(vop_reclaim, vp)(VNHEAD(vp)) | ||
299 | #define bhv_vop_attr_get(vp, name, val, vallenp, fl, cred) \ | ||
300 | VOP(vop_attr_get, vp)(VNHEAD(vp),name,val,vallenp,fl,cred) | ||
301 | #define bhv_vop_attr_set(vp, name, val, vallen, fl, cred) \ | ||
302 | VOP(vop_attr_set, vp)(VNHEAD(vp),name,val,vallen,fl,cred) | ||
303 | #define bhv_vop_attr_remove(vp, name, flags, cred) \ | ||
304 | VOP(vop_attr_remove, vp)(VNHEAD(vp),name,flags,cred) | ||
305 | #define bhv_vop_attr_list(vp, buf, buflen, fl, cursor, cred) \ | ||
306 | VOP(vop_attr_list, vp)(VNHEAD(vp),buf,buflen,fl,cursor,cred) | ||
307 | #define bhv_vop_link_removed(vp, dvp, linkzero) \ | ||
308 | VOP(vop_link_removed, vp)(VNHEAD(vp), dvp, linkzero) | ||
309 | #define bhv_vop_vnode_change(vp, cmd, val) \ | ||
310 | VOP(vop_vnode_change, vp)(VNHEAD(vp), cmd, val) | ||
311 | #define bhv_vop_toss_pages(vp, first, last, fiopt) \ | ||
312 | VOP(vop_tosspages, vp)(VNHEAD(vp), first, last, fiopt) | ||
313 | #define bhv_vop_flushinval_pages(vp, first, last, fiopt) \ | ||
314 | VOP(vop_flushinval_pages, vp)(VNHEAD(vp),first,last,fiopt) | ||
315 | #define bhv_vop_flush_pages(vp, first, last, flags, fiopt) \ | ||
316 | VOP(vop_flush_pages, vp)(VNHEAD(vp),first,last,flags,fiopt) | ||
317 | #define bhv_vop_ioctl(vp, inode, filp, fl, cmd, arg) \ | ||
318 | VOP(vop_ioctl, vp)(VNHEAD(vp),inode,filp,fl,cmd,arg) | ||
319 | #define bhv_vop_iflush(vp, flags) VOP(vop_iflush, vp)(VNHEAD(vp), flags) | ||
376 | 320 | ||
377 | /* | 321 | /* |
378 | * Flags for read/write calls - same values as IRIX | 322 | * Flags for read/write calls - same values as IRIX |
@@ -382,7 +326,7 @@ typedef struct vnodeops { | |||
382 | #define IO_INVIS 0x00020 /* don't update inode timestamps */ | 326 | #define IO_INVIS 0x00020 /* don't update inode timestamps */ |
383 | 327 | ||
384 | /* | 328 | /* |
385 | * Flags for VOP_IFLUSH call | 329 | * Flags for vop_iflush call |
386 | */ | 330 | */ |
387 | #define FLUSH_SYNC 1 /* wait for flush to complete */ | 331 | #define FLUSH_SYNC 1 /* wait for flush to complete */ |
388 | #define FLUSH_INODE 2 /* flush the inode itself */ | 332 | #define FLUSH_INODE 2 /* flush the inode itself */ |
@@ -390,8 +334,7 @@ typedef struct vnodeops { | |||
390 | * this inode out to disk */ | 334 | * this inode out to disk */ |
391 | 335 | ||
392 | /* | 336 | /* |
393 | * Flush/Invalidate options for VOP_TOSS_PAGES, VOP_FLUSHINVAL_PAGES and | 337 | * Flush/Invalidate options for vop_toss/flush/flushinval_pages. |
394 | * VOP_FLUSH_PAGES. | ||
395 | */ | 338 | */ |
396 | #define FI_NONE 0 /* none */ | 339 | #define FI_NONE 0 /* none */ |
397 | #define FI_REMAPF 1 /* Do a remapf prior to the operation */ | 340 | #define FI_REMAPF 1 /* Do a remapf prior to the operation */ |
@@ -497,31 +440,17 @@ typedef struct vattr { | |||
497 | (VN_ISREG(vp) && ((mode) & (VSGID|(VEXEC>>3))) == VSGID) | 440 | (VN_ISREG(vp) && ((mode) & (VSGID|(VEXEC>>3))) == VSGID) |
498 | 441 | ||
499 | extern void vn_init(void); | 442 | extern void vn_init(void); |
500 | extern vnode_t *vn_initialize(struct inode *); | 443 | extern bhv_vnode_t *vn_initialize(struct inode *); |
501 | 444 | extern int vn_revalidate(struct bhv_vnode *); | |
502 | /* | 445 | extern int __vn_revalidate(struct bhv_vnode *, vattr_t *); |
503 | * vnode_map structures _must_ match vn_epoch and vnode structure sizes. | 446 | extern void vn_revalidate_core(struct bhv_vnode *, vattr_t *); |
504 | */ | ||
505 | typedef struct vnode_map { | ||
506 | bhv_vfs_t *v_vfsp; | ||
507 | vnumber_t v_number; /* in-core vnode number */ | ||
508 | xfs_ino_t v_ino; /* inode # */ | ||
509 | } vmap_t; | ||
510 | |||
511 | #define VMAP(vp, vmap) {(vmap).v_vfsp = (vp)->v_vfsp, \ | ||
512 | (vmap).v_number = (vp)->v_number, \ | ||
513 | (vmap).v_ino = (vp)->v_inode.i_ino; } | ||
514 | |||
515 | extern int vn_revalidate(struct vnode *); | ||
516 | extern int __vn_revalidate(struct vnode *, vattr_t *); | ||
517 | extern void vn_revalidate_core(struct vnode *, vattr_t *); | ||
518 | 447 | ||
519 | extern void vn_iowait(struct vnode *vp); | 448 | extern void vn_iowait(struct bhv_vnode *vp); |
520 | extern void vn_iowake(struct vnode *vp); | 449 | extern void vn_iowake(struct bhv_vnode *vp); |
521 | 450 | ||
522 | extern void vn_ioerror(struct vnode *vp, int error, char *f, int l); | 451 | extern void vn_ioerror(struct bhv_vnode *vp, int error, char *f, int l); |
523 | 452 | ||
524 | static inline int vn_count(struct vnode *vp) | 453 | static inline int vn_count(struct bhv_vnode *vp) |
525 | { | 454 | { |
526 | return atomic_read(&vn_to_inode(vp)->i_count); | 455 | return atomic_read(&vn_to_inode(vp)->i_count); |
527 | } | 456 | } |
@@ -529,7 +458,7 @@ static inline int vn_count(struct vnode *vp) | |||
529 | /* | 458 | /* |
530 | * Vnode reference counting functions (and macros for compatibility). | 459 | * Vnode reference counting functions (and macros for compatibility). |
531 | */ | 460 | */ |
532 | extern vnode_t *vn_hold(struct vnode *); | 461 | extern bhv_vnode_t *vn_hold(struct bhv_vnode *); |
533 | 462 | ||
534 | #if defined(XFS_VNODE_TRACE) | 463 | #if defined(XFS_VNODE_TRACE) |
535 | #define VN_HOLD(vp) \ | 464 | #define VN_HOLD(vp) \ |
@@ -543,7 +472,7 @@ extern vnode_t *vn_hold(struct vnode *); | |||
543 | #define VN_RELE(vp) (iput(vn_to_inode(vp))) | 472 | #define VN_RELE(vp) (iput(vn_to_inode(vp))) |
544 | #endif | 473 | #endif |
545 | 474 | ||
546 | static inline struct vnode *vn_grab(struct vnode *vp) | 475 | static inline struct bhv_vnode *vn_grab(struct bhv_vnode *vp) |
547 | { | 476 | { |
548 | struct inode *inode = igrab(vn_to_inode(vp)); | 477 | struct inode *inode = igrab(vn_to_inode(vp)); |
549 | return inode ? vn_from_inode(inode) : NULL; | 478 | return inode ? vn_from_inode(inode) : NULL; |
@@ -562,14 +491,14 @@ static inline struct vnode *vn_grab(struct vnode *vp) | |||
562 | #define VN_LOCK(vp) mutex_spinlock(&(vp)->v_lock) | 491 | #define VN_LOCK(vp) mutex_spinlock(&(vp)->v_lock) |
563 | #define VN_UNLOCK(vp, s) mutex_spinunlock(&(vp)->v_lock, s) | 492 | #define VN_UNLOCK(vp, s) mutex_spinunlock(&(vp)->v_lock, s) |
564 | 493 | ||
565 | static __inline__ void vn_flagset(struct vnode *vp, uint flag) | 494 | static __inline__ void vn_flagset(struct bhv_vnode *vp, uint flag) |
566 | { | 495 | { |
567 | spin_lock(&vp->v_lock); | 496 | spin_lock(&vp->v_lock); |
568 | vp->v_flag |= flag; | 497 | vp->v_flag |= flag; |
569 | spin_unlock(&vp->v_lock); | 498 | spin_unlock(&vp->v_lock); |
570 | } | 499 | } |
571 | 500 | ||
572 | static __inline__ uint vn_flagclr(struct vnode *vp, uint flag) | 501 | static __inline__ uint vn_flagclr(struct bhv_vnode *vp, uint flag) |
573 | { | 502 | { |
574 | uint cleared; | 503 | uint cleared; |
575 | 504 | ||
@@ -588,12 +517,12 @@ static __inline__ uint vn_flagclr(struct vnode *vp, uint flag) | |||
588 | /* | 517 | /* |
589 | * Dealing with bad inodes | 518 | * Dealing with bad inodes |
590 | */ | 519 | */ |
591 | static inline void vn_mark_bad(struct vnode *vp) | 520 | static inline void vn_mark_bad(struct bhv_vnode *vp) |
592 | { | 521 | { |
593 | make_bad_inode(vn_to_inode(vp)); | 522 | make_bad_inode(vn_to_inode(vp)); |
594 | } | 523 | } |
595 | 524 | ||
596 | static inline int VN_BAD(struct vnode *vp) | 525 | static inline int VN_BAD(struct bhv_vnode *vp) |
597 | { | 526 | { |
598 | return is_bad_inode(vn_to_inode(vp)); | 527 | return is_bad_inode(vn_to_inode(vp)); |
599 | } | 528 | } |
@@ -601,18 +530,18 @@ static inline int VN_BAD(struct vnode *vp) | |||
601 | /* | 530 | /* |
602 | * Extracting atime values in various formats | 531 | * Extracting atime values in various formats |
603 | */ | 532 | */ |
604 | static inline void vn_atime_to_bstime(struct vnode *vp, xfs_bstime_t *bs_atime) | 533 | static inline void vn_atime_to_bstime(bhv_vnode_t *vp, xfs_bstime_t *bs_atime) |
605 | { | 534 | { |
606 | bs_atime->tv_sec = vp->v_inode.i_atime.tv_sec; | 535 | bs_atime->tv_sec = vp->v_inode.i_atime.tv_sec; |
607 | bs_atime->tv_nsec = vp->v_inode.i_atime.tv_nsec; | 536 | bs_atime->tv_nsec = vp->v_inode.i_atime.tv_nsec; |
608 | } | 537 | } |
609 | 538 | ||
610 | static inline void vn_atime_to_timespec(struct vnode *vp, struct timespec *ts) | 539 | static inline void vn_atime_to_timespec(bhv_vnode_t *vp, struct timespec *ts) |
611 | { | 540 | { |
612 | *ts = vp->v_inode.i_atime; | 541 | *ts = vp->v_inode.i_atime; |
613 | } | 542 | } |
614 | 543 | ||
615 | static inline void vn_atime_to_time_t(struct vnode *vp, time_t *tt) | 544 | static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt) |
616 | { | 545 | { |
617 | *tt = vp->v_inode.i_atime.tv_sec; | 546 | *tt = vp->v_inode.i_atime.tv_sec; |
618 | } | 547 | } |
@@ -627,7 +556,7 @@ static inline void vn_atime_to_time_t(struct vnode *vp, time_t *tt) | |||
627 | #define VN_TRUNC(vp) ((vp)->v_flag & VTRUNCATED) | 556 | #define VN_TRUNC(vp) ((vp)->v_flag & VTRUNCATED) |
628 | 557 | ||
629 | /* | 558 | /* |
630 | * Flags to VOP_SETATTR/VOP_GETATTR. | 559 | * Flags to vop_setattr/getattr. |
631 | */ | 560 | */ |
632 | #define ATTR_UTIME 0x01 /* non-default utime(2) request */ | 561 | #define ATTR_UTIME 0x01 /* non-default utime(2) request */ |
633 | #define ATTR_DMI 0x08 /* invocation from a DMI function */ | 562 | #define ATTR_DMI 0x08 /* invocation from a DMI function */ |
@@ -637,7 +566,7 @@ static inline void vn_atime_to_time_t(struct vnode *vp, time_t *tt) | |||
637 | #define ATTR_NOSIZETOK 0x400 /* Don't get the SIZE token */ | 566 | #define ATTR_NOSIZETOK 0x400 /* Don't get the SIZE token */ |
638 | 567 | ||
639 | /* | 568 | /* |
640 | * Flags to VOP_FSYNC and VOP_RECLAIM. | 569 | * Flags to vop_fsync/reclaim. |
641 | */ | 570 | */ |
642 | #define FSYNC_NOWAIT 0 /* asynchronous flush */ | 571 | #define FSYNC_NOWAIT 0 /* asynchronous flush */ |
643 | #define FSYNC_WAIT 0x1 /* synchronous fsync or forced reclaim */ | 572 | #define FSYNC_WAIT 0x1 /* synchronous fsync or forced reclaim */ |
@@ -656,11 +585,11 @@ static inline void vn_atime_to_time_t(struct vnode *vp, time_t *tt) | |||
656 | #define VNODE_KTRACE_REF 4 | 585 | #define VNODE_KTRACE_REF 4 |
657 | #define VNODE_KTRACE_RELE 5 | 586 | #define VNODE_KTRACE_RELE 5 |
658 | 587 | ||
659 | extern void vn_trace_entry(struct vnode *, const char *, inst_t *); | 588 | extern void vn_trace_entry(struct bhv_vnode *, const char *, inst_t *); |
660 | extern void vn_trace_exit(struct vnode *, const char *, inst_t *); | 589 | extern void vn_trace_exit(struct bhv_vnode *, const char *, inst_t *); |
661 | extern void vn_trace_hold(struct vnode *, char *, int, inst_t *); | 590 | extern void vn_trace_hold(struct bhv_vnode *, char *, int, inst_t *); |
662 | extern void vn_trace_ref(struct vnode *, char *, int, inst_t *); | 591 | extern void vn_trace_ref(struct bhv_vnode *, char *, int, inst_t *); |
663 | extern void vn_trace_rele(struct vnode *, char *, int, inst_t *); | 592 | extern void vn_trace_rele(struct bhv_vnode *, char *, int, inst_t *); |
664 | 593 | ||
665 | #define VN_TRACE(vp) \ | 594 | #define VN_TRACE(vp) \ |
666 | vn_trace_ref(vp, __FILE__, __LINE__, (inst_t *)__return_address) | 595 | vn_trace_ref(vp, __FILE__, __LINE__, (inst_t *)__return_address) |