diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_vnode.h')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vnode.h | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h index a64b7db67003..569a4e7b5cc1 100644 --- a/fs/xfs/linux-2.6/xfs_vnode.h +++ b/fs/xfs/linux-2.6/xfs_vnode.h | |||
@@ -56,12 +56,18 @@ typedef xfs_ino_t vnumber_t; | |||
56 | typedef struct dentry vname_t; | 56 | typedef struct dentry vname_t; |
57 | typedef bhv_head_t vn_bhv_head_t; | 57 | typedef bhv_head_t vn_bhv_head_t; |
58 | 58 | ||
59 | typedef enum vflags { | ||
60 | VMODIFIED = 0x08, /* XFS inode state possibly differs */ | ||
61 | /* to the Linux inode state. */ | ||
62 | VTRUNCATED = 0x40, /* truncated down so flush-on-close */ | ||
63 | } vflags_t; | ||
64 | |||
59 | /* | 65 | /* |
60 | * MP locking protocols: | 66 | * MP locking protocols: |
61 | * v_flag, v_vfsp VN_LOCK/VN_UNLOCK | 67 | * v_flag, v_vfsp VN_LOCK/VN_UNLOCK |
62 | */ | 68 | */ |
63 | typedef struct vnode { | 69 | typedef struct vnode { |
64 | __u32 v_flag; /* vnode flags (see below) */ | 70 | vflags_t v_flag; /* vnode flags (see above) */ |
65 | struct vfs *v_vfsp; /* ptr to containing VFS */ | 71 | struct vfs *v_vfsp; /* ptr to containing VFS */ |
66 | vnumber_t v_number; /* in-core vnode number */ | 72 | vnumber_t v_number; /* in-core vnode number */ |
67 | vn_bhv_head_t v_bh; /* behavior head */ | 73 | vn_bhv_head_t v_bh; /* behavior head */ |
@@ -126,12 +132,6 @@ static inline struct inode *vn_to_inode(struct vnode *vnode) | |||
126 | } | 132 | } |
127 | 133 | ||
128 | /* | 134 | /* |
129 | * Vnode flags. | ||
130 | */ | ||
131 | #define VMODIFIED 0x8 /* XFS inode state possibly differs */ | ||
132 | /* to the Linux inode state. */ | ||
133 | |||
134 | /* | ||
135 | * Values for the VOP_RWLOCK and VOP_RWUNLOCK flags parameter. | 135 | * Values for the VOP_RWLOCK and VOP_RWUNLOCK flags parameter. |
136 | */ | 136 | */ |
137 | typedef enum vrwlock { | 137 | typedef enum vrwlock { |
@@ -162,8 +162,10 @@ typedef enum vchange { | |||
162 | VCHANGE_FLAGS_IOEXCL_COUNT = 4 | 162 | VCHANGE_FLAGS_IOEXCL_COUNT = 4 |
163 | } vchange_t; | 163 | } vchange_t; |
164 | 164 | ||
165 | typedef enum { L_FALSE, L_TRUE } lastclose_t; | ||
165 | 166 | ||
166 | typedef int (*vop_open_t)(bhv_desc_t *, struct cred *); | 167 | typedef int (*vop_open_t)(bhv_desc_t *, struct cred *); |
168 | typedef int (*vop_close_t)(bhv_desc_t *, int, lastclose_t, struct cred *); | ||
167 | typedef ssize_t (*vop_read_t)(bhv_desc_t *, struct kiocb *, | 169 | typedef ssize_t (*vop_read_t)(bhv_desc_t *, struct kiocb *, |
168 | const struct iovec *, unsigned int, | 170 | const struct iovec *, unsigned int, |
169 | loff_t *, int, struct cred *); | 171 | loff_t *, int, struct cred *); |
@@ -234,6 +236,7 @@ typedef int (*vop_iflush_t)(bhv_desc_t *, int); | |||
234 | typedef struct vnodeops { | 236 | typedef struct vnodeops { |
235 | bhv_position_t vn_position; /* position within behavior chain */ | 237 | bhv_position_t vn_position; /* position within behavior chain */ |
236 | vop_open_t vop_open; | 238 | vop_open_t vop_open; |
239 | vop_close_t vop_close; | ||
237 | vop_read_t vop_read; | 240 | vop_read_t vop_read; |
238 | vop_write_t vop_write; | 241 | vop_write_t vop_write; |
239 | vop_sendfile_t vop_sendfile; | 242 | vop_sendfile_t vop_sendfile; |
@@ -278,6 +281,10 @@ typedef struct vnodeops { | |||
278 | */ | 281 | */ |
279 | #define _VOP_(op, vp) (*((vnodeops_t *)(vp)->v_fops)->op) | 282 | #define _VOP_(op, vp) (*((vnodeops_t *)(vp)->v_fops)->op) |
280 | 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) | ||
281 | #define VOP_READ(vp,file,iov,segs,offset,ioflags,cr,rv) \ | 288 | #define VOP_READ(vp,file,iov,segs,offset,ioflags,cr,rv) \ |
282 | rv = _VOP_(vop_read, vp)((vp)->v_fbhv,file,iov,segs,offset,ioflags,cr) | 289 | rv = _VOP_(vop_read, vp)((vp)->v_fbhv,file,iov,segs,offset,ioflags,cr) |
283 | #define VOP_WRITE(vp,file,iov,segs,offset,ioflags,cr,rv) \ | 290 | #define VOP_WRITE(vp,file,iov,segs,offset,ioflags,cr,rv) \ |
@@ -290,8 +297,6 @@ typedef struct vnodeops { | |||
290 | rv = _VOP_(vop_splice_write, vp)((vp)->v_fbhv,f,o,pipe,cnt,fl,iofl,cr) | 297 | rv = _VOP_(vop_splice_write, vp)((vp)->v_fbhv,f,o,pipe,cnt,fl,iofl,cr) |
291 | #define VOP_BMAP(vp,of,sz,rw,b,n,rv) \ | 298 | #define VOP_BMAP(vp,of,sz,rw,b,n,rv) \ |
292 | rv = _VOP_(vop_bmap, vp)((vp)->v_fbhv,of,sz,rw,b,n) | 299 | rv = _VOP_(vop_bmap, vp)((vp)->v_fbhv,of,sz,rw,b,n) |
293 | #define VOP_OPEN(vp, cr, rv) \ | ||
294 | rv = _VOP_(vop_open, vp)((vp)->v_fbhv, cr) | ||
295 | #define VOP_GETATTR(vp, vap, f, cr, rv) \ | 300 | #define VOP_GETATTR(vp, vap, f, cr, rv) \ |
296 | rv = _VOP_(vop_getattr, vp)((vp)->v_fbhv, vap, f, cr) | 301 | rv = _VOP_(vop_getattr, vp)((vp)->v_fbhv, vap, f, cr) |
297 | #define VOP_SETATTR(vp, vap, f, cr, rv) \ | 302 | #define VOP_SETATTR(vp, vap, f, cr, rv) \ |
@@ -556,8 +561,6 @@ static inline struct vnode *vn_grab(struct vnode *vp) | |||
556 | */ | 561 | */ |
557 | #define VN_LOCK(vp) mutex_spinlock(&(vp)->v_lock) | 562 | #define VN_LOCK(vp) mutex_spinlock(&(vp)->v_lock) |
558 | #define VN_UNLOCK(vp, s) mutex_spinunlock(&(vp)->v_lock, s) | 563 | #define VN_UNLOCK(vp, s) mutex_spinunlock(&(vp)->v_lock, s) |
559 | #define VN_FLAGSET(vp,b) vn_flagset(vp,b) | ||
560 | #define VN_FLAGCLR(vp,b) vn_flagclr(vp,b) | ||
561 | 564 | ||
562 | static __inline__ void vn_flagset(struct vnode *vp, uint flag) | 565 | static __inline__ void vn_flagset(struct vnode *vp, uint flag) |
563 | { | 566 | { |
@@ -566,13 +569,22 @@ static __inline__ void vn_flagset(struct vnode *vp, uint flag) | |||
566 | spin_unlock(&vp->v_lock); | 569 | spin_unlock(&vp->v_lock); |
567 | } | 570 | } |
568 | 571 | ||
569 | static __inline__ void vn_flagclr(struct vnode *vp, uint flag) | 572 | static __inline__ uint vn_flagclr(struct vnode *vp, uint flag) |
570 | { | 573 | { |
574 | uint cleared; | ||
575 | |||
571 | spin_lock(&vp->v_lock); | 576 | spin_lock(&vp->v_lock); |
577 | cleared = (vp->v_flag & flag); | ||
572 | vp->v_flag &= ~flag; | 578 | vp->v_flag &= ~flag; |
573 | spin_unlock(&vp->v_lock); | 579 | spin_unlock(&vp->v_lock); |
580 | return cleared; | ||
574 | } | 581 | } |
575 | 582 | ||
583 | #define VMODIFY(vp) vn_flagset(vp, VMODIFIED) | ||
584 | #define VUNMODIFY(vp) vn_flagclr(vp, VMODIFIED) | ||
585 | #define VTRUNCATE(vp) vn_flagset(vp, VTRUNCATED) | ||
586 | #define VUNTRUNCATE(vp) vn_flagclr(vp, VTRUNCATED) | ||
587 | |||
576 | /* | 588 | /* |
577 | * Dealing with bad inodes | 589 | * Dealing with bad inodes |
578 | */ | 590 | */ |
@@ -612,8 +624,7 @@ static inline void vn_atime_to_time_t(struct vnode *vp, time_t *tt) | |||
612 | #define VN_CACHED(vp) (vn_to_inode(vp)->i_mapping->nrpages) | 624 | #define VN_CACHED(vp) (vn_to_inode(vp)->i_mapping->nrpages) |
613 | #define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \ | 625 | #define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \ |
614 | PAGECACHE_TAG_DIRTY) | 626 | PAGECACHE_TAG_DIRTY) |
615 | #define VMODIFY(vp) VN_FLAGSET(vp, VMODIFIED) | 627 | #define VN_TRUNC(vp) ((vp)->v_flag & VTRUNCATED) |
616 | #define VUNMODIFY(vp) VN_FLAGCLR(vp, VMODIFIED) | ||
617 | 628 | ||
618 | /* | 629 | /* |
619 | * Flags to VOP_SETATTR/VOP_GETATTR. | 630 | * Flags to VOP_SETATTR/VOP_GETATTR. |