diff options
Diffstat (limited to 'fs/xfs/xfs_inode.h')
| -rw-r--r-- | fs/xfs/xfs_inode.h | 132 |
1 files changed, 23 insertions, 109 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 54d9e54c7c95..124d30e6143b 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h | |||
| @@ -1,38 +1,30 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | 2 | * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc. |
| 3 | * All Rights Reserved. | ||
| 3 | * | 4 | * |
| 4 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or |
| 5 | * under the terms of version 2 of the GNU General Public License as | 6 | * modify it under the terms of the GNU General Public License as |
| 6 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
| 7 | * | 8 | * |
| 8 | * This program is distributed in the hope that it would be useful, but | 9 | * This program is distributed in the hope that it would be useful, |
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. | ||
| 11 | * | 13 | * |
| 12 | * Further, this software is distributed without any warranty that it is | 14 | * You should have received a copy of the GNU General Public License |
| 13 | * free of the rightful claim of any third person regarding infringement | 15 | * along with this program; if not, write the Free Software Foundation, |
| 14 | * or the like. Any license provided herein, whether implied or | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 15 | * otherwise, applies only to this software file. Patent licenses, if | ||
| 16 | * any, provided herein do not apply to combinations of this program with | ||
| 17 | * other software, or any other product whatsoever. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU General Public License along | ||
| 20 | * with this program; if not, write the Free Software Foundation, Inc., 59 | ||
| 21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | ||
| 22 | * | ||
| 23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, | ||
| 24 | * Mountain View, CA 94043, or: | ||
| 25 | * | ||
| 26 | * http://www.sgi.com | ||
| 27 | * | ||
| 28 | * For further information regarding this notice, see: | ||
| 29 | * | ||
| 30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ | ||
| 31 | */ | 17 | */ |
| 32 | #ifndef __XFS_INODE_H__ | 18 | #ifndef __XFS_INODE_H__ |
| 33 | #define __XFS_INODE_H__ | 19 | #define __XFS_INODE_H__ |
| 34 | 20 | ||
| 35 | /* | 21 | /* |
| 22 | * Fork identifiers. | ||
| 23 | */ | ||
| 24 | #define XFS_DATA_FORK 0 | ||
| 25 | #define XFS_ATTR_FORK 1 | ||
| 26 | |||
| 27 | /* | ||
| 36 | * File incore extent information, present for each of data & attr forks. | 28 | * File incore extent information, present for each of data & attr forks. |
| 37 | */ | 29 | */ |
| 38 | #define XFS_INLINE_EXTS 2 | 30 | #define XFS_INLINE_EXTS 2 |
| @@ -107,24 +99,6 @@ extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *); | |||
| 107 | #define xfs_ilock_trace(i,n,f,ra) | 99 | #define xfs_ilock_trace(i,n,f,ra) |
| 108 | #endif | 100 | #endif |
| 109 | 101 | ||
| 110 | /* | ||
| 111 | * This structure is used to communicate which extents of a file | ||
| 112 | * were holes when a write started from xfs_write_file() to | ||
| 113 | * xfs_strat_read(). This is necessary so that we can know which | ||
| 114 | * blocks need to be zeroed when they are read in in xfs_strat_read() | ||
| 115 | * if they weren\'t allocated when the buffer given to xfs_strat_read() | ||
| 116 | * was mapped. | ||
| 117 | * | ||
| 118 | * We keep a list of these attached to the inode. The list is | ||
| 119 | * protected by the inode lock and the fact that the io lock is | ||
| 120 | * held exclusively by writers. | ||
| 121 | */ | ||
| 122 | typedef struct xfs_gap { | ||
| 123 | struct xfs_gap *xg_next; | ||
| 124 | xfs_fileoff_t xg_offset_fsb; | ||
| 125 | xfs_extlen_t xg_count_fsb; | ||
| 126 | } xfs_gap_t; | ||
| 127 | |||
| 128 | typedef struct dm_attrs_s { | 102 | typedef struct dm_attrs_s { |
| 129 | __uint32_t da_dmevmask; /* DMIG event mask */ | 103 | __uint32_t da_dmevmask; /* DMIG event mask */ |
| 130 | __uint16_t da_dmstate; /* DMIG state info */ | 104 | __uint16_t da_dmstate; /* DMIG state info */ |
| @@ -311,60 +285,16 @@ typedef struct xfs_inode { | |||
| 311 | /* | 285 | /* |
| 312 | * Fork handling. | 286 | * Fork handling. |
| 313 | */ | 287 | */ |
| 314 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_PTR) | 288 | #define XFS_IFORK_PTR(ip,w) \ |
| 315 | xfs_ifork_t *xfs_ifork_ptr(xfs_inode_t *ip, int w); | 289 | ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp) |
| 316 | #define XFS_IFORK_PTR(ip,w) xfs_ifork_ptr(ip,w) | ||
| 317 | #else | ||
| 318 | #define XFS_IFORK_PTR(ip,w) ((w) == XFS_DATA_FORK ? &(ip)->i_df : (ip)->i_afp) | ||
| 319 | #endif | ||
| 320 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_Q) | ||
| 321 | int xfs_ifork_q(xfs_inode_t *ip); | ||
| 322 | #define XFS_IFORK_Q(ip) xfs_ifork_q(ip) | ||
| 323 | #else | ||
| 324 | #define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d) | 290 | #define XFS_IFORK_Q(ip) XFS_CFORK_Q(&(ip)->i_d) |
| 325 | #endif | ||
| 326 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_DSIZE) | ||
| 327 | int xfs_ifork_dsize(xfs_inode_t *ip); | ||
| 328 | #define XFS_IFORK_DSIZE(ip) xfs_ifork_dsize(ip) | ||
| 329 | #else | ||
| 330 | #define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount) | 291 | #define XFS_IFORK_DSIZE(ip) XFS_CFORK_DSIZE(&ip->i_d, ip->i_mount) |
| 331 | #endif | ||
| 332 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_ASIZE) | ||
| 333 | int xfs_ifork_asize(xfs_inode_t *ip); | ||
| 334 | #define XFS_IFORK_ASIZE(ip) xfs_ifork_asize(ip) | ||
| 335 | #else | ||
| 336 | #define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount) | 292 | #define XFS_IFORK_ASIZE(ip) XFS_CFORK_ASIZE(&ip->i_d, ip->i_mount) |
| 337 | #endif | ||
| 338 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_SIZE) | ||
| 339 | int xfs_ifork_size(xfs_inode_t *ip, int w); | ||
| 340 | #define XFS_IFORK_SIZE(ip,w) xfs_ifork_size(ip,w) | ||
| 341 | #else | ||
| 342 | #define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w) | 293 | #define XFS_IFORK_SIZE(ip,w) XFS_CFORK_SIZE(&ip->i_d, ip->i_mount, w) |
| 343 | #endif | ||
| 344 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FORMAT) | ||
| 345 | int xfs_ifork_format(xfs_inode_t *ip, int w); | ||
| 346 | #define XFS_IFORK_FORMAT(ip,w) xfs_ifork_format(ip,w) | ||
| 347 | #else | ||
| 348 | #define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w) | 294 | #define XFS_IFORK_FORMAT(ip,w) XFS_CFORK_FORMAT(&ip->i_d, w) |
| 349 | #endif | ||
| 350 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_FMT_SET) | ||
| 351 | void xfs_ifork_fmt_set(xfs_inode_t *ip, int w, int n); | ||
| 352 | #define XFS_IFORK_FMT_SET(ip,w,n) xfs_ifork_fmt_set(ip,w,n) | ||
| 353 | #else | ||
| 354 | #define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n) | 295 | #define XFS_IFORK_FMT_SET(ip,w,n) XFS_CFORK_FMT_SET(&ip->i_d, w, n) |
| 355 | #endif | ||
| 356 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXTENTS) | ||
| 357 | int xfs_ifork_nextents(xfs_inode_t *ip, int w); | ||
| 358 | #define XFS_IFORK_NEXTENTS(ip,w) xfs_ifork_nextents(ip,w) | ||
| 359 | #else | ||
| 360 | #define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w) | 296 | #define XFS_IFORK_NEXTENTS(ip,w) XFS_CFORK_NEXTENTS(&ip->i_d, w) |
| 361 | #endif | ||
| 362 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_IFORK_NEXT_SET) | ||
| 363 | void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); | ||
| 364 | #define XFS_IFORK_NEXT_SET(ip,w,n) xfs_ifork_next_set(ip,w,n) | ||
| 365 | #else | ||
| 366 | #define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n) | 297 | #define XFS_IFORK_NEXT_SET(ip,w,n) XFS_CFORK_NEXT_SET(&ip->i_d, w, n) |
| 367 | #endif | ||
| 368 | 298 | ||
| 369 | 299 | ||
| 370 | #ifdef __KERNEL__ | 300 | #ifdef __KERNEL__ |
| @@ -388,6 +318,7 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); | |||
| 388 | #define XFS_ILOCK_EXCL 0x004 | 318 | #define XFS_ILOCK_EXCL 0x004 |
| 389 | #define XFS_ILOCK_SHARED 0x008 | 319 | #define XFS_ILOCK_SHARED 0x008 |
| 390 | #define XFS_IUNLOCK_NONOTIFY 0x010 | 320 | #define XFS_IUNLOCK_NONOTIFY 0x010 |
| 321 | /* XFS_IOLOCK_NESTED 0x020 */ | ||
| 391 | #define XFS_EXTENT_TOKEN_RD 0x040 | 322 | #define XFS_EXTENT_TOKEN_RD 0x040 |
| 392 | #define XFS_SIZE_TOKEN_RD 0x080 | 323 | #define XFS_SIZE_TOKEN_RD 0x080 |
| 393 | #define XFS_EXTSIZE_RD (XFS_EXTENT_TOKEN_RD|XFS_SIZE_TOKEN_RD) | 324 | #define XFS_EXTSIZE_RD (XFS_EXTENT_TOKEN_RD|XFS_SIZE_TOKEN_RD) |
| @@ -395,7 +326,7 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); | |||
| 395 | #define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND) | 326 | #define XFS_EXTENT_TOKEN_WR (XFS_EXTENT_TOKEN_RD | XFS_WILLLEND) |
| 396 | #define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND) | 327 | #define XFS_SIZE_TOKEN_WR (XFS_SIZE_TOKEN_RD | XFS_WILLLEND) |
| 397 | #define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND) | 328 | #define XFS_EXTSIZE_WR (XFS_EXTSIZE_RD | XFS_WILLLEND) |
| 398 | 329 | /* XFS_SIZE_TOKEN_WANT 0x200 */ | |
| 399 | 330 | ||
| 400 | #define XFS_LOCK_MASK \ | 331 | #define XFS_LOCK_MASK \ |
| 401 | (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED | XFS_ILOCK_EXCL | \ | 332 | (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED | XFS_ILOCK_EXCL | \ |
| @@ -417,28 +348,11 @@ void xfs_ifork_next_set(xfs_inode_t *ip, int w, int n); | |||
| 417 | #define XFS_ITRUNC_DEFINITE 0x1 | 348 | #define XFS_ITRUNC_DEFINITE 0x1 |
| 418 | #define XFS_ITRUNC_MAYBE 0x2 | 349 | #define XFS_ITRUNC_MAYBE 0x2 |
| 419 | 350 | ||
| 420 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOV) | ||
| 421 | struct vnode *xfs_itov(xfs_inode_t *ip); | ||
| 422 | #define XFS_ITOV(ip) xfs_itov(ip) | ||
| 423 | #else | ||
| 424 | #define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip)) | 351 | #define XFS_ITOV(ip) BHV_TO_VNODE(XFS_ITOBHV(ip)) |
| 425 | #endif | ||
| 426 | #define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip)) | 352 | #define XFS_ITOV_NULL(ip) BHV_TO_VNODE_NULL(XFS_ITOBHV(ip)) |
| 427 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_ITOBHV) | ||
| 428 | struct bhv_desc *xfs_itobhv(xfs_inode_t *ip); | ||
| 429 | #define XFS_ITOBHV(ip) xfs_itobhv(ip) | ||
| 430 | #else | ||
| 431 | #define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc))) | 353 | #define XFS_ITOBHV(ip) ((struct bhv_desc *)(&((ip)->i_bhv_desc))) |
| 432 | #endif | 354 | #define XFS_BHVTOI(bhvp) ((xfs_inode_t *)((char *)(bhvp) - \ |
| 433 | #if XFS_WANT_FUNCS || (XFS_WANT_SPACE && XFSSO_XFS_BHVTOI) | 355 | (char *)&(((xfs_inode_t *)0)->i_bhv_desc))) |
| 434 | xfs_inode_t *xfs_bhvtoi(struct bhv_desc *bhvp); | ||
| 435 | #define XFS_BHVTOI(bhvp) xfs_bhvtoi(bhvp) | ||
| 436 | #else | ||
| 437 | #define XFS_BHVTOI(bhvp) \ | ||
| 438 | ((xfs_inode_t *)((char *)(bhvp) - \ | ||
| 439 | (char *)&(((xfs_inode_t *)0)->i_bhv_desc))) | ||
| 440 | #endif | ||
| 441 | |||
| 442 | #define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops) | 356 | #define BHV_IS_XFS(bdp) (BHV_OPS(bdp) == &xfs_vnodeops) |
| 443 | 357 | ||
| 444 | /* | 358 | /* |
