Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
0004  * All Rights Reserved.
0005  */
0006 #ifndef __XFS_INODE_H__
0007 #define __XFS_INODE_H__
0008 
0009 #include "xfs_inode_buf.h"
0010 #include "xfs_inode_fork.h"
0011 
0012 /*
0013  * Kernel only inode definitions
0014  */
0015 struct xfs_dinode;
0016 struct xfs_inode;
0017 struct xfs_buf;
0018 struct xfs_bmbt_irec;
0019 struct xfs_inode_log_item;
0020 struct xfs_mount;
0021 struct xfs_trans;
0022 struct xfs_dquot;
0023 
0024 typedef struct xfs_inode {
0025     /* Inode linking and identification information. */
0026     struct xfs_mount    *i_mount;   /* fs mount struct ptr */
0027     struct xfs_dquot    *i_udquot;  /* user dquot */
0028     struct xfs_dquot    *i_gdquot;  /* group dquot */
0029     struct xfs_dquot    *i_pdquot;  /* project dquot */
0030 
0031     /* Inode location stuff */
0032     xfs_ino_t       i_ino;      /* inode number (agno/agino)*/
0033     struct xfs_imap     i_imap;     /* location for xfs_imap() */
0034 
0035     /* Extent information. */
0036     struct xfs_ifork    *i_cowfp;   /* copy on write extents */
0037     struct xfs_ifork    i_df;       /* data fork */
0038     struct xfs_ifork    i_af;       /* attribute fork */
0039 
0040     /* Transaction and locking information. */
0041     struct xfs_inode_log_item *i_itemp; /* logging information */
0042     mrlock_t        i_lock;     /* inode lock */
0043     atomic_t        i_pincount; /* inode pin count */
0044     struct llist_node   i_gclist;   /* deferred inactivation list */
0045 
0046     /*
0047      * Bitsets of inode metadata that have been checked and/or are sick.
0048      * Callers must hold i_flags_lock before accessing this field.
0049      */
0050     uint16_t        i_checked;
0051     uint16_t        i_sick;
0052 
0053     spinlock_t      i_flags_lock;   /* inode i_flags lock */
0054     /* Miscellaneous state. */
0055     unsigned long       i_flags;    /* see defined flags below */
0056     uint64_t        i_delayed_blks; /* count of delay alloc blks */
0057     xfs_fsize_t     i_disk_size;    /* number of bytes in file */
0058     xfs_rfsblock_t      i_nblocks;  /* # of direct & btree blocks */
0059     prid_t          i_projid;   /* owner's project id */
0060     xfs_extlen_t        i_extsize;  /* basic/minimum extent size */
0061     /* cowextsize is only used for v3 inodes, flushiter for v1/2 */
0062     union {
0063         xfs_extlen_t    i_cowextsize;   /* basic cow extent size */
0064         uint16_t    i_flushiter;    /* incremented on flush */
0065     };
0066     uint8_t         i_forkoff;  /* attr fork offset >> 3 */
0067     uint16_t        i_diflags;  /* XFS_DIFLAG_... */
0068     uint64_t        i_diflags2; /* XFS_DIFLAG2_... */
0069     struct timespec64   i_crtime;   /* time created */
0070 
0071     /* unlinked list pointers */
0072     xfs_agino_t     i_next_unlinked;
0073     xfs_agino_t     i_prev_unlinked;
0074 
0075     /* VFS inode */
0076     struct inode        i_vnode;    /* embedded VFS inode */
0077 
0078     /* pending io completions */
0079     spinlock_t      i_ioend_lock;
0080     struct work_struct  i_ioend_work;
0081     struct list_head    i_ioend_list;
0082 } xfs_inode_t;
0083 
0084 static inline bool xfs_inode_has_attr_fork(struct xfs_inode *ip)
0085 {
0086     return ip->i_forkoff > 0;
0087 }
0088 
0089 static inline struct xfs_ifork *
0090 xfs_ifork_ptr(
0091     struct xfs_inode    *ip,
0092     int         whichfork)
0093 {
0094     switch (whichfork) {
0095     case XFS_DATA_FORK:
0096         return &ip->i_df;
0097     case XFS_ATTR_FORK:
0098         if (!xfs_inode_has_attr_fork(ip))
0099             return NULL;
0100         return &ip->i_af;
0101     case XFS_COW_FORK:
0102         return ip->i_cowfp;
0103     default:
0104         ASSERT(0);
0105         return NULL;
0106     }
0107 }
0108 
0109 static inline unsigned int xfs_inode_fork_boff(struct xfs_inode *ip)
0110 {
0111     return ip->i_forkoff << 3;
0112 }
0113 
0114 static inline unsigned int xfs_inode_data_fork_size(struct xfs_inode *ip)
0115 {
0116     if (xfs_inode_has_attr_fork(ip))
0117         return xfs_inode_fork_boff(ip);
0118 
0119     return XFS_LITINO(ip->i_mount);
0120 }
0121 
0122 static inline unsigned int xfs_inode_attr_fork_size(struct xfs_inode *ip)
0123 {
0124     if (xfs_inode_has_attr_fork(ip))
0125         return XFS_LITINO(ip->i_mount) - xfs_inode_fork_boff(ip);
0126     return 0;
0127 }
0128 
0129 static inline unsigned int
0130 xfs_inode_fork_size(
0131     struct xfs_inode    *ip,
0132     int         whichfork)
0133 {
0134     switch (whichfork) {
0135     case XFS_DATA_FORK:
0136         return xfs_inode_data_fork_size(ip);
0137     case XFS_ATTR_FORK:
0138         return xfs_inode_attr_fork_size(ip);
0139     default:
0140         return 0;
0141     }
0142 }
0143 
0144 /* Convert from vfs inode to xfs inode */
0145 static inline struct xfs_inode *XFS_I(struct inode *inode)
0146 {
0147     return container_of(inode, struct xfs_inode, i_vnode);
0148 }
0149 
0150 /* convert from xfs inode to vfs inode */
0151 static inline struct inode *VFS_I(struct xfs_inode *ip)
0152 {
0153     return &ip->i_vnode;
0154 }
0155 
0156 /*
0157  * For regular files we only update the on-disk filesize when actually
0158  * writing data back to disk.  Until then only the copy in the VFS inode
0159  * is uptodate.
0160  */
0161 static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
0162 {
0163     if (S_ISREG(VFS_I(ip)->i_mode))
0164         return i_size_read(VFS_I(ip));
0165     return ip->i_disk_size;
0166 }
0167 
0168 /*
0169  * If this I/O goes past the on-disk inode size update it unless it would
0170  * be past the current in-core inode size.
0171  */
0172 static inline xfs_fsize_t
0173 xfs_new_eof(struct xfs_inode *ip, xfs_fsize_t new_size)
0174 {
0175     xfs_fsize_t i_size = i_size_read(VFS_I(ip));
0176 
0177     if (new_size > i_size || new_size < 0)
0178         new_size = i_size;
0179     return new_size > ip->i_disk_size ? new_size : 0;
0180 }
0181 
0182 /*
0183  * i_flags helper functions
0184  */
0185 static inline void
0186 __xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
0187 {
0188     ip->i_flags |= flags;
0189 }
0190 
0191 static inline void
0192 xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
0193 {
0194     spin_lock(&ip->i_flags_lock);
0195     __xfs_iflags_set(ip, flags);
0196     spin_unlock(&ip->i_flags_lock);
0197 }
0198 
0199 static inline void
0200 xfs_iflags_clear(xfs_inode_t *ip, unsigned short flags)
0201 {
0202     spin_lock(&ip->i_flags_lock);
0203     ip->i_flags &= ~flags;
0204     spin_unlock(&ip->i_flags_lock);
0205 }
0206 
0207 static inline int
0208 __xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
0209 {
0210     return (ip->i_flags & flags);
0211 }
0212 
0213 static inline int
0214 xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
0215 {
0216     int ret;
0217     spin_lock(&ip->i_flags_lock);
0218     ret = __xfs_iflags_test(ip, flags);
0219     spin_unlock(&ip->i_flags_lock);
0220     return ret;
0221 }
0222 
0223 static inline int
0224 xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
0225 {
0226     int ret;
0227 
0228     spin_lock(&ip->i_flags_lock);
0229     ret = ip->i_flags & flags;
0230     if (ret)
0231         ip->i_flags &= ~flags;
0232     spin_unlock(&ip->i_flags_lock);
0233     return ret;
0234 }
0235 
0236 static inline int
0237 xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned short flags)
0238 {
0239     int ret;
0240 
0241     spin_lock(&ip->i_flags_lock);
0242     ret = ip->i_flags & flags;
0243     if (!ret)
0244         ip->i_flags |= flags;
0245     spin_unlock(&ip->i_flags_lock);
0246     return ret;
0247 }
0248 
0249 static inline prid_t
0250 xfs_get_initial_prid(struct xfs_inode *dp)
0251 {
0252     if (dp->i_diflags & XFS_DIFLAG_PROJINHERIT)
0253         return dp->i_projid;
0254 
0255     return XFS_PROJID_DEFAULT;
0256 }
0257 
0258 static inline bool xfs_is_reflink_inode(struct xfs_inode *ip)
0259 {
0260     return ip->i_diflags2 & XFS_DIFLAG2_REFLINK;
0261 }
0262 
0263 static inline bool xfs_is_metadata_inode(struct xfs_inode *ip)
0264 {
0265     struct xfs_mount    *mp = ip->i_mount;
0266 
0267     return ip == mp->m_rbmip || ip == mp->m_rsumip ||
0268         xfs_is_quota_inode(&mp->m_sb, ip->i_ino);
0269 }
0270 
0271 /*
0272  * Check if an inode has any data in the COW fork.  This might be often false
0273  * even for inodes with the reflink flag when there is no pending COW operation.
0274  */
0275 static inline bool xfs_inode_has_cow_data(struct xfs_inode *ip)
0276 {
0277     return ip->i_cowfp && ip->i_cowfp->if_bytes;
0278 }
0279 
0280 static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
0281 {
0282     return ip->i_diflags2 & XFS_DIFLAG2_BIGTIME;
0283 }
0284 
0285 static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip)
0286 {
0287     return ip->i_diflags2 & XFS_DIFLAG2_NREXT64;
0288 }
0289 
0290 /*
0291  * Return the buftarg used for data allocations on a given inode.
0292  */
0293 #define xfs_inode_buftarg(ip) \
0294     (XFS_IS_REALTIME_INODE(ip) ? \
0295         (ip)->i_mount->m_rtdev_targp : (ip)->i_mount->m_ddev_targp)
0296 
0297 /*
0298  * In-core inode flags.
0299  */
0300 #define XFS_IRECLAIM        (1 << 0) /* started reclaiming this inode */
0301 #define XFS_ISTALE      (1 << 1) /* inode has been staled */
0302 #define XFS_IRECLAIMABLE    (1 << 2) /* inode can be reclaimed */
0303 #define XFS_INEW        (1 << 3) /* inode has just been allocated */
0304 #define XFS_IPRESERVE_DM_FIELDS (1 << 4) /* has legacy DMAPI fields set */
0305 #define XFS_ITRUNCATED      (1 << 5) /* truncated down so flush-on-close */
0306 #define XFS_IDIRTY_RELEASE  (1 << 6) /* dirty release already seen */
0307 #define XFS_IFLUSHING       (1 << 7) /* inode is being flushed */
0308 #define __XFS_IPINNED_BIT   8    /* wakeup key for zero pin count */
0309 #define XFS_IPINNED     (1 << __XFS_IPINNED_BIT)
0310 #define XFS_IEOFBLOCKS      (1 << 9) /* has the preallocblocks tag set */
0311 #define XFS_NEED_INACTIVE   (1 << 10) /* see XFS_INACTIVATING below */
0312 /*
0313  * If this unlinked inode is in the middle of recovery, don't let drop_inode
0314  * truncate and free the inode.  This can happen if we iget the inode during
0315  * log recovery to replay a bmap operation on the inode.
0316  */
0317 #define XFS_IRECOVERY       (1 << 11)
0318 #define XFS_ICOWBLOCKS      (1 << 12)/* has the cowblocks tag set */
0319 
0320 /*
0321  * If we need to update on-disk metadata before this IRECLAIMABLE inode can be
0322  * freed, then NEED_INACTIVE will be set.  Once we start the updates, the
0323  * INACTIVATING bit will be set to keep iget away from this inode.  After the
0324  * inactivation completes, both flags will be cleared and the inode is a
0325  * plain old IRECLAIMABLE inode.
0326  */
0327 #define XFS_INACTIVATING    (1 << 13)
0328 
0329 /* All inode state flags related to inode reclaim. */
0330 #define XFS_ALL_IRECLAIM_FLAGS  (XFS_IRECLAIMABLE | \
0331                  XFS_IRECLAIM | \
0332                  XFS_NEED_INACTIVE | \
0333                  XFS_INACTIVATING)
0334 
0335 /*
0336  * Per-lifetime flags need to be reset when re-using a reclaimable inode during
0337  * inode lookup. This prevents unintended behaviour on the new inode from
0338  * ocurring.
0339  */
0340 #define XFS_IRECLAIM_RESET_FLAGS    \
0341     (XFS_IRECLAIMABLE | XFS_IRECLAIM | \
0342      XFS_IDIRTY_RELEASE | XFS_ITRUNCATED | XFS_NEED_INACTIVE | \
0343      XFS_INACTIVATING)
0344 
0345 /*
0346  * Flags for inode locking.
0347  * Bit ranges:  1<<1  - 1<<16-1 -- iolock/ilock modes (bitfield)
0348  *      1<<16 - 1<<32-1 -- lockdep annotation (integers)
0349  */
0350 #define XFS_IOLOCK_EXCL     (1u << 0)
0351 #define XFS_IOLOCK_SHARED   (1u << 1)
0352 #define XFS_ILOCK_EXCL      (1u << 2)
0353 #define XFS_ILOCK_SHARED    (1u << 3)
0354 #define XFS_MMAPLOCK_EXCL   (1u << 4)
0355 #define XFS_MMAPLOCK_SHARED (1u << 5)
0356 
0357 #define XFS_LOCK_MASK       (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \
0358                 | XFS_ILOCK_EXCL | XFS_ILOCK_SHARED \
0359                 | XFS_MMAPLOCK_EXCL | XFS_MMAPLOCK_SHARED)
0360 
0361 #define XFS_LOCK_FLAGS \
0362     { XFS_IOLOCK_EXCL,  "IOLOCK_EXCL" }, \
0363     { XFS_IOLOCK_SHARED,    "IOLOCK_SHARED" }, \
0364     { XFS_ILOCK_EXCL,   "ILOCK_EXCL" }, \
0365     { XFS_ILOCK_SHARED, "ILOCK_SHARED" }, \
0366     { XFS_MMAPLOCK_EXCL,    "MMAPLOCK_EXCL" }, \
0367     { XFS_MMAPLOCK_SHARED,  "MMAPLOCK_SHARED" }
0368 
0369 
0370 /*
0371  * Flags for lockdep annotations.
0372  *
0373  * XFS_LOCK_PARENT - for directory operations that require locking a
0374  * parent directory inode and a child entry inode. IOLOCK requires nesting,
0375  * MMAPLOCK does not support this class, ILOCK requires a single subclass
0376  * to differentiate parent from child.
0377  *
0378  * XFS_LOCK_RTBITMAP/XFS_LOCK_RTSUM - the realtime device bitmap and summary
0379  * inodes do not participate in the normal lock order, and thus have their
0380  * own subclasses.
0381  *
0382  * XFS_LOCK_INUMORDER - for locking several inodes at the some time
0383  * with xfs_lock_inodes().  This flag is used as the starting subclass
0384  * and each subsequent lock acquired will increment the subclass by one.
0385  * However, MAX_LOCKDEP_SUBCLASSES == 8, which means we are greatly
0386  * limited to the subclasses we can represent via nesting. We need at least
0387  * 5 inodes nest depth for the ILOCK through rename, and we also have to support
0388  * XFS_ILOCK_PARENT, which gives 6 subclasses. Then we have XFS_ILOCK_RTBITMAP
0389  * and XFS_ILOCK_RTSUM, which are another 2 unique subclasses, so that's all
0390  * 8 subclasses supported by lockdep.
0391  *
0392  * This also means we have to number the sub-classes in the lowest bits of
0393  * the mask we keep, and we have to ensure we never exceed 3 bits of lockdep
0394  * mask and we can't use bit-masking to build the subclasses. What a mess.
0395  *
0396  * Bit layout:
0397  *
0398  * Bit      Lock Region
0399  * 16-19    XFS_IOLOCK_SHIFT dependencies
0400  * 20-23    XFS_MMAPLOCK_SHIFT dependencies
0401  * 24-31    XFS_ILOCK_SHIFT dependencies
0402  *
0403  * IOLOCK values
0404  *
0405  * 0-3      subclass value
0406  * 4-7      unused
0407  *
0408  * MMAPLOCK values
0409  *
0410  * 0-3      subclass value
0411  * 4-7      unused
0412  *
0413  * ILOCK values
0414  * 0-4      subclass values
0415  * 5        PARENT subclass (not nestable)
0416  * 6        RTBITMAP subclass (not nestable)
0417  * 7        RTSUM subclass (not nestable)
0418  * 
0419  */
0420 #define XFS_IOLOCK_SHIFT        16
0421 #define XFS_IOLOCK_MAX_SUBCLASS     3
0422 #define XFS_IOLOCK_DEP_MASK     0x000f0000u
0423 
0424 #define XFS_MMAPLOCK_SHIFT      20
0425 #define XFS_MMAPLOCK_NUMORDER       0
0426 #define XFS_MMAPLOCK_MAX_SUBCLASS   3
0427 #define XFS_MMAPLOCK_DEP_MASK       0x00f00000u
0428 
0429 #define XFS_ILOCK_SHIFT         24
0430 #define XFS_ILOCK_PARENT_VAL        5u
0431 #define XFS_ILOCK_MAX_SUBCLASS      (XFS_ILOCK_PARENT_VAL - 1)
0432 #define XFS_ILOCK_RTBITMAP_VAL      6u
0433 #define XFS_ILOCK_RTSUM_VAL     7u
0434 #define XFS_ILOCK_DEP_MASK      0xff000000u
0435 #define XFS_ILOCK_PARENT        (XFS_ILOCK_PARENT_VAL << XFS_ILOCK_SHIFT)
0436 #define XFS_ILOCK_RTBITMAP      (XFS_ILOCK_RTBITMAP_VAL << XFS_ILOCK_SHIFT)
0437 #define XFS_ILOCK_RTSUM         (XFS_ILOCK_RTSUM_VAL << XFS_ILOCK_SHIFT)
0438 
0439 #define XFS_LOCK_SUBCLASS_MASK  (XFS_IOLOCK_DEP_MASK | \
0440                  XFS_MMAPLOCK_DEP_MASK | \
0441                  XFS_ILOCK_DEP_MASK)
0442 
0443 #define XFS_IOLOCK_DEP(flags)   (((flags) & XFS_IOLOCK_DEP_MASK) \
0444                     >> XFS_IOLOCK_SHIFT)
0445 #define XFS_MMAPLOCK_DEP(flags) (((flags) & XFS_MMAPLOCK_DEP_MASK) \
0446                     >> XFS_MMAPLOCK_SHIFT)
0447 #define XFS_ILOCK_DEP(flags)    (((flags) & XFS_ILOCK_DEP_MASK) \
0448                     >> XFS_ILOCK_SHIFT)
0449 
0450 /*
0451  * Layouts are broken in the BREAK_WRITE case to ensure that
0452  * layout-holders do not collide with local writes. Additionally,
0453  * layouts are broken in the BREAK_UNMAP case to make sure the
0454  * layout-holder has a consistent view of the file's extent map. While
0455  * BREAK_WRITE breaks can be satisfied by recalling FL_LAYOUT leases,
0456  * BREAK_UNMAP breaks additionally require waiting for busy dax-pages to
0457  * go idle.
0458  */
0459 enum layout_break_reason {
0460         BREAK_WRITE,
0461         BREAK_UNMAP,
0462 };
0463 
0464 /*
0465  * For multiple groups support: if S_ISGID bit is set in the parent
0466  * directory, group of new file is set to that of the parent, and
0467  * new subdirectory gets S_ISGID bit from parent.
0468  */
0469 #define XFS_INHERIT_GID(pip)    \
0470     (xfs_has_grpid((pip)->i_mount) || (VFS_I(pip)->i_mode & S_ISGID))
0471 
0472 int     xfs_release(struct xfs_inode *ip);
0473 void        xfs_inactive(struct xfs_inode *ip);
0474 int     xfs_lookup(struct xfs_inode *dp, const struct xfs_name *name,
0475                struct xfs_inode **ipp, struct xfs_name *ci_name);
0476 int     xfs_create(struct user_namespace *mnt_userns,
0477                struct xfs_inode *dp, struct xfs_name *name,
0478                umode_t mode, dev_t rdev, bool need_xattr,
0479                struct xfs_inode **ipp);
0480 int     xfs_create_tmpfile(struct user_namespace *mnt_userns,
0481                struct xfs_inode *dp, umode_t mode,
0482                struct xfs_inode **ipp);
0483 int     xfs_remove(struct xfs_inode *dp, struct xfs_name *name,
0484                struct xfs_inode *ip);
0485 int     xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip,
0486              struct xfs_name *target_name);
0487 int     xfs_rename(struct user_namespace *mnt_userns,
0488                struct xfs_inode *src_dp, struct xfs_name *src_name,
0489                struct xfs_inode *src_ip, struct xfs_inode *target_dp,
0490                struct xfs_name *target_name,
0491                struct xfs_inode *target_ip, unsigned int flags);
0492 
0493 void        xfs_ilock(xfs_inode_t *, uint);
0494 int     xfs_ilock_nowait(xfs_inode_t *, uint);
0495 void        xfs_iunlock(xfs_inode_t *, uint);
0496 void        xfs_ilock_demote(xfs_inode_t *, uint);
0497 bool        xfs_isilocked(struct xfs_inode *, uint);
0498 uint        xfs_ilock_data_map_shared(struct xfs_inode *);
0499 uint        xfs_ilock_attr_map_shared(struct xfs_inode *);
0500 
0501 uint        xfs_ip2xflags(struct xfs_inode *);
0502 int     xfs_ifree(struct xfs_trans *, struct xfs_inode *);
0503 int     xfs_itruncate_extents_flags(struct xfs_trans **,
0504                 struct xfs_inode *, int, xfs_fsize_t, int);
0505 void        xfs_iext_realloc(xfs_inode_t *, int, int);
0506 
0507 int     xfs_log_force_inode(struct xfs_inode *ip);
0508 void        xfs_iunpin_wait(xfs_inode_t *);
0509 #define xfs_ipincount(ip)   ((unsigned int) atomic_read(&ip->i_pincount))
0510 
0511 int     xfs_iflush_cluster(struct xfs_buf *);
0512 void        xfs_lock_two_inodes(struct xfs_inode *ip0, uint ip0_mode,
0513                 struct xfs_inode *ip1, uint ip1_mode);
0514 
0515 xfs_extlen_t    xfs_get_extsz_hint(struct xfs_inode *ip);
0516 xfs_extlen_t    xfs_get_cowextsz_hint(struct xfs_inode *ip);
0517 
0518 int xfs_init_new_inode(struct user_namespace *mnt_userns, struct xfs_trans *tp,
0519         struct xfs_inode *pip, xfs_ino_t ino, umode_t mode,
0520         xfs_nlink_t nlink, dev_t rdev, prid_t prid, bool init_xattrs,
0521         struct xfs_inode **ipp);
0522 
0523 static inline int
0524 xfs_itruncate_extents(
0525     struct xfs_trans    **tpp,
0526     struct xfs_inode    *ip,
0527     int         whichfork,
0528     xfs_fsize_t     new_size)
0529 {
0530     return xfs_itruncate_extents_flags(tpp, ip, whichfork, new_size, 0);
0531 }
0532 
0533 /* from xfs_file.c */
0534 int xfs_break_dax_layouts(struct inode *inode, bool *retry);
0535 int xfs_break_layouts(struct inode *inode, uint *iolock,
0536         enum layout_break_reason reason);
0537 
0538 /* from xfs_iops.c */
0539 extern void xfs_setup_inode(struct xfs_inode *ip);
0540 extern void xfs_setup_iops(struct xfs_inode *ip);
0541 extern void xfs_diflags_to_iflags(struct xfs_inode *ip, bool init);
0542 
0543 /*
0544  * When setting up a newly allocated inode, we need to call
0545  * xfs_finish_inode_setup() once the inode is fully instantiated at
0546  * the VFS level to prevent the rest of the world seeing the inode
0547  * before we've completed instantiation. Otherwise we can do it
0548  * the moment the inode lookup is complete.
0549  */
0550 static inline void xfs_finish_inode_setup(struct xfs_inode *ip)
0551 {
0552     xfs_iflags_clear(ip, XFS_INEW);
0553     barrier();
0554     unlock_new_inode(VFS_I(ip));
0555 }
0556 
0557 static inline void xfs_setup_existing_inode(struct xfs_inode *ip)
0558 {
0559     xfs_setup_inode(ip);
0560     xfs_setup_iops(ip);
0561     xfs_finish_inode_setup(ip);
0562 }
0563 
0564 void xfs_irele(struct xfs_inode *ip);
0565 
0566 extern struct kmem_cache    *xfs_inode_cache;
0567 
0568 /* The default CoW extent size hint. */
0569 #define XFS_DEFAULT_COWEXTSZ_HINT 32
0570 
0571 bool xfs_inode_needs_inactive(struct xfs_inode *ip);
0572 
0573 void xfs_end_io(struct work_struct *work);
0574 
0575 int xfs_ilock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2);
0576 void xfs_iunlock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2);
0577 
0578 #endif  /* __XFS_INODE_H__ */