Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6
[safe/jmp/linux-2.6] / fs / xfs / xfs_inode.h
index 03ae96b..9965e40 100644 (file)
@@ -18,6 +18,7 @@
 #ifndef        __XFS_INODE_H__
 #define        __XFS_INODE_H__
 
+struct posix_acl;
 struct xfs_dinode;
 struct xfs_inode;
 
@@ -122,7 +123,7 @@ typedef struct xfs_ictimestamp {
 
 /*
  * NOTE:  This structure must be kept identical to struct xfs_dinode
- *       in xfs_dinode.h except for the endianess annotations.
+ *       in xfs_dinode.h except for the endianness annotations.
  */
 typedef struct xfs_icdinode {
        __uint16_t      di_magic;       /* inode magic # = XFS_DINODE_MAGIC */
@@ -212,7 +213,6 @@ typedef struct xfs_icdinode {
 
 struct bhv_desc;
 struct cred;
-struct ktrace;
 struct xfs_buf;
 struct xfs_bmap_free;
 struct xfs_bmbt_irec;
@@ -221,14 +221,6 @@ struct xfs_mount;
 struct xfs_trans;
 struct xfs_dquot;
 
-#if defined(XFS_ILOCK_TRACE)
-#define XFS_ILOCK_KTRACE_SIZE  32
-extern ktrace_t *xfs_ilock_trace_buf;
-extern void xfs_ilock_trace(struct xfs_inode *, int, unsigned int, inst_t *);
-#else
-#define        xfs_ilock_trace(i,n,f,ra)
-#endif
-
 typedef struct dm_attrs_s {
        __uint32_t      da_dmevmask;    /* DMIG event mask */
        __uint16_t      da_dmstate;     /* DMIG state info */
@@ -261,7 +253,6 @@ typedef struct xfs_inode {
        /* Miscellaneous state. */
        unsigned short          i_flags;        /* see defined flags below */
        unsigned char           i_update_core;  /* timestamps/size is dirty */
-       unsigned char           i_update_size;  /* di_size field is dirty */
        unsigned int            i_delayed_blks; /* count of delay alloc blks */
 
        xfs_icdinode_t          i_d;            /* most of ondisk inode */
@@ -272,26 +263,6 @@ typedef struct xfs_inode {
 
        /* VFS inode */
        struct inode            i_vnode;        /* embedded VFS inode */
-
-       /* Trace buffers per inode. */
-#ifdef XFS_INODE_TRACE
-       struct ktrace           *i_trace;       /* general inode trace */
-#endif
-#ifdef XFS_BMAP_TRACE
-       struct ktrace           *i_xtrace;      /* inode extent list trace */
-#endif
-#ifdef XFS_BTREE_TRACE
-       struct ktrace           *i_btrace;      /* inode bmap btree trace */
-#endif
-#ifdef XFS_RW_TRACE
-       struct ktrace           *i_rwtrace;     /* inode read/write trace */
-#endif
-#ifdef XFS_ILOCK_TRACE
-       struct ktrace           *i_lock_trace;  /* inode lock/unlock trace */
-#endif
-#ifdef XFS_DIR2_TRACE
-       struct ktrace           *i_dir_trace;   /* inode directory trace */
-#endif
 } xfs_inode_t;
 
 #define XFS_ISIZE(ip)  (((ip)->i_d.di_mode & S_IFMT) == S_IFREG) ? \
@@ -310,23 +281,6 @@ static inline struct inode *VFS_I(struct xfs_inode *ip)
 }
 
 /*
- * Get rid of a partially initialized inode.
- *
- * We have to go through destroy_inode to make sure allocations
- * from init_inode_always like the security data are undone.
- *
- * We mark the inode bad so that it takes the short cut in
- * the reclaim path instead of going through the flush path
- * which doesn't make sense for an inode that has never seen the
- * light of day.
- */
-static inline void xfs_destroy_inode(struct xfs_inode *ip)
-{
-       make_bad_inode(VFS_I(ip));
-       return destroy_inode(VFS_I(ip));
-}
-
-/*
  * i_flags helper functions
  */
 static inline void
@@ -403,17 +357,12 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
 /*
  * In-core inode flags.
  */
-#define XFS_IGRIO      0x0001  /* inode used for guaranteed rate i/o */
-#define XFS_IUIOSZ     0x0002  /* inode i/o sizes have been explicitly set */
-#define XFS_IQUIESCE    0x0004  /* we have started quiescing for this inode */
-#define XFS_IRECLAIM    0x0008  /* we have started reclaiming this inode    */
-#define XFS_ISTALE     0x0010  /* inode has been staled */
-#define XFS_IRECLAIMABLE 0x0020 /* inode can be reclaimed */
-#define XFS_INEW       0x0040
-#define XFS_IFILESTREAM        0x0080  /* inode is in a filestream directory */
-#define XFS_IMODIFIED  0x0100  /* XFS inode state possibly differs */
-                               /* to the Linux inode state. */
-#define XFS_ITRUNCATED 0x0200  /* truncated down so flush-on-close */
+#define XFS_IRECLAIM    0x0001  /* we have started reclaiming this inode    */
+#define XFS_ISTALE     0x0002  /* inode has been staled */
+#define XFS_IRECLAIMABLE 0x0004 /* inode can be reclaimed */
+#define XFS_INEW       0x0008  /* inode has just been allocated */
+#define XFS_IFILESTREAM        0x0010  /* inode is in a filestream directory */
+#define XFS_ITRUNCATED 0x0020  /* truncated down so flush-on-close */
 
 /*
  * Flags for inode locking.
@@ -429,6 +378,14 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
 #define XFS_LOCK_MASK          (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \
                                | XFS_ILOCK_EXCL | XFS_ILOCK_SHARED)
 
+#define XFS_LOCK_FLAGS \
+       { XFS_IOLOCK_EXCL,      "IOLOCK_EXCL" }, \
+       { XFS_IOLOCK_SHARED,    "IOLOCK_SHARED" }, \
+       { XFS_ILOCK_EXCL,       "ILOCK_EXCL" }, \
+       { XFS_ILOCK_SHARED,     "ILOCK_SHARED" }, \
+       { XFS_IUNLOCK_NONOTIFY, "IUNLOCK_NONOTIFY" }
+
+
 /*
  * Flags for lockdep annotations.
  *
@@ -463,21 +420,15 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
 #define XFS_ILOCK_DEP(flags)   (((flags) & XFS_ILOCK_DEP_MASK) >> XFS_ILOCK_SHIFT)
 
 /*
- * Flags for xfs_iflush()
- */
-#define        XFS_IFLUSH_DELWRI_ELSE_SYNC     1
-#define        XFS_IFLUSH_DELWRI_ELSE_ASYNC    2
-#define        XFS_IFLUSH_SYNC                 3
-#define        XFS_IFLUSH_ASYNC                4
-#define        XFS_IFLUSH_DELWRI               5
-#define        XFS_IFLUSH_ASYNC_NOBLOCK        6
-
-/*
  * Flags for xfs_itruncate_start().
  */
 #define        XFS_ITRUNC_DEFINITE     0x1
 #define        XFS_ITRUNC_MAYBE        0x2
 
+#define XFS_ITRUNC_FLAGS \
+       { XFS_ITRUNC_DEFINITE,  "DEFINITE" }, \
+       { XFS_ITRUNC_MAYBE,     "MAYBE" }
+
 /*
  * For multiple groups support: if S_ISGID bit is set in the parent
  * directory, group of new file is set to that of the parent, and
@@ -488,16 +439,8 @@ static inline void xfs_ifunlock(xfs_inode_t *ip)
         ((pip)->i_d.di_mode & S_ISGID))
 
 /*
- * Flags for xfs_iget()
- */
-#define XFS_IGET_CREATE                0x1
-#define XFS_IGET_BULKSTAT      0x2
-
-/*
  * xfs_iget.c prototypes.
  */
-xfs_inode_t    *xfs_inode_incore(struct xfs_mount *, xfs_ino_t,
-                                 struct xfs_trans *);
 int            xfs_iget(struct xfs_mount *, struct xfs_trans *, xfs_ino_t,
                         uint, uint, xfs_inode_t **, xfs_daddr_t);
 void           xfs_iput(xfs_inode_t *, uint);
@@ -514,10 +457,8 @@ void               xfs_ireclaim(xfs_inode_t *);
 /*
  * xfs_inode.c prototypes.
  */
-int            xfs_iread(struct xfs_mount *, struct xfs_trans *,
-                         struct xfs_inode *, xfs_daddr_t, uint);
 int            xfs_ialloc(struct xfs_trans *, xfs_inode_t *, mode_t,
-                          xfs_nlink_t, xfs_dev_t, struct cred *, xfs_prid_t,
+                          xfs_nlink_t, xfs_dev_t, cred_t *, xfs_prid_t,
                           int, struct xfs_buf **, boolean_t *, xfs_inode_t **);
 
 uint           xfs_ip2xflags(struct xfs_inode *);
@@ -530,27 +471,45 @@ int               xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *,
 int            xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
 
 void           xfs_iext_realloc(xfs_inode_t *, int, int);
-void           xfs_ipin(xfs_inode_t *);
-void           xfs_iunpin(xfs_inode_t *);
+void           xfs_iunpin_wait(xfs_inode_t *);
 int            xfs_iflush(xfs_inode_t *, uint);
 void           xfs_ichgtime(xfs_inode_t *, int);
-xfs_fsize_t    xfs_file_last_byte(xfs_inode_t *);
 void           xfs_lock_inodes(xfs_inode_t **, int, uint);
 void           xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);
 
-void           xfs_synchronize_atime(xfs_inode_t *);
+void           xfs_synchronize_times(xfs_inode_t *);
+void           xfs_mark_inode_dirty(xfs_inode_t *);
 void           xfs_mark_inode_dirty_sync(xfs_inode_t *);
 
+#define IHOLD(ip) \
+do { \
+       ASSERT(atomic_read(&VFS_I(ip)->i_count) > 0) ; \
+       atomic_inc(&(VFS_I(ip)->i_count)); \
+       trace_xfs_ihold(ip, _THIS_IP_); \
+} while (0)
+
+#define IRELE(ip) \
+do { \
+       trace_xfs_irele(ip, _THIS_IP_); \
+       iput(VFS_I(ip)); \
+} while (0)
+
 #endif /* __KERNEL__ */
 
+/*
+ * Flags for xfs_iget()
+ */
+#define XFS_IGET_CREATE                0x1
+#define XFS_IGET_BULKSTAT      0x2
+
 int            xfs_inotobp(struct xfs_mount *, struct xfs_trans *,
                            xfs_ino_t, struct xfs_dinode **,
                            struct xfs_buf **, int *, uint);
 int            xfs_itobp(struct xfs_mount *, struct xfs_trans *,
                          struct xfs_inode *, struct xfs_dinode **,
                          struct xfs_buf **, uint);
-void           xfs_dinode_from_disk(struct xfs_icdinode *,
-                                    struct xfs_dinode *);
+int            xfs_iread(struct xfs_mount *, struct xfs_trans *,
+                         struct xfs_inode *, xfs_daddr_t, uint);
 void           xfs_dinode_to_disk(struct xfs_dinode *,
                                   struct xfs_icdinode *);
 void           xfs_idestroy_fork(struct xfs_inode *, int);
@@ -560,17 +519,15 @@ int               xfs_iread_extents(struct xfs_trans *, struct xfs_inode *, int);
 int            xfs_iextents_copy(struct xfs_inode *, xfs_bmbt_rec_t *, int);
 
 xfs_bmbt_rec_host_t *xfs_iext_get_ext(xfs_ifork_t *, xfs_extnum_t);
-void           xfs_iext_insert(xfs_ifork_t *, xfs_extnum_t, xfs_extnum_t,
-                               xfs_bmbt_irec_t *);
+void           xfs_iext_insert(xfs_inode_t *, xfs_extnum_t, xfs_extnum_t,
+                               xfs_bmbt_irec_t *, int);
 void           xfs_iext_add(xfs_ifork_t *, xfs_extnum_t, int);
 void           xfs_iext_add_indirect_multi(xfs_ifork_t *, int, xfs_extnum_t, int);
-void           xfs_iext_remove(xfs_ifork_t *, xfs_extnum_t, int);
+void           xfs_iext_remove(xfs_inode_t *, xfs_extnum_t, int, int);
 void           xfs_iext_remove_inline(xfs_ifork_t *, xfs_extnum_t, int);
 void           xfs_iext_remove_direct(xfs_ifork_t *, xfs_extnum_t, int);
 void           xfs_iext_remove_indirect(xfs_ifork_t *, xfs_extnum_t, int);
 void           xfs_iext_realloc_direct(xfs_ifork_t *, int);
-void           xfs_iext_realloc_indirect(xfs_ifork_t *, int);
-void           xfs_iext_indirect_to_direct(xfs_ifork_t *);
 void           xfs_iext_direct_to_inline(xfs_ifork_t *, xfs_extnum_t);
 void           xfs_iext_inline_to_direct(xfs_ifork_t *, int);
 void           xfs_iext_destroy(xfs_ifork_t *);