Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. |
| 3 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. |
| 8 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | */ |
| 18 | #ifndef __XFS_VNODE_H__ |
| 19 | #define __XFS_VNODE_H__ |
| 20 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 21 | struct file; |
Nathan Scott | 8285fb5 | 2006-06-09 17:07:12 +1000 | [diff] [blame] | 22 | struct bhv_vfs; |
| 23 | struct bhv_vattr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | struct xfs_iomap; |
| 25 | struct attrlist_cursor_kern; |
| 26 | |
Nathan Scott | 8285fb5 | 2006-06-09 17:07:12 +1000 | [diff] [blame] | 27 | typedef struct dentry bhv_vname_t; |
| 28 | typedef __u64 bhv_vnumber_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 30 | typedef struct bhv_vnode { |
Nathan Scott | 8285fb5 | 2006-06-09 17:07:12 +1000 | [diff] [blame] | 31 | bhv_vnumber_t v_number; /* in-core vnode number */ |
Eric Sandeen | 9effd8e | 2005-05-05 13:26:18 -0700 | [diff] [blame] | 32 | struct inode v_inode; /* Linux inode */ |
| 33 | /* inode MUST be last */ |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 34 | } bhv_vnode_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
Christoph Hellwig | 0432dab | 2005-09-02 16:46:51 +1000 | [diff] [blame] | 36 | #define VN_ISLNK(vp) S_ISLNK((vp)->v_inode.i_mode) |
| 37 | #define VN_ISREG(vp) S_ISREG((vp)->v_inode.i_mode) |
| 38 | #define VN_ISDIR(vp) S_ISDIR((vp)->v_inode.i_mode) |
| 39 | #define VN_ISCHR(vp) S_ISCHR((vp)->v_inode.i_mode) |
| 40 | #define VN_ISBLK(vp) S_ISBLK((vp)->v_inode.i_mode) |
| 41 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | /* |
| 43 | * Vnode to Linux inode mapping. |
| 44 | */ |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 45 | static inline struct bhv_vnode *vn_from_inode(struct inode *inode) |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 46 | { |
Alexey Dobriyan | 71306f3 | 2006-06-27 14:10:29 +1000 | [diff] [blame] | 47 | return container_of(inode, bhv_vnode_t, v_inode); |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 48 | } |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 49 | static inline struct inode *vn_to_inode(struct bhv_vnode *vnode) |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 50 | { |
| 51 | return &vnode->v_inode; |
| 52 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
| 54 | /* |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 55 | * Values for the vop_rwlock/rwunlock flags parameter. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | */ |
Nathan Scott | 8285fb5 | 2006-06-09 17:07:12 +1000 | [diff] [blame] | 57 | typedef enum bhv_vrwlock { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | VRWLOCK_NONE, |
| 59 | VRWLOCK_READ, |
| 60 | VRWLOCK_WRITE, |
| 61 | VRWLOCK_WRITE_DIRECT, |
| 62 | VRWLOCK_TRY_READ, |
| 63 | VRWLOCK_TRY_WRITE |
Nathan Scott | 8285fb5 | 2006-06-09 17:07:12 +1000 | [diff] [blame] | 64 | } bhv_vrwlock_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | |
| 66 | /* |
Christoph Hellwig | 739bfb2 | 2007-08-29 10:58:01 +1000 | [diff] [blame] | 67 | * Return values for xfs_inactive. A return value of |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | * VN_INACTIVE_NOCACHE implies that the file system behavior |
| 69 | * has disassociated its state and bhv_desc_t from the vnode. |
| 70 | */ |
| 71 | #define VN_INACTIVE_CACHE 0 |
| 72 | #define VN_INACTIVE_NOCACHE 1 |
| 73 | |
| 74 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | * Flags for read/write calls - same values as IRIX |
| 76 | */ |
| 77 | #define IO_ISAIO 0x00001 /* don't wait for completion */ |
| 78 | #define IO_ISDIRECT 0x00004 /* bypass page cache */ |
| 79 | #define IO_INVIS 0x00020 /* don't update inode timestamps */ |
| 80 | |
| 81 | /* |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 82 | * Flags for vop_iflush call |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | */ |
| 84 | #define FLUSH_SYNC 1 /* wait for flush to complete */ |
| 85 | #define FLUSH_INODE 2 /* flush the inode itself */ |
| 86 | #define FLUSH_LOG 4 /* force the last log entry for |
| 87 | * this inode out to disk */ |
| 88 | |
| 89 | /* |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 90 | * Flush/Invalidate options for vop_toss/flush/flushinval_pages. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | */ |
| 92 | #define FI_NONE 0 /* none */ |
| 93 | #define FI_REMAPF 1 /* Do a remapf prior to the operation */ |
| 94 | #define FI_REMAPF_LOCKED 2 /* Do a remapf prior to the operation. |
| 95 | Prevent VM access to the pages until |
| 96 | the operation completes. */ |
| 97 | |
| 98 | /* |
| 99 | * Vnode attributes. va_mask indicates those attributes the caller |
| 100 | * wants to set or extract. |
| 101 | */ |
Nathan Scott | 8285fb5 | 2006-06-09 17:07:12 +1000 | [diff] [blame] | 102 | typedef struct bhv_vattr { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | int va_mask; /* bit-mask of attributes present */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | mode_t va_mode; /* file access mode and type */ |
Nathan Scott | 31b084a | 2005-05-05 13:25:00 -0700 | [diff] [blame] | 105 | xfs_nlink_t va_nlink; /* number of references to file */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | uid_t va_uid; /* owner user id */ |
| 107 | gid_t va_gid; /* owner group id */ |
| 108 | xfs_ino_t va_nodeid; /* file id */ |
| 109 | xfs_off_t va_size; /* file size in bytes */ |
| 110 | u_long va_blocksize; /* blocksize preferred for i/o */ |
| 111 | struct timespec va_atime; /* time of last access */ |
| 112 | struct timespec va_mtime; /* time of last modification */ |
| 113 | struct timespec va_ctime; /* time file changed */ |
| 114 | u_int va_gen; /* generation number of file */ |
| 115 | xfs_dev_t va_rdev; /* device the special file represents */ |
| 116 | __int64_t va_nblocks; /* number of blocks allocated */ |
| 117 | u_long va_xflags; /* random extended file flags */ |
| 118 | u_long va_extsize; /* file extent size */ |
| 119 | u_long va_nextents; /* number of extents in file */ |
| 120 | u_long va_anextents; /* number of attr extents in file */ |
Nathan Scott | b74e215 | 2005-06-21 13:21:49 +1000 | [diff] [blame] | 121 | prid_t va_projid; /* project id */ |
Nathan Scott | 8285fb5 | 2006-06-09 17:07:12 +1000 | [diff] [blame] | 122 | } bhv_vattr_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | |
| 124 | /* |
| 125 | * setattr or getattr attributes |
| 126 | */ |
| 127 | #define XFS_AT_TYPE 0x00000001 |
| 128 | #define XFS_AT_MODE 0x00000002 |
| 129 | #define XFS_AT_UID 0x00000004 |
| 130 | #define XFS_AT_GID 0x00000008 |
| 131 | #define XFS_AT_FSID 0x00000010 |
| 132 | #define XFS_AT_NODEID 0x00000020 |
| 133 | #define XFS_AT_NLINK 0x00000040 |
| 134 | #define XFS_AT_SIZE 0x00000080 |
| 135 | #define XFS_AT_ATIME 0x00000100 |
| 136 | #define XFS_AT_MTIME 0x00000200 |
| 137 | #define XFS_AT_CTIME 0x00000400 |
| 138 | #define XFS_AT_RDEV 0x00000800 |
| 139 | #define XFS_AT_BLKSIZE 0x00001000 |
| 140 | #define XFS_AT_NBLOCKS 0x00002000 |
| 141 | #define XFS_AT_VCODE 0x00004000 |
| 142 | #define XFS_AT_MAC 0x00008000 |
| 143 | #define XFS_AT_UPDATIME 0x00010000 |
| 144 | #define XFS_AT_UPDMTIME 0x00020000 |
| 145 | #define XFS_AT_UPDCTIME 0x00040000 |
| 146 | #define XFS_AT_ACL 0x00080000 |
| 147 | #define XFS_AT_CAP 0x00100000 |
| 148 | #define XFS_AT_INF 0x00200000 |
| 149 | #define XFS_AT_XFLAGS 0x00400000 |
| 150 | #define XFS_AT_EXTSIZE 0x00800000 |
| 151 | #define XFS_AT_NEXTENTS 0x01000000 |
| 152 | #define XFS_AT_ANEXTENTS 0x02000000 |
| 153 | #define XFS_AT_PROJID 0x04000000 |
| 154 | #define XFS_AT_SIZE_NOPERM 0x08000000 |
| 155 | #define XFS_AT_GENCOUNT 0x10000000 |
| 156 | |
| 157 | #define XFS_AT_ALL (XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\ |
| 158 | XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\ |
| 159 | XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\ |
| 160 | XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|XFS_AT_MAC|\ |
| 161 | XFS_AT_ACL|XFS_AT_CAP|XFS_AT_INF|XFS_AT_XFLAGS|XFS_AT_EXTSIZE|\ |
| 162 | XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_PROJID|XFS_AT_GENCOUNT) |
| 163 | |
| 164 | #define XFS_AT_STAT (XFS_AT_TYPE|XFS_AT_MODE|XFS_AT_UID|XFS_AT_GID|\ |
| 165 | XFS_AT_FSID|XFS_AT_NODEID|XFS_AT_NLINK|XFS_AT_SIZE|\ |
| 166 | XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME|XFS_AT_RDEV|\ |
| 167 | XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_PROJID) |
| 168 | |
| 169 | #define XFS_AT_TIMES (XFS_AT_ATIME|XFS_AT_MTIME|XFS_AT_CTIME) |
| 170 | |
| 171 | #define XFS_AT_UPDTIMES (XFS_AT_UPDATIME|XFS_AT_UPDMTIME|XFS_AT_UPDCTIME) |
| 172 | |
| 173 | #define XFS_AT_NOSET (XFS_AT_NLINK|XFS_AT_RDEV|XFS_AT_FSID|XFS_AT_NODEID|\ |
| 174 | XFS_AT_TYPE|XFS_AT_BLKSIZE|XFS_AT_NBLOCKS|XFS_AT_VCODE|\ |
| 175 | XFS_AT_NEXTENTS|XFS_AT_ANEXTENTS|XFS_AT_GENCOUNT) |
| 176 | |
| 177 | /* |
| 178 | * Modes. |
| 179 | */ |
| 180 | #define VSUID S_ISUID /* set user id on execution */ |
| 181 | #define VSGID S_ISGID /* set group id on execution */ |
| 182 | #define VSVTX S_ISVTX /* save swapped text even after use */ |
| 183 | #define VREAD S_IRUSR /* read, write, execute permissions */ |
| 184 | #define VWRITE S_IWUSR |
| 185 | #define VEXEC S_IXUSR |
| 186 | |
| 187 | #define MODEMASK S_IALLUGO /* mode bits plus permission bits */ |
| 188 | |
| 189 | /* |
| 190 | * Check whether mandatory file locking is enabled. |
| 191 | */ |
| 192 | #define MANDLOCK(vp, mode) \ |
Christoph Hellwig | 0432dab | 2005-09-02 16:46:51 +1000 | [diff] [blame] | 193 | (VN_ISREG(vp) && ((mode) & (VSGID|(VEXEC>>3))) == VSGID) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 194 | |
| 195 | extern void vn_init(void); |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 196 | extern bhv_vnode_t *vn_initialize(struct inode *); |
| 197 | extern int vn_revalidate(struct bhv_vnode *); |
Nathan Scott | 8285fb5 | 2006-06-09 17:07:12 +1000 | [diff] [blame] | 198 | extern int __vn_revalidate(struct bhv_vnode *, bhv_vattr_t *); |
| 199 | extern void vn_revalidate_core(struct bhv_vnode *, bhv_vattr_t *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | |
Christoph Hellwig | b677c21 | 2007-08-29 11:46:28 +1000 | [diff] [blame] | 201 | /* |
| 202 | * Yeah, these don't take vnode anymore at all, all this should be |
| 203 | * cleaned up at some point. |
| 204 | */ |
| 205 | extern void vn_iowait(struct xfs_inode *ip); |
| 206 | extern void vn_iowake(struct xfs_inode *ip); |
| 207 | extern void vn_ioerror(struct xfs_inode *ip, int error, char *f, int l); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 209 | static inline int vn_count(struct bhv_vnode *vp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | { |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 211 | return atomic_read(&vn_to_inode(vp)->i_count); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | /* |
| 215 | * Vnode reference counting functions (and macros for compatibility). |
| 216 | */ |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 217 | extern bhv_vnode_t *vn_hold(struct bhv_vnode *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | |
| 219 | #if defined(XFS_VNODE_TRACE) |
| 220 | #define VN_HOLD(vp) \ |
| 221 | ((void)vn_hold(vp), \ |
Christoph Hellwig | 1543d79 | 2007-08-29 11:46:47 +1000 | [diff] [blame^] | 222 | vn_trace_hold(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | #define VN_RELE(vp) \ |
Christoph Hellwig | 1543d79 | 2007-08-29 11:46:47 +1000 | [diff] [blame^] | 224 | (vn_trace_rele(xfs_vtoi(vp), __FILE__, __LINE__, (inst_t *)__return_address), \ |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 225 | iput(vn_to_inode(vp))) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | #else |
| 227 | #define VN_HOLD(vp) ((void)vn_hold(vp)) |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 228 | #define VN_RELE(vp) (iput(vn_to_inode(vp))) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | #endif |
| 230 | |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 231 | static inline struct bhv_vnode *vn_grab(struct bhv_vnode *vp) |
Christoph Hellwig | cdb6268 | 2005-09-02 16:24:19 +1000 | [diff] [blame] | 232 | { |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 233 | struct inode *inode = igrab(vn_to_inode(vp)); |
| 234 | return inode ? vn_from_inode(inode) : NULL; |
Christoph Hellwig | cdb6268 | 2005-09-02 16:24:19 +1000 | [diff] [blame] | 235 | } |
| 236 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | /* |
| 238 | * Vname handling macros. |
| 239 | */ |
| 240 | #define VNAME(dentry) ((char *) (dentry)->d_name.name) |
| 241 | #define VNAMELEN(dentry) ((dentry)->d_name.len) |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 242 | #define VNAME_TO_VNODE(dentry) (vn_from_inode((dentry)->d_inode)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | |
| 244 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 245 | * Dealing with bad inodes |
| 246 | */ |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 247 | static inline void vn_mark_bad(struct bhv_vnode *vp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | { |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 249 | make_bad_inode(vn_to_inode(vp)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | } |
| 251 | |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 252 | static inline int VN_BAD(struct bhv_vnode *vp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | { |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 254 | return is_bad_inode(vn_to_inode(vp)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | } |
| 256 | |
| 257 | /* |
Nathan Scott | ca5ccbf | 2006-01-11 21:03:04 +1100 | [diff] [blame] | 258 | * Extracting atime values in various formats |
| 259 | */ |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 260 | static inline void vn_atime_to_bstime(bhv_vnode_t *vp, xfs_bstime_t *bs_atime) |
Nathan Scott | ca5ccbf | 2006-01-11 21:03:04 +1100 | [diff] [blame] | 261 | { |
| 262 | bs_atime->tv_sec = vp->v_inode.i_atime.tv_sec; |
| 263 | bs_atime->tv_nsec = vp->v_inode.i_atime.tv_nsec; |
| 264 | } |
| 265 | |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 266 | static inline void vn_atime_to_timespec(bhv_vnode_t *vp, struct timespec *ts) |
Nathan Scott | ca5ccbf | 2006-01-11 21:03:04 +1100 | [diff] [blame] | 267 | { |
| 268 | *ts = vp->v_inode.i_atime; |
| 269 | } |
| 270 | |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 271 | static inline void vn_atime_to_time_t(bhv_vnode_t *vp, time_t *tt) |
Nathan Scott | ca5ccbf | 2006-01-11 21:03:04 +1100 | [diff] [blame] | 272 | { |
| 273 | *tt = vp->v_inode.i_atime.tv_sec; |
| 274 | } |
| 275 | |
| 276 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | * Some useful predicates. |
| 278 | */ |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 279 | #define VN_MAPPED(vp) mapping_mapped(vn_to_inode(vp)->i_mapping) |
| 280 | #define VN_CACHED(vp) (vn_to_inode(vp)->i_mapping->nrpages) |
| 281 | #define VN_DIRTY(vp) mapping_tagged(vn_to_inode(vp)->i_mapping, \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | PAGECACHE_TAG_DIRTY) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | |
| 284 | /* |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 285 | * Flags to vop_setattr/getattr. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | */ |
| 287 | #define ATTR_UTIME 0x01 /* non-default utime(2) request */ |
| 288 | #define ATTR_DMI 0x08 /* invocation from a DMI function */ |
| 289 | #define ATTR_LAZY 0x80 /* set/get attributes lazily */ |
| 290 | #define ATTR_NONBLOCK 0x100 /* return EAGAIN if operation would block */ |
Dean Roehrich | 5fcbab3 | 2005-05-05 13:27:19 -0700 | [diff] [blame] | 291 | #define ATTR_NOLOCK 0x200 /* Don't grab any conflicting locks */ |
Eric Sandeen | 1f730e3 | 2005-11-02 15:08:10 +1100 | [diff] [blame] | 292 | #define ATTR_NOSIZETOK 0x400 /* Don't get the SIZE token */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | |
| 294 | /* |
Nathan Scott | 67fcaa7 | 2006-06-09 17:00:52 +1000 | [diff] [blame] | 295 | * Flags to vop_fsync/reclaim. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 296 | */ |
| 297 | #define FSYNC_NOWAIT 0 /* asynchronous flush */ |
| 298 | #define FSYNC_WAIT 0x1 /* synchronous fsync or forced reclaim */ |
| 299 | #define FSYNC_INVAL 0x2 /* flush and invalidate cached data */ |
| 300 | #define FSYNC_DATA 0x4 /* synchronous fsync of data only */ |
| 301 | |
| 302 | /* |
| 303 | * Tracking vnode activity. |
| 304 | */ |
| 305 | #if defined(XFS_VNODE_TRACE) |
| 306 | |
| 307 | #define VNODE_TRACE_SIZE 16 /* number of trace entries */ |
| 308 | #define VNODE_KTRACE_ENTRY 1 |
| 309 | #define VNODE_KTRACE_EXIT 2 |
| 310 | #define VNODE_KTRACE_HOLD 3 |
| 311 | #define VNODE_KTRACE_REF 4 |
| 312 | #define VNODE_KTRACE_RELE 5 |
| 313 | |
Christoph Hellwig | 1543d79 | 2007-08-29 11:46:47 +1000 | [diff] [blame^] | 314 | extern void vn_trace_entry(struct xfs_inode *, const char *, inst_t *); |
| 315 | extern void vn_trace_exit(struct xfs_inode *, const char *, inst_t *); |
| 316 | extern void vn_trace_hold(struct xfs_inode *, char *, int, inst_t *); |
| 317 | extern void vn_trace_ref(struct xfs_inode *, char *, int, inst_t *); |
| 318 | extern void vn_trace_rele(struct xfs_inode *, char *, int, inst_t *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | #else |
| 320 | #define vn_trace_entry(a,b,c) |
| 321 | #define vn_trace_exit(a,b,c) |
| 322 | #define vn_trace_hold(a,b,c,d) |
| 323 | #define vn_trace_ref(a,b,c,d) |
| 324 | #define vn_trace_rele(a,b,c,d) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | #endif |
| 326 | |
| 327 | #endif /* __XFS_VNODE_H__ */ |