xref: /openbmc/linux/fs/xfs/xfs_inode.h (revision d37cf9b63113f13d742713881ce691fc615d8b3b)
10b61f8a4SDave Chinner // SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds /*
37b718769SNathan Scott  * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
47b718769SNathan Scott  * All Rights Reserved.
51da177e4SLinus Torvalds  */
61da177e4SLinus Torvalds #ifndef	__XFS_INODE_H__
71da177e4SLinus Torvalds #define	__XFS_INODE_H__
81da177e4SLinus Torvalds 
91fd7115eSDave Chinner #include "xfs_inode_buf.h"
105c4d97d0SDave Chinner #include "xfs_inode_fork.h"
111da177e4SLinus Torvalds 
121da177e4SLinus Torvalds /*
131fd7115eSDave Chinner  * Kernel only inode definitions
1492bfc6e7SChristoph Hellwig  */
151fd7115eSDave Chinner struct xfs_dinode;
161fd7115eSDave Chinner struct xfs_inode;
17847fff5cSBarry Naujok struct xfs_buf;
18847fff5cSBarry Naujok struct xfs_bmbt_irec;
19847fff5cSBarry Naujok struct xfs_inode_log_item;
20847fff5cSBarry Naujok struct xfs_mount;
21847fff5cSBarry Naujok struct xfs_trans;
22847fff5cSBarry Naujok struct xfs_dquot;
23847fff5cSBarry Naujok 
241da177e4SLinus Torvalds typedef struct xfs_inode {
251da177e4SLinus Torvalds 	/* Inode linking and identification information. */
261da177e4SLinus Torvalds 	struct xfs_mount	*i_mount;	/* fs mount struct ptr */
271da177e4SLinus Torvalds 	struct xfs_dquot	*i_udquot;	/* user dquot */
281da177e4SLinus Torvalds 	struct xfs_dquot	*i_gdquot;	/* group dquot */
2992f8ff73SChandra Seetharaman 	struct xfs_dquot	*i_pdquot;	/* project dquot */
301da177e4SLinus Torvalds 
311da177e4SLinus Torvalds 	/* Inode location stuff */
321da177e4SLinus Torvalds 	xfs_ino_t		i_ino;		/* inode number (agno/agino)*/
3392bfc6e7SChristoph Hellwig 	struct xfs_imap		i_imap;		/* location for xfs_imap() */
341da177e4SLinus Torvalds 
351da177e4SLinus Torvalds 	/* Extent information. */
363ba738dfSChristoph Hellwig 	struct xfs_ifork	*i_cowfp;	/* copy on write extents */
373ba738dfSChristoph Hellwig 	struct xfs_ifork	i_df;		/* data fork */
382ed5b09bSDarrick J. Wong 	struct xfs_ifork	i_af;		/* attribute fork */
391da177e4SLinus Torvalds 
401da177e4SLinus Torvalds 	/* Transaction and locking information. */
411da177e4SLinus Torvalds 	struct xfs_inode_log_item *i_itemp;	/* logging information */
421da177e4SLinus Torvalds 	mrlock_t		i_lock;		/* inode lock */
431da177e4SLinus Torvalds 	atomic_t		i_pincount;	/* inode pin count */
44ab23a776SDave Chinner 	struct llist_node	i_gclist;	/* deferred inactivation list */
456772c1f1SDarrick J. Wong 
466772c1f1SDarrick J. Wong 	/*
476772c1f1SDarrick J. Wong 	 * Bitsets of inode metadata that have been checked and/or are sick.
486772c1f1SDarrick J. Wong 	 * Callers must hold i_flags_lock before accessing this field.
496772c1f1SDarrick J. Wong 	 */
506772c1f1SDarrick J. Wong 	uint16_t		i_checked;
516772c1f1SDarrick J. Wong 	uint16_t		i_sick;
526772c1f1SDarrick J. Wong 
53f273ab84SDavid Chinner 	spinlock_t		i_flags_lock;	/* inode i_flags lock */
541da177e4SLinus Torvalds 	/* Miscellaneous state. */
5549e4c70eSChristoph Hellwig 	unsigned long		i_flags;	/* see defined flags below */
56394aafdcSDarrick J. Wong 	uint64_t		i_delayed_blks;	/* count of delay alloc blks */
5713d2c10bSChristoph Hellwig 	xfs_fsize_t		i_disk_size;	/* number of bytes in file */
586e73a545SChristoph Hellwig 	xfs_rfsblock_t		i_nblocks;	/* # of direct & btree blocks */
59ceaf603cSChristoph Hellwig 	prid_t			i_projid;	/* owner's project id */
60031474c2SChristoph Hellwig 	xfs_extlen_t		i_extsize;	/* basic/minimum extent size */
61ee7b83fdSChristoph Hellwig 	/* cowextsize is only used for v3 inodes, flushiter for v1/2 */
62ee7b83fdSChristoph Hellwig 	union {
63b33ce57dSChristoph Hellwig 		xfs_extlen_t	i_cowextsize;	/* basic cow extent size */
64965e0a1aSChristoph Hellwig 		uint16_t	i_flushiter;	/* incremented on flush */
65ee7b83fdSChristoph Hellwig 	};
667821ea30SChristoph Hellwig 	uint8_t			i_forkoff;	/* attr fork offset >> 3 */
67db07349dSChristoph Hellwig 	uint16_t		i_diflags;	/* XFS_DIFLAG_... */
683e09ab8fSChristoph Hellwig 	uint64_t		i_diflags2;	/* XFS_DIFLAG2_... */
69e98d5e88SChristoph Hellwig 	struct timespec64	i_crtime;	/* time created */
701da177e4SLinus Torvalds 
71f12b9668SDarrick J. Wong 	/*
72f12b9668SDarrick J. Wong 	 * Unlinked list pointers.  These point to the next and previous inodes
73f12b9668SDarrick J. Wong 	 * in the AGI unlinked bucket list, respectively.  These fields can
74f12b9668SDarrick J. Wong 	 * only be updated with the AGI locked.
75f12b9668SDarrick J. Wong 	 *
76f12b9668SDarrick J. Wong 	 * i_next_unlinked caches di_next_unlinked.
77f12b9668SDarrick J. Wong 	 */
784fcc94d6SDave Chinner 	xfs_agino_t		i_next_unlinked;
79f12b9668SDarrick J. Wong 
80f12b9668SDarrick J. Wong 	/*
81f12b9668SDarrick J. Wong 	 * If the inode is not on an unlinked list, this field is zero.  If the
82f12b9668SDarrick J. Wong 	 * inode is the first element in an unlinked list, this field is
83f12b9668SDarrick J. Wong 	 * NULLAGINO.  Otherwise, i_prev_unlinked points to the previous inode
84f12b9668SDarrick J. Wong 	 * in the unlinked list.
85f12b9668SDarrick J. Wong 	 */
862fd26cc0SDave Chinner 	xfs_agino_t		i_prev_unlinked;
874fcc94d6SDave Chinner 
88bf904248SDavid Chinner 	/* VFS inode */
89bf904248SDavid Chinner 	struct inode		i_vnode;	/* embedded VFS inode */
90cb357bf3SDarrick J. Wong 
91cb357bf3SDarrick J. Wong 	/* pending io completions */
92cb357bf3SDarrick J. Wong 	spinlock_t		i_ioend_lock;
93cb357bf3SDarrick J. Wong 	struct work_struct	i_ioend_work;
94cb357bf3SDarrick J. Wong 	struct list_head	i_ioend_list;
951da177e4SLinus Torvalds } xfs_inode_t;
961da177e4SLinus Torvalds 
xfs_inode_on_unlinked_list(const struct xfs_inode * ip)97f12b9668SDarrick J. Wong static inline bool xfs_inode_on_unlinked_list(const struct xfs_inode *ip)
98f12b9668SDarrick J. Wong {
99f12b9668SDarrick J. Wong 	return ip->i_prev_unlinked != 0;
100f12b9668SDarrick J. Wong }
101f12b9668SDarrick J. Wong 
xfs_inode_has_attr_fork(struct xfs_inode * ip)102932b42c6SDarrick J. Wong static inline bool xfs_inode_has_attr_fork(struct xfs_inode *ip)
103932b42c6SDarrick J. Wong {
104932b42c6SDarrick J. Wong 	return ip->i_forkoff > 0;
105932b42c6SDarrick J. Wong }
106932b42c6SDarrick J. Wong 
107732436efSDarrick J. Wong static inline struct xfs_ifork *
xfs_ifork_ptr(struct xfs_inode * ip,int whichfork)108732436efSDarrick J. Wong xfs_ifork_ptr(
109732436efSDarrick J. Wong 	struct xfs_inode	*ip,
110732436efSDarrick J. Wong 	int			whichfork)
111732436efSDarrick J. Wong {
112732436efSDarrick J. Wong 	switch (whichfork) {
113732436efSDarrick J. Wong 	case XFS_DATA_FORK:
114732436efSDarrick J. Wong 		return &ip->i_df;
115732436efSDarrick J. Wong 	case XFS_ATTR_FORK:
116932b42c6SDarrick J. Wong 		if (!xfs_inode_has_attr_fork(ip))
1172ed5b09bSDarrick J. Wong 			return NULL;
1182ed5b09bSDarrick J. Wong 		return &ip->i_af;
119732436efSDarrick J. Wong 	case XFS_COW_FORK:
120732436efSDarrick J. Wong 		return ip->i_cowfp;
121732436efSDarrick J. Wong 	default:
122732436efSDarrick J. Wong 		ASSERT(0);
123732436efSDarrick J. Wong 		return NULL;
124732436efSDarrick J. Wong 	}
125732436efSDarrick J. Wong }
126732436efSDarrick J. Wong 
xfs_inode_fork_boff(struct xfs_inode * ip)127c01147d9SDarrick J. Wong static inline unsigned int xfs_inode_fork_boff(struct xfs_inode *ip)
128c01147d9SDarrick J. Wong {
129c01147d9SDarrick J. Wong 	return ip->i_forkoff << 3;
130c01147d9SDarrick J. Wong }
131c01147d9SDarrick J. Wong 
xfs_inode_data_fork_size(struct xfs_inode * ip)132c01147d9SDarrick J. Wong static inline unsigned int xfs_inode_data_fork_size(struct xfs_inode *ip)
133c01147d9SDarrick J. Wong {
134c01147d9SDarrick J. Wong 	if (xfs_inode_has_attr_fork(ip))
135c01147d9SDarrick J. Wong 		return xfs_inode_fork_boff(ip);
136c01147d9SDarrick J. Wong 
137c01147d9SDarrick J. Wong 	return XFS_LITINO(ip->i_mount);
138c01147d9SDarrick J. Wong }
139c01147d9SDarrick J. Wong 
xfs_inode_attr_fork_size(struct xfs_inode * ip)140c01147d9SDarrick J. Wong static inline unsigned int xfs_inode_attr_fork_size(struct xfs_inode *ip)
141c01147d9SDarrick J. Wong {
142c01147d9SDarrick J. Wong 	if (xfs_inode_has_attr_fork(ip))
143c01147d9SDarrick J. Wong 		return XFS_LITINO(ip->i_mount) - xfs_inode_fork_boff(ip);
144c01147d9SDarrick J. Wong 	return 0;
145c01147d9SDarrick J. Wong }
146c01147d9SDarrick J. Wong 
147c01147d9SDarrick J. Wong static inline unsigned int
xfs_inode_fork_size(struct xfs_inode * ip,int whichfork)148c01147d9SDarrick J. Wong xfs_inode_fork_size(
149c01147d9SDarrick J. Wong 	struct xfs_inode	*ip,
150c01147d9SDarrick J. Wong 	int			whichfork)
151c01147d9SDarrick J. Wong {
152c01147d9SDarrick J. Wong 	switch (whichfork) {
153c01147d9SDarrick J. Wong 	case XFS_DATA_FORK:
154c01147d9SDarrick J. Wong 		return xfs_inode_data_fork_size(ip);
155c01147d9SDarrick J. Wong 	case XFS_ATTR_FORK:
156c01147d9SDarrick J. Wong 		return xfs_inode_attr_fork_size(ip);
157c01147d9SDarrick J. Wong 	default:
158c01147d9SDarrick J. Wong 		return 0;
159c01147d9SDarrick J. Wong 	}
160c01147d9SDarrick J. Wong }
161c01147d9SDarrick J. Wong 
16201651646SDavid Chinner /* Convert from vfs inode to xfs inode */
XFS_I(struct inode * inode)16301651646SDavid Chinner static inline struct xfs_inode *XFS_I(struct inode *inode)
16401651646SDavid Chinner {
165bf904248SDavid Chinner 	return container_of(inode, struct xfs_inode, i_vnode);
16601651646SDavid Chinner }
16701651646SDavid Chinner 
16801651646SDavid Chinner /* convert from xfs inode to vfs inode */
VFS_I(struct xfs_inode * ip)16901651646SDavid Chinner static inline struct inode *VFS_I(struct xfs_inode *ip)
17001651646SDavid Chinner {
171bf904248SDavid Chinner 	return &ip->i_vnode;
17201651646SDavid Chinner }
17301651646SDavid Chinner 
1747a18c386SDavid Chinner /*
175ce7ae151SChristoph Hellwig  * For regular files we only update the on-disk filesize when actually
176ce7ae151SChristoph Hellwig  * writing data back to disk.  Until then only the copy in the VFS inode
177ce7ae151SChristoph Hellwig  * is uptodate.
178ce7ae151SChristoph Hellwig  */
XFS_ISIZE(struct xfs_inode * ip)179ce7ae151SChristoph Hellwig static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
180ce7ae151SChristoph Hellwig {
181c19b3b05SDave Chinner 	if (S_ISREG(VFS_I(ip)->i_mode))
182ce7ae151SChristoph Hellwig 		return i_size_read(VFS_I(ip));
18313d2c10bSChristoph Hellwig 	return ip->i_disk_size;
184ce7ae151SChristoph Hellwig }
185ce7ae151SChristoph Hellwig 
186ce7ae151SChristoph Hellwig /*
1876923e686SChristoph Hellwig  * If this I/O goes past the on-disk inode size update it unless it would
1886923e686SChristoph Hellwig  * be past the current in-core inode size.
1896923e686SChristoph Hellwig  */
1906923e686SChristoph Hellwig static inline xfs_fsize_t
xfs_new_eof(struct xfs_inode * ip,xfs_fsize_t new_size)1916923e686SChristoph Hellwig xfs_new_eof(struct xfs_inode *ip, xfs_fsize_t new_size)
1926923e686SChristoph Hellwig {
1936923e686SChristoph Hellwig 	xfs_fsize_t i_size = i_size_read(VFS_I(ip));
1946923e686SChristoph Hellwig 
195ce57bcf6SBrian Foster 	if (new_size > i_size || new_size < 0)
1966923e686SChristoph Hellwig 		new_size = i_size;
19713d2c10bSChristoph Hellwig 	return new_size > ip->i_disk_size ? new_size : 0;
1986923e686SChristoph Hellwig }
1996923e686SChristoph Hellwig 
2006923e686SChristoph Hellwig /*
2017a18c386SDavid Chinner  * i_flags helper functions
2027a18c386SDavid Chinner  */
2037a18c386SDavid Chinner static inline void
__xfs_iflags_set(xfs_inode_t * ip,unsigned short flags)2047a18c386SDavid Chinner __xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
2057a18c386SDavid Chinner {
2067a18c386SDavid Chinner 	ip->i_flags |= flags;
2077a18c386SDavid Chinner }
2087a18c386SDavid Chinner 
2097a18c386SDavid Chinner static inline void
xfs_iflags_set(xfs_inode_t * ip,unsigned short flags)2107a18c386SDavid Chinner xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
2117a18c386SDavid Chinner {
2127a18c386SDavid Chinner 	spin_lock(&ip->i_flags_lock);
2137a18c386SDavid Chinner 	__xfs_iflags_set(ip, flags);
2147a18c386SDavid Chinner 	spin_unlock(&ip->i_flags_lock);
2157a18c386SDavid Chinner }
2167a18c386SDavid Chinner 
2177a18c386SDavid Chinner static inline void
xfs_iflags_clear(xfs_inode_t * ip,unsigned short flags)2187a18c386SDavid Chinner xfs_iflags_clear(xfs_inode_t *ip, unsigned short flags)
2197a18c386SDavid Chinner {
2207a18c386SDavid Chinner 	spin_lock(&ip->i_flags_lock);
2217a18c386SDavid Chinner 	ip->i_flags &= ~flags;
2227a18c386SDavid Chinner 	spin_unlock(&ip->i_flags_lock);
2237a18c386SDavid Chinner }
2247a18c386SDavid Chinner 
2257a18c386SDavid Chinner static inline int
__xfs_iflags_test(xfs_inode_t * ip,unsigned short flags)2267a18c386SDavid Chinner __xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
2277a18c386SDavid Chinner {
2287a18c386SDavid Chinner 	return (ip->i_flags & flags);
2297a18c386SDavid Chinner }
2307a18c386SDavid Chinner 
2317a18c386SDavid Chinner static inline int
xfs_iflags_test(xfs_inode_t * ip,unsigned short flags)2327a18c386SDavid Chinner xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
2337a18c386SDavid Chinner {
2347a18c386SDavid Chinner 	int ret;
2357a18c386SDavid Chinner 	spin_lock(&ip->i_flags_lock);
2367a18c386SDavid Chinner 	ret = __xfs_iflags_test(ip, flags);
2377a18c386SDavid Chinner 	spin_unlock(&ip->i_flags_lock);
2387a18c386SDavid Chinner 	return ret;
2397a18c386SDavid Chinner }
24009262b43SChristoph Hellwig 
24109262b43SChristoph Hellwig static inline int
xfs_iflags_test_and_clear(xfs_inode_t * ip,unsigned short flags)24209262b43SChristoph Hellwig xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
24309262b43SChristoph Hellwig {
24409262b43SChristoph Hellwig 	int ret;
24509262b43SChristoph Hellwig 
24609262b43SChristoph Hellwig 	spin_lock(&ip->i_flags_lock);
24709262b43SChristoph Hellwig 	ret = ip->i_flags & flags;
24809262b43SChristoph Hellwig 	if (ret)
24909262b43SChristoph Hellwig 		ip->i_flags &= ~flags;
25009262b43SChristoph Hellwig 	spin_unlock(&ip->i_flags_lock);
25109262b43SChristoph Hellwig 	return ret;
25209262b43SChristoph Hellwig }
2531da177e4SLinus Torvalds 
254474fce06SChristoph Hellwig static inline int
xfs_iflags_test_and_set(xfs_inode_t * ip,unsigned short flags)255474fce06SChristoph Hellwig xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned short flags)
256474fce06SChristoph Hellwig {
257474fce06SChristoph Hellwig 	int ret;
258474fce06SChristoph Hellwig 
259474fce06SChristoph Hellwig 	spin_lock(&ip->i_flags_lock);
260474fce06SChristoph Hellwig 	ret = ip->i_flags & flags;
261474fce06SChristoph Hellwig 	if (!ret)
262474fce06SChristoph Hellwig 		ip->i_flags |= flags;
263474fce06SChristoph Hellwig 	spin_unlock(&ip->i_flags_lock);
264474fce06SChristoph Hellwig 	return ret;
265474fce06SChristoph Hellwig }
266474fce06SChristoph Hellwig 
267163467d3SZhi Yong Wu static inline prid_t
xfs_get_initial_prid(struct xfs_inode * dp)268163467d3SZhi Yong Wu xfs_get_initial_prid(struct xfs_inode *dp)
269163467d3SZhi Yong Wu {
270db07349dSChristoph Hellwig 	if (dp->i_diflags & XFS_DIFLAG_PROJINHERIT)
271ceaf603cSChristoph Hellwig 		return dp->i_projid;
272163467d3SZhi Yong Wu 
273163467d3SZhi Yong Wu 	return XFS_PROJID_DEFAULT;
274163467d3SZhi Yong Wu }
275163467d3SZhi Yong Wu 
xfs_is_reflink_inode(struct xfs_inode * ip)27646eeb521SDarrick J. Wong static inline bool xfs_is_reflink_inode(struct xfs_inode *ip)
27746eeb521SDarrick J. Wong {
2783e09ab8fSChristoph Hellwig 	return ip->i_diflags2 & XFS_DIFLAG2_REFLINK;
27946eeb521SDarrick J. Wong }
28046eeb521SDarrick J. Wong 
xfs_is_metadata_inode(struct xfs_inode * ip)281383e32b0SDarrick J. Wong static inline bool xfs_is_metadata_inode(struct xfs_inode *ip)
282383e32b0SDarrick J. Wong {
283383e32b0SDarrick J. Wong 	struct xfs_mount	*mp = ip->i_mount;
284383e32b0SDarrick J. Wong 
285383e32b0SDarrick J. Wong 	return ip == mp->m_rbmip || ip == mp->m_rsumip ||
286383e32b0SDarrick J. Wong 		xfs_is_quota_inode(&mp->m_sb, ip->i_ino);
287383e32b0SDarrick J. Wong }
288383e32b0SDarrick J. Wong 
xfs_inode_has_filedata(const struct xfs_inode * ip)289*b887d2feSOjaswin Mujoo static inline bool xfs_inode_has_filedata(const struct xfs_inode *ip)
290*b887d2feSOjaswin Mujoo {
291*b887d2feSOjaswin Mujoo 	return ip->i_df.if_nextents > 0 || ip->i_delayed_blks > 0;
292*b887d2feSOjaswin Mujoo }
293*b887d2feSOjaswin Mujoo 
2946743099cSArkadiusz Mi?kiewicz /*
29551d62690SChristoph Hellwig  * Check if an inode has any data in the COW fork.  This might be often false
29651d62690SChristoph Hellwig  * even for inodes with the reflink flag when there is no pending COW operation.
29751d62690SChristoph Hellwig  */
xfs_inode_has_cow_data(struct xfs_inode * ip)29851d62690SChristoph Hellwig static inline bool xfs_inode_has_cow_data(struct xfs_inode *ip)
29951d62690SChristoph Hellwig {
30051d62690SChristoph Hellwig 	return ip->i_cowfp && ip->i_cowfp->if_bytes;
30151d62690SChristoph Hellwig }
30251d62690SChristoph Hellwig 
xfs_inode_has_bigtime(struct xfs_inode * ip)303f93e5436SDarrick J. Wong static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
304f93e5436SDarrick J. Wong {
3053e09ab8fSChristoph Hellwig 	return ip->i_diflags2 & XFS_DIFLAG2_BIGTIME;
306f93e5436SDarrick J. Wong }
307f93e5436SDarrick J. Wong 
xfs_inode_has_large_extent_counts(struct xfs_inode * ip)3089b7d16e3SChandan Babu R static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip)
3099b7d16e3SChandan Babu R {
3109b7d16e3SChandan Babu R 	return ip->i_diflags2 & XFS_DIFLAG2_NREXT64;
3119b7d16e3SChandan Babu R }
3129b7d16e3SChandan Babu R 
31351d62690SChristoph Hellwig /*
31430fa529eSChristoph Hellwig  * Return the buftarg used for data allocations on a given inode.
31530fa529eSChristoph Hellwig  */
31630fa529eSChristoph Hellwig #define xfs_inode_buftarg(ip) \
31730fa529eSChristoph Hellwig 	(XFS_IS_REALTIME_INODE(ip) ? \
31830fa529eSChristoph Hellwig 		(ip)->i_mount->m_rtdev_targp : (ip)->i_mount->m_ddev_targp)
31930fa529eSChristoph Hellwig 
32030fa529eSChristoph Hellwig /*
3211da177e4SLinus Torvalds  * In-core inode flags.
3221da177e4SLinus Torvalds  */
323474fce06SChristoph Hellwig #define XFS_IRECLAIM		(1 << 0) /* started reclaiming this inode */
324474fce06SChristoph Hellwig #define XFS_ISTALE		(1 << 1) /* inode has been staled */
325474fce06SChristoph Hellwig #define XFS_IRECLAIMABLE	(1 << 2) /* inode can be reclaimed */
3261090427bSChristoph Hellwig #define XFS_INEW		(1 << 3) /* inode has just been allocated */
3279b3beb02SChristoph Hellwig #define XFS_IPRESERVE_DM_FIELDS	(1 << 4) /* has legacy DMAPI fields set */
328474fce06SChristoph Hellwig #define XFS_ITRUNCATED		(1 << 5) /* truncated down so flush-on-close */
329474fce06SChristoph Hellwig #define XFS_IDIRTY_RELEASE	(1 << 6) /* dirty release already seen */
330718ecc50SDave Chinner #define XFS_IFLUSHING		(1 << 7) /* inode is being flushed */
331f392e631SChristoph Hellwig #define __XFS_IPINNED_BIT	8	 /* wakeup key for zero pin count */
332f392e631SChristoph Hellwig #define XFS_IPINNED		(1 << __XFS_IPINNED_BIT)
333dae2f8edSIra Weiny #define XFS_IEOFBLOCKS		(1 << 9) /* has the preallocblocks tag set */
334ab23a776SDave Chinner #define XFS_NEED_INACTIVE	(1 << 10) /* see XFS_INACTIVATING below */
33517c12bcdSDarrick J. Wong /*
33617c12bcdSDarrick J. Wong  * If this unlinked inode is in the middle of recovery, don't let drop_inode
33717c12bcdSDarrick J. Wong  * truncate and free the inode.  This can happen if we iget the inode during
33817c12bcdSDarrick J. Wong  * log recovery to replay a bmap operation on the inode.
33917c12bcdSDarrick J. Wong  */
34017c12bcdSDarrick J. Wong #define XFS_IRECOVERY		(1 << 11)
34191aae6beSDarrick J. Wong #define XFS_ICOWBLOCKS		(1 << 12)/* has the cowblocks tag set */
3421da177e4SLinus Torvalds 
3431da177e4SLinus Torvalds /*
344ab23a776SDave Chinner  * If we need to update on-disk metadata before this IRECLAIMABLE inode can be
345ab23a776SDave Chinner  * freed, then NEED_INACTIVE will be set.  Once we start the updates, the
346ab23a776SDave Chinner  * INACTIVATING bit will be set to keep iget away from this inode.  After the
347ab23a776SDave Chinner  * inactivation completes, both flags will be cleared and the inode is a
348ab23a776SDave Chinner  * plain old IRECLAIMABLE inode.
349ab23a776SDave Chinner  */
350ab23a776SDave Chinner #define XFS_INACTIVATING	(1 << 13)
351ab23a776SDave Chinner 
35249813a21SDarrick J. Wong /* Quotacheck is running but inode has not been added to quota counts. */
35349813a21SDarrick J. Wong #define XFS_IQUOTAUNCHECKED	(1 << 14)
35449813a21SDarrick J. Wong 
355d7d84772SCatherine Hoang /*
356d7d84772SCatherine Hoang  * Remap in progress. Callers that wish to update file data while
357d7d84772SCatherine Hoang  * holding a shared IOLOCK or MMAPLOCK must drop the lock and retake
358d7d84772SCatherine Hoang  * the lock in exclusive mode. Relocking the file will block until
359d7d84772SCatherine Hoang  * IREMAPPING is cleared.
360d7d84772SCatherine Hoang  */
361d7d84772SCatherine Hoang #define XFS_IREMAPPING		(1U << 15)
362d7d84772SCatherine Hoang 
363ab23a776SDave Chinner /* All inode state flags related to inode reclaim. */
364ab23a776SDave Chinner #define XFS_ALL_IRECLAIM_FLAGS	(XFS_IRECLAIMABLE | \
365ab23a776SDave Chinner 				 XFS_IRECLAIM | \
366ab23a776SDave Chinner 				 XFS_NEED_INACTIVE | \
367ab23a776SDave Chinner 				 XFS_INACTIVATING)
368ab23a776SDave Chinner 
369ab23a776SDave Chinner /*
370778e24bbSDave Chinner  * Per-lifetime flags need to be reset when re-using a reclaimable inode during
3715132ba8fSDave Chinner  * inode lookup. This prevents unintended behaviour on the new inode from
372778e24bbSDave Chinner  * ocurring.
373778e24bbSDave Chinner  */
374778e24bbSDave Chinner #define XFS_IRECLAIM_RESET_FLAGS	\
375778e24bbSDave Chinner 	(XFS_IRECLAIMABLE | XFS_IRECLAIM | \
376ab23a776SDave Chinner 	 XFS_IDIRTY_RELEASE | XFS_ITRUNCATED | XFS_NEED_INACTIVE | \
37749813a21SDarrick J. Wong 	 XFS_INACTIVATING | XFS_IQUOTAUNCHECKED)
378778e24bbSDave Chinner 
379778e24bbSDave Chinner /*
3801da177e4SLinus Torvalds  * Flags for inode locking.
381f7c66ce3SLachlan McIlroy  * Bit ranges:	1<<1  - 1<<16-1 -- iolock/ilock modes (bitfield)
382f7c66ce3SLachlan McIlroy  *		1<<16 - 1<<32-1 -- lockdep annotation (integers)
3831da177e4SLinus Torvalds  */
384a1033753SDave Chinner #define	XFS_IOLOCK_EXCL		(1u << 0)
385a1033753SDave Chinner #define	XFS_IOLOCK_SHARED	(1u << 1)
386a1033753SDave Chinner #define	XFS_ILOCK_EXCL		(1u << 2)
387a1033753SDave Chinner #define	XFS_ILOCK_SHARED	(1u << 3)
388a1033753SDave Chinner #define	XFS_MMAPLOCK_EXCL	(1u << 4)
389a1033753SDave Chinner #define	XFS_MMAPLOCK_SHARED	(1u << 5)
3901da177e4SLinus Torvalds 
391f7c66ce3SLachlan McIlroy #define XFS_LOCK_MASK		(XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \
392653c60b6SDave Chinner 				| XFS_ILOCK_EXCL | XFS_ILOCK_SHARED \
393653c60b6SDave Chinner 				| XFS_MMAPLOCK_EXCL | XFS_MMAPLOCK_SHARED)
394f7c66ce3SLachlan McIlroy 
3950b1b213fSChristoph Hellwig #define XFS_LOCK_FLAGS \
3960b1b213fSChristoph Hellwig 	{ XFS_IOLOCK_EXCL,	"IOLOCK_EXCL" }, \
3970b1b213fSChristoph Hellwig 	{ XFS_IOLOCK_SHARED,	"IOLOCK_SHARED" }, \
3980b1b213fSChristoph Hellwig 	{ XFS_ILOCK_EXCL,	"ILOCK_EXCL" }, \
399653c60b6SDave Chinner 	{ XFS_ILOCK_SHARED,	"ILOCK_SHARED" }, \
400653c60b6SDave Chinner 	{ XFS_MMAPLOCK_EXCL,	"MMAPLOCK_EXCL" }, \
401653c60b6SDave Chinner 	{ XFS_MMAPLOCK_SHARED,	"MMAPLOCK_SHARED" }
4020b1b213fSChristoph Hellwig 
4030b1b213fSChristoph Hellwig 
404f7c66ce3SLachlan McIlroy /*
405f7c66ce3SLachlan McIlroy  * Flags for lockdep annotations.
406f7c66ce3SLachlan McIlroy  *
4079681153bSChristoph Hellwig  * XFS_LOCK_PARENT - for directory operations that require locking a
4080952c818SDave Chinner  * parent directory inode and a child entry inode. IOLOCK requires nesting,
4090952c818SDave Chinner  * MMAPLOCK does not support this class, ILOCK requires a single subclass
4100952c818SDave Chinner  * to differentiate parent from child.
4119681153bSChristoph Hellwig  *
4129681153bSChristoph Hellwig  * XFS_LOCK_RTBITMAP/XFS_LOCK_RTSUM - the realtime device bitmap and summary
4139681153bSChristoph Hellwig  * inodes do not participate in the normal lock order, and thus have their
4149681153bSChristoph Hellwig  * own subclasses.
415f7c66ce3SLachlan McIlroy  *
4160f1145ccSDavid Chinner  * XFS_LOCK_INUMORDER - for locking several inodes at the some time
417f7c66ce3SLachlan McIlroy  * with xfs_lock_inodes().  This flag is used as the starting subclass
418f7c66ce3SLachlan McIlroy  * and each subsequent lock acquired will increment the subclass by one.
4190952c818SDave Chinner  * However, MAX_LOCKDEP_SUBCLASSES == 8, which means we are greatly
4200952c818SDave Chinner  * limited to the subclasses we can represent via nesting. We need at least
4210952c818SDave Chinner  * 5 inodes nest depth for the ILOCK through rename, and we also have to support
4220952c818SDave Chinner  * XFS_ILOCK_PARENT, which gives 6 subclasses. Then we have XFS_ILOCK_RTBITMAP
4230952c818SDave Chinner  * and XFS_ILOCK_RTSUM, which are another 2 unique subclasses, so that's all
4240952c818SDave Chinner  * 8 subclasses supported by lockdep.
4250952c818SDave Chinner  *
4260952c818SDave Chinner  * This also means we have to number the sub-classes in the lowest bits of
4270952c818SDave Chinner  * the mask we keep, and we have to ensure we never exceed 3 bits of lockdep
4280952c818SDave Chinner  * mask and we can't use bit-masking to build the subclasses. What a mess.
4290952c818SDave Chinner  *
4300952c818SDave Chinner  * Bit layout:
4310952c818SDave Chinner  *
4320952c818SDave Chinner  * Bit		Lock Region
4330952c818SDave Chinner  * 16-19	XFS_IOLOCK_SHIFT dependencies
4340952c818SDave Chinner  * 20-23	XFS_MMAPLOCK_SHIFT dependencies
4350952c818SDave Chinner  * 24-31	XFS_ILOCK_SHIFT dependencies
4360952c818SDave Chinner  *
4370952c818SDave Chinner  * IOLOCK values
4380952c818SDave Chinner  *
4390952c818SDave Chinner  * 0-3		subclass value
44065523218SChristoph Hellwig  * 4-7		unused
4410952c818SDave Chinner  *
4420952c818SDave Chinner  * MMAPLOCK values
4430952c818SDave Chinner  *
4440952c818SDave Chinner  * 0-3		subclass value
4450952c818SDave Chinner  * 4-7		unused
4460952c818SDave Chinner  *
4470952c818SDave Chinner  * ILOCK values
4480952c818SDave Chinner  * 0-4		subclass values
4490952c818SDave Chinner  * 5		PARENT subclass (not nestable)
4500952c818SDave Chinner  * 6		RTBITMAP subclass (not nestable)
4510952c818SDave Chinner  * 7		RTSUM subclass (not nestable)
4520952c818SDave Chinner  *
453f7c66ce3SLachlan McIlroy  */
454f7c66ce3SLachlan McIlroy #define XFS_IOLOCK_SHIFT		16
45565523218SChristoph Hellwig #define XFS_IOLOCK_MAX_SUBCLASS		3
456a1033753SDave Chinner #define XFS_IOLOCK_DEP_MASK		0x000f0000u
457f7c66ce3SLachlan McIlroy 
458653c60b6SDave Chinner #define XFS_MMAPLOCK_SHIFT		20
4590952c818SDave Chinner #define XFS_MMAPLOCK_NUMORDER		0
4600952c818SDave Chinner #define XFS_MMAPLOCK_MAX_SUBCLASS	3
461a1033753SDave Chinner #define XFS_MMAPLOCK_DEP_MASK		0x00f00000u
462653c60b6SDave Chinner 
463f7c66ce3SLachlan McIlroy #define XFS_ILOCK_SHIFT			24
464a1033753SDave Chinner #define XFS_ILOCK_PARENT_VAL		5u
4650952c818SDave Chinner #define XFS_ILOCK_MAX_SUBCLASS		(XFS_ILOCK_PARENT_VAL - 1)
466a1033753SDave Chinner #define XFS_ILOCK_RTBITMAP_VAL		6u
467a1033753SDave Chinner #define XFS_ILOCK_RTSUM_VAL		7u
468a1033753SDave Chinner #define XFS_ILOCK_DEP_MASK		0xff000000u
4690952c818SDave Chinner #define	XFS_ILOCK_PARENT		(XFS_ILOCK_PARENT_VAL << XFS_ILOCK_SHIFT)
4700952c818SDave Chinner #define	XFS_ILOCK_RTBITMAP		(XFS_ILOCK_RTBITMAP_VAL << XFS_ILOCK_SHIFT)
4710952c818SDave Chinner #define	XFS_ILOCK_RTSUM			(XFS_ILOCK_RTSUM_VAL << XFS_ILOCK_SHIFT)
4720952c818SDave Chinner 
4730952c818SDave Chinner #define XFS_LOCK_SUBCLASS_MASK	(XFS_IOLOCK_DEP_MASK | \
474653c60b6SDave Chinner 				 XFS_MMAPLOCK_DEP_MASK | \
475653c60b6SDave Chinner 				 XFS_ILOCK_DEP_MASK)
476f7c66ce3SLachlan McIlroy 
477653c60b6SDave Chinner #define XFS_IOLOCK_DEP(flags)	(((flags) & XFS_IOLOCK_DEP_MASK) \
478653c60b6SDave Chinner 					>> XFS_IOLOCK_SHIFT)
479653c60b6SDave Chinner #define XFS_MMAPLOCK_DEP(flags)	(((flags) & XFS_MMAPLOCK_DEP_MASK) \
480653c60b6SDave Chinner 					>> XFS_MMAPLOCK_SHIFT)
481653c60b6SDave Chinner #define XFS_ILOCK_DEP(flags)	(((flags) & XFS_ILOCK_DEP_MASK) \
482653c60b6SDave Chinner 					>> XFS_ILOCK_SHIFT)
4831da177e4SLinus Torvalds 
4841da177e4SLinus Torvalds /*
48569eb5fa1SDan Williams  * Layouts are broken in the BREAK_WRITE case to ensure that
48669eb5fa1SDan Williams  * layout-holders do not collide with local writes. Additionally,
48769eb5fa1SDan Williams  * layouts are broken in the BREAK_UNMAP case to make sure the
48869eb5fa1SDan Williams  * layout-holder has a consistent view of the file's extent map. While
48969eb5fa1SDan Williams  * BREAK_WRITE breaks can be satisfied by recalling FL_LAYOUT leases,
49069eb5fa1SDan Williams  * BREAK_UNMAP breaks additionally require waiting for busy dax-pages to
49169eb5fa1SDan Williams  * go idle.
49269eb5fa1SDan Williams  */
49369eb5fa1SDan Williams enum layout_break_reason {
49469eb5fa1SDan Williams         BREAK_WRITE,
49569eb5fa1SDan Williams         BREAK_UNMAP,
49669eb5fa1SDan Williams };
49769eb5fa1SDan Williams 
49869eb5fa1SDan Williams /*
4991da177e4SLinus Torvalds  * For multiple groups support: if S_ISGID bit is set in the parent
5001da177e4SLinus Torvalds  * directory, group of new file is set to that of the parent, and
5011da177e4SLinus Torvalds  * new subdirectory gets S_ISGID bit from parent.
5021da177e4SLinus Torvalds  */
503bd186aa9SChristoph Hellwig #define XFS_INHERIT_GID(pip)	\
5040560f31aSDave Chinner 	(xfs_has_grpid((pip)->i_mount) || (VFS_I(pip)->i_mode & S_ISGID))
5051da177e4SLinus Torvalds 
506c24b5dfaSDave Chinner int		xfs_release(struct xfs_inode *ip);
507d4d12c02SDave Chinner int		xfs_inactive(struct xfs_inode *ip);
508996b2329SDarrick J. Wong int		xfs_lookup(struct xfs_inode *dp, const struct xfs_name *name,
509c24b5dfaSDave Chinner 			   struct xfs_inode **ipp, struct xfs_name *ci_name);
510f2d40141SChristian Brauner int		xfs_create(struct mnt_idmap *idmap,
511f736d93dSChristoph Hellwig 			   struct xfs_inode *dp, struct xfs_name *name,
512e6a688c3SDave Chinner 			   umode_t mode, dev_t rdev, bool need_xattr,
513e6a688c3SDave Chinner 			   struct xfs_inode **ipp);
514f2d40141SChristian Brauner int		xfs_create_tmpfile(struct mnt_idmap *idmap,
515f736d93dSChristoph Hellwig 			   struct xfs_inode *dp, umode_t mode,
516a1f69417SEric Sandeen 			   struct xfs_inode **ipp);
517c24b5dfaSDave Chinner int		xfs_remove(struct xfs_inode *dp, struct xfs_name *name,
518c24b5dfaSDave Chinner 			   struct xfs_inode *ip);
519c24b5dfaSDave Chinner int		xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip,
520c24b5dfaSDave Chinner 			 struct xfs_name *target_name);
521f2d40141SChristian Brauner int		xfs_rename(struct mnt_idmap *idmap,
522f736d93dSChristoph Hellwig 			   struct xfs_inode *src_dp, struct xfs_name *src_name,
523c24b5dfaSDave Chinner 			   struct xfs_inode *src_ip, struct xfs_inode *target_dp,
524c24b5dfaSDave Chinner 			   struct xfs_name *target_name,
525d31a1825SCarlos Maiolino 			   struct xfs_inode *target_ip, unsigned int flags);
526c24b5dfaSDave Chinner 
5271da177e4SLinus Torvalds void		xfs_ilock(xfs_inode_t *, uint);
5281da177e4SLinus Torvalds int		xfs_ilock_nowait(xfs_inode_t *, uint);
5291da177e4SLinus Torvalds void		xfs_iunlock(xfs_inode_t *, uint);
5301da177e4SLinus Torvalds void		xfs_ilock_demote(xfs_inode_t *, uint);
531e31cbde7SPavel Reichl bool		xfs_isilocked(struct xfs_inode *, uint);
532309ecac8SChristoph Hellwig uint		xfs_ilock_data_map_shared(struct xfs_inode *);
533efa70be1SChristoph Hellwig uint		xfs_ilock_attr_map_shared(struct xfs_inode *);
534347d1c01SChristoph Hellwig 
5351da177e4SLinus Torvalds uint		xfs_ip2xflags(struct xfs_inode *);
5360e0417f3SBrian Foster int		xfs_ifree(struct xfs_trans *, struct xfs_inode *);
5374e529339SBrian Foster int		xfs_itruncate_extents_flags(struct xfs_trans **,
5384e529339SBrian Foster 				struct xfs_inode *, int, xfs_fsize_t, int);
5391da177e4SLinus Torvalds void		xfs_iext_realloc(xfs_inode_t *, int, int);
5401fd7115eSDave Chinner 
54154fbdd10SChristoph Hellwig int		xfs_log_force_inode(struct xfs_inode *ip);
542777df5afSDave Chinner void		xfs_iunpin_wait(xfs_inode_t *);
5431fd7115eSDave Chinner #define xfs_ipincount(ip)	((unsigned int) atomic_read(&ip->i_pincount))
5441fd7115eSDave Chinner 
5455717ea4dSDave Chinner int		xfs_iflush_cluster(struct xfs_buf *);
5467c2d238aSDarrick J. Wong void		xfs_lock_two_inodes(struct xfs_inode *ip0, uint ip0_mode,
5477c2d238aSDarrick J. Wong 				struct xfs_inode *ip1, uint ip1_mode);
5481da177e4SLinus Torvalds 
5492a0ec1d9SDave Chinner xfs_extlen_t	xfs_get_extsz_hint(struct xfs_inode *ip);
550f7ca3522SDarrick J. Wong xfs_extlen_t	xfs_get_cowextsz_hint(struct xfs_inode *ip);
5512a0ec1d9SDave Chinner 
552f2d40141SChristian Brauner int xfs_init_new_inode(struct mnt_idmap *idmap, struct xfs_trans *tp,
553b652afd9SDave Chinner 		struct xfs_inode *pip, xfs_ino_t ino, umode_t mode,
554b652afd9SDave Chinner 		xfs_nlink_t nlink, dev_t rdev, prid_t prid, bool init_xattrs,
555e6a688c3SDave Chinner 		struct xfs_inode **ipp);
556e546cb79SDave Chinner 
55713b86fc3SBrian Foster static inline int
xfs_itruncate_extents(struct xfs_trans ** tpp,struct xfs_inode * ip,int whichfork,xfs_fsize_t new_size)55813b86fc3SBrian Foster xfs_itruncate_extents(
55913b86fc3SBrian Foster 	struct xfs_trans	**tpp,
56013b86fc3SBrian Foster 	struct xfs_inode	*ip,
56113b86fc3SBrian Foster 	int			whichfork,
56213b86fc3SBrian Foster 	xfs_fsize_t		new_size)
56313b86fc3SBrian Foster {
5644e529339SBrian Foster 	return xfs_itruncate_extents_flags(tpp, ip, whichfork, new_size, 0);
56513b86fc3SBrian Foster }
56613b86fc3SBrian Foster 
567c24b5dfaSDave Chinner /* from xfs_file.c */
56813f9e267SShiyang Ruan int	xfs_break_dax_layouts(struct inode *inode, bool *retry);
56969eb5fa1SDan Williams int	xfs_break_layouts(struct inode *inode, uint *iolock,
57069eb5fa1SDan Williams 		enum layout_break_reason reason);
571c24b5dfaSDave Chinner 
57258c90473SDave Chinner /* from xfs_iops.c */
5732b3d1d41SChristoph Hellwig extern void xfs_setup_inode(struct xfs_inode *ip);
5742b3d1d41SChristoph Hellwig extern void xfs_setup_iops(struct xfs_inode *ip);
575840d493dSIra Weiny extern void xfs_diflags_to_iflags(struct xfs_inode *ip, bool init);
5762b3d1d41SChristoph Hellwig 
xfs_update_stable_writes(struct xfs_inode * ip)57705955a70SChristoph Hellwig static inline void xfs_update_stable_writes(struct xfs_inode *ip)
57805955a70SChristoph Hellwig {
57905955a70SChristoph Hellwig 	if (bdev_stable_writes(xfs_inode_buftarg(ip)->bt_bdev))
58005955a70SChristoph Hellwig 		mapping_set_stable_writes(VFS_I(ip)->i_mapping);
58105955a70SChristoph Hellwig 	else
58205955a70SChristoph Hellwig 		mapping_clear_stable_writes(VFS_I(ip)->i_mapping);
58305955a70SChristoph Hellwig }
58405955a70SChristoph Hellwig 
58558c90473SDave Chinner /*
58658c90473SDave Chinner  * When setting up a newly allocated inode, we need to call
58758c90473SDave Chinner  * xfs_finish_inode_setup() once the inode is fully instantiated at
58858c90473SDave Chinner  * the VFS level to prevent the rest of the world seeing the inode
58958c90473SDave Chinner  * before we've completed instantiation. Otherwise we can do it
59058c90473SDave Chinner  * the moment the inode lookup is complete.
59158c90473SDave Chinner  */
xfs_finish_inode_setup(struct xfs_inode * ip)59258c90473SDave Chinner static inline void xfs_finish_inode_setup(struct xfs_inode *ip)
59358c90473SDave Chinner {
59458c90473SDave Chinner 	xfs_iflags_clear(ip, XFS_INEW);
59558c90473SDave Chinner 	barrier();
59658c90473SDave Chinner 	unlock_new_inode(VFS_I(ip));
59758c90473SDave Chinner }
59858c90473SDave Chinner 
xfs_setup_existing_inode(struct xfs_inode * ip)59958c90473SDave Chinner static inline void xfs_setup_existing_inode(struct xfs_inode *ip)
60058c90473SDave Chinner {
60158c90473SDave Chinner 	xfs_setup_inode(ip);
6022b3d1d41SChristoph Hellwig 	xfs_setup_iops(ip);
60358c90473SDave Chinner 	xfs_finish_inode_setup(ip);
60458c90473SDave Chinner }
60558c90473SDave Chinner 
60644a8736bSDarrick J. Wong void xfs_irele(struct xfs_inode *ip);
6075a8d0f3cSChristoph Hellwig 
608182696fbSDarrick J. Wong extern struct kmem_cache	*xfs_inode_cache;
6091da177e4SLinus Torvalds 
610e153aa79SDarrick J. Wong /* The default CoW extent size hint. */
611e153aa79SDarrick J. Wong #define XFS_DEFAULT_COWEXTSZ_HINT 32
612e153aa79SDarrick J. Wong 
61362af7d54SDarrick J. Wong bool xfs_inode_needs_inactive(struct xfs_inode *ip);
61462af7d54SDarrick J. Wong 
615cb357bf3SDarrick J. Wong void xfs_end_io(struct work_struct *work);
616cb357bf3SDarrick J. Wong 
617e2aaee9cSDarrick J. Wong int xfs_ilock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2);
618e2aaee9cSDarrick J. Wong void xfs_iunlock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2);
619d7d84772SCatherine Hoang void xfs_iunlock2_remapping(struct xfs_inode *ip1, struct xfs_inode *ip2);
620e2aaee9cSDarrick J. Wong 
62183771c50SDarrick J. Wong static inline bool
xfs_inode_unlinked_incomplete(struct xfs_inode * ip)62283771c50SDarrick J. Wong xfs_inode_unlinked_incomplete(
62383771c50SDarrick J. Wong 	struct xfs_inode	*ip)
62483771c50SDarrick J. Wong {
62583771c50SDarrick J. Wong 	return VFS_I(ip)->i_nlink == 0 && !xfs_inode_on_unlinked_list(ip);
62683771c50SDarrick J. Wong }
62783771c50SDarrick J. Wong int xfs_inode_reload_unlinked_bucket(struct xfs_trans *tp, struct xfs_inode *ip);
62883771c50SDarrick J. Wong int xfs_inode_reload_unlinked(struct xfs_inode *ip);
62983771c50SDarrick J. Wong 
630c070b880SDarrick J. Wong unsigned int xfs_inode_alloc_unitsize(struct xfs_inode *ip);
631c070b880SDarrick J. Wong 
6321da177e4SLinus Torvalds #endif	/* __XFS_INODE_H__ */
633