aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_inode.h
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/xfs/xfs_inode.h
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'fs/xfs/xfs_inode.h')
-rw-r--r--fs/xfs/xfs_inode.h83
1 files changed, 60 insertions, 23 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 0898c5417d12..964cfea77686 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -67,7 +67,6 @@ typedef struct xfs_ifork {
67 short if_broot_bytes; /* bytes allocated for root */ 67 short if_broot_bytes; /* bytes allocated for root */
68 unsigned char if_flags; /* per-fork flags */ 68 unsigned char if_flags; /* per-fork flags */
69 unsigned char if_ext_max; /* max # of extent records */ 69 unsigned char if_ext_max; /* max # of extent records */
70 xfs_extnum_t if_lastex; /* last if_extents used */
71 union { 70 union {
72 xfs_bmbt_rec_host_t *if_extents;/* linear map file exts */ 71 xfs_bmbt_rec_host_t *if_extents;/* linear map file exts */
73 xfs_ext_irec_t *if_ext_irec; /* irec map file exts */ 72 xfs_ext_irec_t *if_ext_irec; /* irec map file exts */
@@ -111,7 +110,7 @@ struct xfs_imap {
111 * Generally, we do not want to hold the i_rlock while holding the 110 * Generally, we do not want to hold the i_rlock while holding the
112 * i_ilock. Hierarchy is i_iolock followed by i_rlock. 111 * i_ilock. Hierarchy is i_iolock followed by i_rlock.
113 * 112 *
114 * xfs_iptr_t contains all the inode fields upto and including the 113 * xfs_iptr_t contains all the inode fields up to and including the
115 * i_mnext and i_mprev fields, it is used as a marker in the inode 114 * i_mnext and i_mprev fields, it is used as a marker in the inode
116 * chain off the mount structure by xfs_sync calls. 115 * chain off the mount structure by xfs_sync calls.
117 */ 116 */
@@ -134,8 +133,9 @@ typedef struct xfs_icdinode {
134 __uint32_t di_uid; /* owner's user id */ 133 __uint32_t di_uid; /* owner's user id */
135 __uint32_t di_gid; /* owner's group id */ 134 __uint32_t di_gid; /* owner's group id */
136 __uint32_t di_nlink; /* number of links to file */ 135 __uint32_t di_nlink; /* number of links to file */
137 __uint16_t di_projid; /* owner's project id */ 136 __uint16_t di_projid_lo; /* lower part of owner's project id */
138 __uint8_t di_pad[8]; /* unused, zeroed space */ 137 __uint16_t di_projid_hi; /* higher part of owner's project id */
138 __uint8_t di_pad[6]; /* unused, zeroed space */
139 __uint16_t di_flushiter; /* incremented on flush */ 139 __uint16_t di_flushiter; /* incremented on flush */
140 xfs_ictimestamp_t di_atime; /* time last accessed */ 140 xfs_ictimestamp_t di_atime; /* time last accessed */
141 xfs_ictimestamp_t di_mtime; /* time last modified */ 141 xfs_ictimestamp_t di_mtime; /* time last modified */
@@ -212,7 +212,6 @@ typedef struct xfs_icdinode {
212#ifdef __KERNEL__ 212#ifdef __KERNEL__
213 213
214struct bhv_desc; 214struct bhv_desc;
215struct cred;
216struct xfs_buf; 215struct xfs_buf;
217struct xfs_bmap_free; 216struct xfs_bmap_free;
218struct xfs_bmbt_irec; 217struct xfs_bmbt_irec;
@@ -335,6 +334,25 @@ xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
335} 334}
336 335
337/* 336/*
337 * Project quota id helpers (previously projid was 16bit only
338 * and using two 16bit values to hold new 32bit projid was chosen
339 * to retain compatibility with "old" filesystems).
340 */
341static inline prid_t
342xfs_get_projid(struct xfs_inode *ip)
343{
344 return (prid_t)ip->i_d.di_projid_hi << 16 | ip->i_d.di_projid_lo;
345}
346
347static inline void
348xfs_set_projid(struct xfs_inode *ip,
349 prid_t projid)
350{
351 ip->i_d.di_projid_hi = (__uint16_t) (projid >> 16);
352 ip->i_d.di_projid_lo = (__uint16_t) (projid & 0xffff);
353}
354
355/*
338 * Manage the i_flush queue embedded in the inode. This completion 356 * Manage the i_flush queue embedded in the inode. This completion
339 * queue synchronizes processes attempting to flush the in-core 357 * queue synchronizes processes attempting to flush the in-core
340 * inode back to disk. 358 * inode back to disk.
@@ -357,12 +375,23 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
357/* 375/*
358 * In-core inode flags. 376 * In-core inode flags.
359 */ 377 */
360#define XFS_IRECLAIM 0x0001 /* we have started reclaiming this inode */ 378#define XFS_IRECLAIM 0x0001 /* started reclaiming this inode */
361#define XFS_ISTALE 0x0002 /* inode has been staled */ 379#define XFS_ISTALE 0x0002 /* inode has been staled */
362#define XFS_IRECLAIMABLE 0x0004 /* inode can be reclaimed */ 380#define XFS_IRECLAIMABLE 0x0004 /* inode can be reclaimed */
363#define XFS_INEW 0x0008 /* inode has just been allocated */ 381#define XFS_INEW 0x0008 /* inode has just been allocated */
364#define XFS_IFILESTREAM 0x0010 /* inode is in a filestream directory */ 382#define XFS_IFILESTREAM 0x0010 /* inode is in a filestream directory */
365#define XFS_ITRUNCATED 0x0020 /* truncated down so flush-on-close */ 383#define XFS_ITRUNCATED 0x0020 /* truncated down so flush-on-close */
384#define XFS_IDIRTY_RELEASE 0x0040 /* dirty release already seen */
385
386/*
387 * Per-lifetime flags need to be reset when re-using a reclaimable inode during
388 * inode lookup. Thi prevents unintended behaviour on the new inode from
389 * ocurring.
390 */
391#define XFS_IRECLAIM_RESET_FLAGS \
392 (XFS_IRECLAIMABLE | XFS_IRECLAIM | \
393 XFS_IDIRTY_RELEASE | XFS_ITRUNCATED | \
394 XFS_IFILESTREAM);
366 395
367/* 396/*
368 * Flags for inode locking. 397 * Flags for inode locking.
@@ -389,28 +418,35 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
389/* 418/*
390 * Flags for lockdep annotations. 419 * Flags for lockdep annotations.
391 * 420 *
392 * XFS_I[O]LOCK_PARENT - for operations that require locking two inodes 421 * XFS_LOCK_PARENT - for directory operations that require locking a
393 * (ie directory operations that require locking a directory inode and 422 * parent directory inode and a child entry inode. The parent gets locked
394 * an entry inode). The first inode gets locked with this flag so it 423 * with this flag so it gets a lockdep subclass of 1 and the child entry
395 * gets a lockdep subclass of 1 and the second lock will have a lockdep 424 * lock will have a lockdep subclass of 0.
396 * subclass of 0. 425 *
426 * XFS_LOCK_RTBITMAP/XFS_LOCK_RTSUM - the realtime device bitmap and summary
427 * inodes do not participate in the normal lock order, and thus have their
428 * own subclasses.
397 * 429 *
398 * XFS_LOCK_INUMORDER - for locking several inodes at the some time 430 * XFS_LOCK_INUMORDER - for locking several inodes at the some time
399 * with xfs_lock_inodes(). This flag is used as the starting subclass 431 * with xfs_lock_inodes(). This flag is used as the starting subclass
400 * and each subsequent lock acquired will increment the subclass by one. 432 * and each subsequent lock acquired will increment the subclass by one.
401 * So the first lock acquired will have a lockdep subclass of 2, the 433 * So the first lock acquired will have a lockdep subclass of 4, the
402 * second lock will have a lockdep subclass of 3, and so on. It is 434 * second lock will have a lockdep subclass of 5, and so on. It is
403 * the responsibility of the class builder to shift this to the correct 435 * the responsibility of the class builder to shift this to the correct
404 * portion of the lock_mode lockdep mask. 436 * portion of the lock_mode lockdep mask.
405 */ 437 */
406#define XFS_LOCK_PARENT 1 438#define XFS_LOCK_PARENT 1
407#define XFS_LOCK_INUMORDER 2 439#define XFS_LOCK_RTBITMAP 2
440#define XFS_LOCK_RTSUM 3
441#define XFS_LOCK_INUMORDER 4
408 442
409#define XFS_IOLOCK_SHIFT 16 443#define XFS_IOLOCK_SHIFT 16
410#define XFS_IOLOCK_PARENT (XFS_LOCK_PARENT << XFS_IOLOCK_SHIFT) 444#define XFS_IOLOCK_PARENT (XFS_LOCK_PARENT << XFS_IOLOCK_SHIFT)
411 445
412#define XFS_ILOCK_SHIFT 24 446#define XFS_ILOCK_SHIFT 24
413#define XFS_ILOCK_PARENT (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT) 447#define XFS_ILOCK_PARENT (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT)
448#define XFS_ILOCK_RTBITMAP (XFS_LOCK_RTBITMAP << XFS_ILOCK_SHIFT)
449#define XFS_ILOCK_RTSUM (XFS_LOCK_RTSUM << XFS_ILOCK_SHIFT)
414 450
415#define XFS_IOLOCK_DEP_MASK 0x00ff0000 451#define XFS_IOLOCK_DEP_MASK 0x00ff0000
416#define XFS_ILOCK_DEP_MASK 0xff000000 452#define XFS_ILOCK_DEP_MASK 0xff000000
@@ -419,6 +455,8 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
419#define XFS_IOLOCK_DEP(flags) (((flags) & XFS_IOLOCK_DEP_MASK) >> XFS_IOLOCK_SHIFT) 455#define XFS_IOLOCK_DEP(flags) (((flags) & XFS_IOLOCK_DEP_MASK) >> XFS_IOLOCK_SHIFT)
420#define XFS_ILOCK_DEP(flags) (((flags) & XFS_ILOCK_DEP_MASK) >> XFS_ILOCK_SHIFT) 456#define XFS_ILOCK_DEP(flags) (((flags) & XFS_ILOCK_DEP_MASK) >> XFS_ILOCK_SHIFT)
421 457
458extern struct lock_class_key xfs_iolock_reclaimable;
459
422/* 460/*
423 * Flags for xfs_itruncate_start(). 461 * Flags for xfs_itruncate_start().
424 */ 462 */
@@ -456,8 +494,8 @@ void xfs_inode_free(struct xfs_inode *ip);
456 * xfs_inode.c prototypes. 494 * xfs_inode.c prototypes.
457 */ 495 */
458int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t, 496int xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
459 xfs_nlink_t, xfs_dev_t, cred_t *, xfs_prid_t, 497 xfs_nlink_t, xfs_dev_t, prid_t, int,
460 int, struct xfs_buf **, boolean_t *, xfs_inode_t **); 498 struct xfs_buf **, boolean_t *, xfs_inode_t **);
461 499
462uint xfs_ip2xflags(struct xfs_inode *); 500uint xfs_ip2xflags(struct xfs_inode *);
463uint xfs_dic2xflags(struct xfs_dinode *); 501uint xfs_dic2xflags(struct xfs_dinode *);
@@ -471,7 +509,6 @@ int xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
471void xfs_iext_realloc(xfs_inode_t *, int, int); 509void xfs_iext_realloc(xfs_inode_t *, int, int);
472void xfs_iunpin_wait(xfs_inode_t *); 510void xfs_iunpin_wait(xfs_inode_t *);
473int xfs_iflush(xfs_inode_t *, uint); 511int xfs_iflush(xfs_inode_t *, uint);
474void xfs_ichgtime(xfs_inode_t *, int);
475void xfs_lock_inodes(xfs_inode_t **, int, uint); 512void xfs_lock_inodes(xfs_inode_t **, int, uint);
476void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint); 513void xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);
477 514
@@ -482,7 +519,7 @@ void xfs_mark_inode_dirty_sync(xfs_inode_t *);
482#define IHOLD(ip) \ 519#define IHOLD(ip) \
483do { \ 520do { \
484 ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \ 521 ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
485 atomic_inc(&(VFS_I(ip)->i_count)); \ 522 ihold(VFS_I(ip)); \
486 trace_xfs_ihold(ip, _THIS_IP_); \ 523 trace_xfs_ihold(ip, _THIS_IP_); \
487} while (0) 524} while (0)
488 525