| .. | .. |
|---|
| 37 | 37 | struct xfs_ifork *i_cowfp; /* copy on write extents */ |
|---|
| 38 | 38 | struct xfs_ifork i_df; /* data fork */ |
|---|
| 39 | 39 | |
|---|
| 40 | | - /* operations vectors */ |
|---|
| 41 | | - const struct xfs_dir_ops *d_ops; /* directory ops vector */ |
|---|
| 42 | | - |
|---|
| 43 | 40 | /* Transaction and locking information. */ |
|---|
| 44 | 41 | struct xfs_inode_log_item *i_itemp; /* logging information */ |
|---|
| 45 | 42 | mrlock_t i_lock; /* inode lock */ |
|---|
| 46 | 43 | mrlock_t i_mmaplock; /* inode mmap IO lock */ |
|---|
| 47 | 44 | atomic_t i_pincount; /* inode pin count */ |
|---|
| 45 | + |
|---|
| 46 | + /* |
|---|
| 47 | + * Bitsets of inode metadata that have been checked and/or are sick. |
|---|
| 48 | + * Callers must hold i_flags_lock before accessing this field. |
|---|
| 49 | + */ |
|---|
| 50 | + uint16_t i_checked; |
|---|
| 51 | + uint16_t i_sick; |
|---|
| 52 | + |
|---|
| 48 | 53 | spinlock_t i_flags_lock; /* inode i_flags lock */ |
|---|
| 49 | 54 | /* Miscellaneous state. */ |
|---|
| 50 | 55 | unsigned long i_flags; /* see defined flags below */ |
|---|
| 51 | | - unsigned int i_delayed_blks; /* count of delay alloc blks */ |
|---|
| 56 | + uint64_t i_delayed_blks; /* count of delay alloc blks */ |
|---|
| 52 | 57 | |
|---|
| 53 | 58 | struct xfs_icdinode i_d; /* most of ondisk inode */ |
|---|
| 54 | 59 | |
|---|
| 55 | | - xfs_extnum_t i_cnextents; /* # of extents in cow fork */ |
|---|
| 56 | | - unsigned int i_cformat; /* format of cow fork */ |
|---|
| 57 | | - |
|---|
| 58 | 60 | /* VFS inode */ |
|---|
| 59 | 61 | struct inode i_vnode; /* embedded VFS inode */ |
|---|
| 62 | + |
|---|
| 63 | + /* pending io completions */ |
|---|
| 64 | + spinlock_t i_ioend_lock; |
|---|
| 65 | + struct work_struct i_ioend_work; |
|---|
| 66 | + struct list_head i_ioend_list; |
|---|
| 60 | 67 | } xfs_inode_t; |
|---|
| 61 | 68 | |
|---|
| 62 | 69 | /* Convert from vfs inode to xfs inode */ |
|---|
| .. | .. |
|---|
| 164 | 171 | return ret; |
|---|
| 165 | 172 | } |
|---|
| 166 | 173 | |
|---|
| 167 | | -/* |
|---|
| 168 | | - * Project quota id helpers (previously projid was 16bit only |
|---|
| 169 | | - * and using two 16bit values to hold new 32bit projid was chosen |
|---|
| 170 | | - * to retain compatibility with "old" filesystems). |
|---|
| 171 | | - */ |
|---|
| 172 | | -static inline prid_t |
|---|
| 173 | | -xfs_get_projid(struct xfs_inode *ip) |
|---|
| 174 | | -{ |
|---|
| 175 | | - return (prid_t)ip->i_d.di_projid_hi << 16 | ip->i_d.di_projid_lo; |
|---|
| 176 | | -} |
|---|
| 177 | | - |
|---|
| 178 | | -static inline void |
|---|
| 179 | | -xfs_set_projid(struct xfs_inode *ip, |
|---|
| 180 | | - prid_t projid) |
|---|
| 181 | | -{ |
|---|
| 182 | | - ip->i_d.di_projid_hi = (uint16_t) (projid >> 16); |
|---|
| 183 | | - ip->i_d.di_projid_lo = (uint16_t) (projid & 0xffff); |
|---|
| 184 | | -} |
|---|
| 185 | | - |
|---|
| 186 | 174 | static inline prid_t |
|---|
| 187 | 175 | xfs_get_initial_prid(struct xfs_inode *dp) |
|---|
| 188 | 176 | { |
|---|
| 189 | 177 | if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) |
|---|
| 190 | | - return xfs_get_projid(dp); |
|---|
| 178 | + return dp->i_d.di_projid; |
|---|
| 191 | 179 | |
|---|
| 192 | 180 | return XFS_PROJID_DEFAULT; |
|---|
| 193 | 181 | } |
|---|
| .. | .. |
|---|
| 206 | 194 | return ip->i_cowfp && ip->i_cowfp->if_bytes; |
|---|
| 207 | 195 | } |
|---|
| 208 | 196 | |
|---|
| 197 | +static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip) |
|---|
| 198 | +{ |
|---|
| 199 | + return ip->i_d.di_flags2 & XFS_DIFLAG2_BIGTIME; |
|---|
| 200 | +} |
|---|
| 201 | + |
|---|
| 202 | +/* |
|---|
| 203 | + * Return the buftarg used for data allocations on a given inode. |
|---|
| 204 | + */ |
|---|
| 205 | +#define xfs_inode_buftarg(ip) \ |
|---|
| 206 | + (XFS_IS_REALTIME_INODE(ip) ? \ |
|---|
| 207 | + (ip)->i_mount->m_rtdev_targp : (ip)->i_mount->m_ddev_targp) |
|---|
| 208 | + |
|---|
| 209 | 209 | /* |
|---|
| 210 | 210 | * In-core inode flags. |
|---|
| 211 | 211 | */ |
|---|
| .. | .. |
|---|
| 216 | 216 | #define XFS_INEW (1 << __XFS_INEW_BIT) |
|---|
| 217 | 217 | #define XFS_ITRUNCATED (1 << 5) /* truncated down so flush-on-close */ |
|---|
| 218 | 218 | #define XFS_IDIRTY_RELEASE (1 << 6) /* dirty release already seen */ |
|---|
| 219 | | -#define __XFS_IFLOCK_BIT 7 /* inode is being flushed right now */ |
|---|
| 220 | | -#define XFS_IFLOCK (1 << __XFS_IFLOCK_BIT) |
|---|
| 219 | +#define XFS_IFLUSHING (1 << 7) /* inode is being flushed */ |
|---|
| 221 | 220 | #define __XFS_IPINNED_BIT 8 /* wakeup key for zero pin count */ |
|---|
| 222 | 221 | #define XFS_IPINNED (1 << __XFS_IPINNED_BIT) |
|---|
| 223 | | -#define XFS_IDONTCACHE (1 << 9) /* don't cache the inode long term */ |
|---|
| 224 | | -#define XFS_IEOFBLOCKS (1 << 10)/* has the preallocblocks tag set */ |
|---|
| 222 | +#define XFS_IEOFBLOCKS (1 << 9) /* has the preallocblocks tag set */ |
|---|
| 225 | 223 | /* |
|---|
| 226 | 224 | * If this unlinked inode is in the middle of recovery, don't let drop_inode |
|---|
| 227 | 225 | * truncate and free the inode. This can happen if we iget the inode during |
|---|
| .. | .. |
|---|
| 238 | 236 | #define XFS_IRECLAIM_RESET_FLAGS \ |
|---|
| 239 | 237 | (XFS_IRECLAIMABLE | XFS_IRECLAIM | \ |
|---|
| 240 | 238 | XFS_IDIRTY_RELEASE | XFS_ITRUNCATED) |
|---|
| 241 | | - |
|---|
| 242 | | -/* |
|---|
| 243 | | - * Synchronize processes attempting to flush the in-core inode back to disk. |
|---|
| 244 | | - */ |
|---|
| 245 | | - |
|---|
| 246 | | -static inline int xfs_isiflocked(struct xfs_inode *ip) |
|---|
| 247 | | -{ |
|---|
| 248 | | - return xfs_iflags_test(ip, XFS_IFLOCK); |
|---|
| 249 | | -} |
|---|
| 250 | | - |
|---|
| 251 | | -extern void __xfs_iflock(struct xfs_inode *ip); |
|---|
| 252 | | - |
|---|
| 253 | | -static inline int xfs_iflock_nowait(struct xfs_inode *ip) |
|---|
| 254 | | -{ |
|---|
| 255 | | - return !xfs_iflags_test_and_set(ip, XFS_IFLOCK); |
|---|
| 256 | | -} |
|---|
| 257 | | - |
|---|
| 258 | | -static inline void xfs_iflock(struct xfs_inode *ip) |
|---|
| 259 | | -{ |
|---|
| 260 | | - if (!xfs_iflock_nowait(ip)) |
|---|
| 261 | | - __xfs_iflock(ip); |
|---|
| 262 | | -} |
|---|
| 263 | | - |
|---|
| 264 | | -static inline void xfs_ifunlock(struct xfs_inode *ip) |
|---|
| 265 | | -{ |
|---|
| 266 | | - ASSERT(xfs_isiflocked(ip)); |
|---|
| 267 | | - xfs_iflags_clear(ip, XFS_IFLOCK); |
|---|
| 268 | | - smp_mb(); |
|---|
| 269 | | - wake_up_bit(&ip->i_flags, __XFS_IFLOCK_BIT); |
|---|
| 270 | | -} |
|---|
| 271 | 239 | |
|---|
| 272 | 240 | /* |
|---|
| 273 | 241 | * Flags for inode locking. |
|---|
| .. | .. |
|---|
| 428 | 396 | struct xfs_inode *, int, xfs_fsize_t, int); |
|---|
| 429 | 397 | void xfs_iext_realloc(xfs_inode_t *, int, int); |
|---|
| 430 | 398 | |
|---|
| 399 | +int xfs_log_force_inode(struct xfs_inode *ip); |
|---|
| 431 | 400 | void xfs_iunpin_wait(xfs_inode_t *); |
|---|
| 432 | 401 | #define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount)) |
|---|
| 433 | 402 | |
|---|
| 434 | | -int xfs_iflush(struct xfs_inode *, struct xfs_buf **); |
|---|
| 403 | +int xfs_iflush_cluster(struct xfs_buf *); |
|---|
| 435 | 404 | void xfs_lock_two_inodes(struct xfs_inode *ip0, uint ip0_mode, |
|---|
| 436 | 405 | struct xfs_inode *ip1, uint ip1_mode); |
|---|
| 437 | 406 | |
|---|
| .. | .. |
|---|
| 468 | 437 | /* from xfs_iops.c */ |
|---|
| 469 | 438 | extern void xfs_setup_inode(struct xfs_inode *ip); |
|---|
| 470 | 439 | extern void xfs_setup_iops(struct xfs_inode *ip); |
|---|
| 440 | +extern void xfs_diflags_to_iflags(struct xfs_inode *ip, bool init); |
|---|
| 471 | 441 | |
|---|
| 472 | 442 | /* |
|---|
| 473 | 443 | * When setting up a newly allocated inode, we need to call |
|---|
| .. | .. |
|---|
| 498 | 468 | /* The default CoW extent size hint. */ |
|---|
| 499 | 469 | #define XFS_DEFAULT_COWEXTSZ_HINT 32 |
|---|
| 500 | 470 | |
|---|
| 501 | | -bool xfs_inode_verify_forks(struct xfs_inode *ip); |
|---|
| 471 | +int xfs_iunlink_init(struct xfs_perag *pag); |
|---|
| 472 | +void xfs_iunlink_destroy(struct xfs_perag *pag); |
|---|
| 473 | + |
|---|
| 474 | +void xfs_end_io(struct work_struct *work); |
|---|
| 475 | + |
|---|
| 476 | +int xfs_ilock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2); |
|---|
| 477 | +void xfs_iunlock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2); |
|---|
| 502 | 478 | |
|---|
| 503 | 479 | #endif /* __XFS_INODE_H__ */ |
|---|