Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #ifndef	__XFS_INODE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #define	__XFS_INODE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "xfs_inode_buf.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include "xfs_inode_fork.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * Kernel only inode definitions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) struct xfs_dinode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) struct xfs_inode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) struct xfs_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) struct xfs_bmbt_irec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) struct xfs_inode_log_item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) struct xfs_mount;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) struct xfs_trans;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) struct xfs_dquot;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) typedef struct xfs_inode {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	/* Inode linking and identification information. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	struct xfs_mount	*i_mount;	/* fs mount struct ptr */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	struct xfs_dquot	*i_udquot;	/* user dquot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	struct xfs_dquot	*i_gdquot;	/* group dquot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	struct xfs_dquot	*i_pdquot;	/* project dquot */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	/* Inode location stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	xfs_ino_t		i_ino;		/* inode number (agno/agino)*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	struct xfs_imap		i_imap;		/* location for xfs_imap() */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	/* Extent information. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	struct xfs_ifork	*i_afp;		/* attribute fork pointer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	struct xfs_ifork	*i_cowfp;	/* copy on write extents */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	struct xfs_ifork	i_df;		/* data fork */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	/* Transaction and locking information. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	struct xfs_inode_log_item *i_itemp;	/* logging information */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	mrlock_t		i_lock;		/* inode lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	mrlock_t		i_mmaplock;	/* inode mmap IO lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	atomic_t		i_pincount;	/* inode pin count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	 * Bitsets of inode metadata that have been checked and/or are sick.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	 * Callers must hold i_flags_lock before accessing this field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	uint16_t		i_checked;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	uint16_t		i_sick;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	spinlock_t		i_flags_lock;	/* inode i_flags lock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	/* Miscellaneous state. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	unsigned long		i_flags;	/* see defined flags below */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	uint64_t		i_delayed_blks;	/* count of delay alloc blks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	struct xfs_icdinode	i_d;		/* most of ondisk inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	/* VFS inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	struct inode		i_vnode;	/* embedded VFS inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	/* pending io completions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	spinlock_t		i_ioend_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	struct work_struct	i_ioend_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	struct list_head	i_ioend_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) } xfs_inode_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) /* Convert from vfs inode to xfs inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) static inline struct xfs_inode *XFS_I(struct inode *inode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	return container_of(inode, struct xfs_inode, i_vnode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) /* convert from xfs inode to vfs inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) static inline struct inode *VFS_I(struct xfs_inode *ip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	return &ip->i_vnode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82)  * For regular files we only update the on-disk filesize when actually
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  * writing data back to disk.  Until then only the copy in the VFS inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84)  * is uptodate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	if (S_ISREG(VFS_I(ip)->i_mode))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		return i_size_read(VFS_I(ip));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	return ip->i_d.di_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  * If this I/O goes past the on-disk inode size update it unless it would
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  * be past the current in-core inode size.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) static inline xfs_fsize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) xfs_new_eof(struct xfs_inode *ip, xfs_fsize_t new_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	xfs_fsize_t i_size = i_size_read(VFS_I(ip));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	if (new_size > i_size || new_size < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		new_size = i_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	return new_size > ip->i_d.di_size ? new_size : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * i_flags helper functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) __xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	ip->i_flags |= flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	spin_lock(&ip->i_flags_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	__xfs_iflags_set(ip, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	spin_unlock(&ip->i_flags_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) xfs_iflags_clear(xfs_inode_t *ip, unsigned short flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	spin_lock(&ip->i_flags_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	ip->i_flags &= ~flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	spin_unlock(&ip->i_flags_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) __xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	return (ip->i_flags & flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	spin_lock(&ip->i_flags_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	ret = __xfs_iflags_test(ip, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	spin_unlock(&ip->i_flags_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	spin_lock(&ip->i_flags_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	ret = ip->i_flags & flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		ip->i_flags &= ~flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	spin_unlock(&ip->i_flags_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned short flags)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	spin_lock(&ip->i_flags_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	ret = ip->i_flags & flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	if (!ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		ip->i_flags |= flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	spin_unlock(&ip->i_flags_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static inline prid_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) xfs_get_initial_prid(struct xfs_inode *dp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 		return dp->i_d.di_projid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	return XFS_PROJID_DEFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static inline bool xfs_is_reflink_inode(struct xfs_inode *ip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	return ip->i_d.di_flags2 & XFS_DIFLAG2_REFLINK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)  * Check if an inode has any data in the COW fork.  This might be often false
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)  * even for inodes with the reflink flag when there is no pending COW operation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) static inline bool xfs_inode_has_cow_data(struct xfs_inode *ip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	return ip->i_cowfp && ip->i_cowfp->if_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	return ip->i_d.di_flags2 & XFS_DIFLAG2_BIGTIME;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)  * Return the buftarg used for data allocations on a given inode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) #define xfs_inode_buftarg(ip) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	(XFS_IS_REALTIME_INODE(ip) ? \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		(ip)->i_mount->m_rtdev_targp : (ip)->i_mount->m_ddev_targp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)  * In-core inode flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) #define XFS_IRECLAIM		(1 << 0) /* started reclaiming this inode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) #define XFS_ISTALE		(1 << 1) /* inode has been staled */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) #define XFS_IRECLAIMABLE	(1 << 2) /* inode can be reclaimed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) #define __XFS_INEW_BIT		3	 /* inode has just been allocated */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) #define XFS_INEW		(1 << __XFS_INEW_BIT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) #define XFS_ITRUNCATED		(1 << 5) /* truncated down so flush-on-close */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) #define XFS_IDIRTY_RELEASE	(1 << 6) /* dirty release already seen */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) #define XFS_IFLUSHING		(1 << 7) /* inode is being flushed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) #define __XFS_IPINNED_BIT	8	 /* wakeup key for zero pin count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) #define XFS_IPINNED		(1 << __XFS_IPINNED_BIT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) #define XFS_IEOFBLOCKS		(1 << 9) /* has the preallocblocks tag set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  * If this unlinked inode is in the middle of recovery, don't let drop_inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  * truncate and free the inode.  This can happen if we iget the inode during
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)  * log recovery to replay a bmap operation on the inode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) #define XFS_IRECOVERY		(1 << 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) #define XFS_ICOWBLOCKS		(1 << 12)/* has the cowblocks tag set */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)  * Per-lifetime flags need to be reset when re-using a reclaimable inode during
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)  * inode lookup. This prevents unintended behaviour on the new inode from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)  * ocurring.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) #define XFS_IRECLAIM_RESET_FLAGS	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 	(XFS_IRECLAIMABLE | XFS_IRECLAIM | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	 XFS_IDIRTY_RELEASE | XFS_ITRUNCATED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)  * Flags for inode locking.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)  * Bit ranges:	1<<1  - 1<<16-1 -- iolock/ilock modes (bitfield)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)  *		1<<16 - 1<<32-1 -- lockdep annotation (integers)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) #define	XFS_IOLOCK_EXCL		(1<<0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) #define	XFS_IOLOCK_SHARED	(1<<1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) #define	XFS_ILOCK_EXCL		(1<<2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) #define	XFS_ILOCK_SHARED	(1<<3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) #define	XFS_MMAPLOCK_EXCL	(1<<4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) #define	XFS_MMAPLOCK_SHARED	(1<<5)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) #define XFS_LOCK_MASK		(XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 				| XFS_ILOCK_EXCL | XFS_ILOCK_SHARED \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 				| XFS_MMAPLOCK_EXCL | XFS_MMAPLOCK_SHARED)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) #define XFS_LOCK_FLAGS \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	{ XFS_IOLOCK_EXCL,	"IOLOCK_EXCL" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	{ XFS_IOLOCK_SHARED,	"IOLOCK_SHARED" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	{ XFS_ILOCK_EXCL,	"ILOCK_EXCL" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	{ XFS_ILOCK_SHARED,	"ILOCK_SHARED" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	{ XFS_MMAPLOCK_EXCL,	"MMAPLOCK_EXCL" }, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	{ XFS_MMAPLOCK_SHARED,	"MMAPLOCK_SHARED" }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)  * Flags for lockdep annotations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268)  * XFS_LOCK_PARENT - for directory operations that require locking a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)  * parent directory inode and a child entry inode. IOLOCK requires nesting,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)  * MMAPLOCK does not support this class, ILOCK requires a single subclass
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)  * to differentiate parent from child.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273)  * XFS_LOCK_RTBITMAP/XFS_LOCK_RTSUM - the realtime device bitmap and summary
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)  * inodes do not participate in the normal lock order, and thus have their
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)  * own subclasses.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277)  * XFS_LOCK_INUMORDER - for locking several inodes at the some time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)  * with xfs_lock_inodes().  This flag is used as the starting subclass
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279)  * and each subsequent lock acquired will increment the subclass by one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)  * However, MAX_LOCKDEP_SUBCLASSES == 8, which means we are greatly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281)  * limited to the subclasses we can represent via nesting. We need at least
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)  * 5 inodes nest depth for the ILOCK through rename, and we also have to support
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)  * XFS_ILOCK_PARENT, which gives 6 subclasses. Then we have XFS_ILOCK_RTBITMAP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284)  * and XFS_ILOCK_RTSUM, which are another 2 unique subclasses, so that's all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285)  * 8 subclasses supported by lockdep.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)  * This also means we have to number the sub-classes in the lowest bits of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)  * the mask we keep, and we have to ensure we never exceed 3 bits of lockdep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289)  * mask and we can't use bit-masking to build the subclasses. What a mess.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)  * Bit layout:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293)  * Bit		Lock Region
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)  * 16-19	XFS_IOLOCK_SHIFT dependencies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295)  * 20-23	XFS_MMAPLOCK_SHIFT dependencies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296)  * 24-31	XFS_ILOCK_SHIFT dependencies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)  * IOLOCK values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300)  * 0-3		subclass value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)  * 4-7		unused
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)  * MMAPLOCK values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)  * 0-3		subclass value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)  * 4-7		unused
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308)  * ILOCK values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)  * 0-4		subclass values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310)  * 5		PARENT subclass (not nestable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)  * 6		RTBITMAP subclass (not nestable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)  * 7		RTSUM subclass (not nestable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)  * 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) #define XFS_IOLOCK_SHIFT		16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) #define XFS_IOLOCK_MAX_SUBCLASS		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) #define XFS_IOLOCK_DEP_MASK		0x000f0000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) #define XFS_MMAPLOCK_SHIFT		20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) #define XFS_MMAPLOCK_NUMORDER		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) #define XFS_MMAPLOCK_MAX_SUBCLASS	3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) #define XFS_MMAPLOCK_DEP_MASK		0x00f00000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) #define XFS_ILOCK_SHIFT			24
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) #define XFS_ILOCK_PARENT_VAL		5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) #define XFS_ILOCK_MAX_SUBCLASS		(XFS_ILOCK_PARENT_VAL - 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) #define XFS_ILOCK_RTBITMAP_VAL		6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) #define XFS_ILOCK_RTSUM_VAL		7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) #define XFS_ILOCK_DEP_MASK		0xff000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) #define	XFS_ILOCK_PARENT		(XFS_ILOCK_PARENT_VAL << XFS_ILOCK_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) #define	XFS_ILOCK_RTBITMAP		(XFS_ILOCK_RTBITMAP_VAL << XFS_ILOCK_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) #define	XFS_ILOCK_RTSUM			(XFS_ILOCK_RTSUM_VAL << XFS_ILOCK_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) #define XFS_LOCK_SUBCLASS_MASK	(XFS_IOLOCK_DEP_MASK | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 				 XFS_MMAPLOCK_DEP_MASK | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 				 XFS_ILOCK_DEP_MASK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) #define XFS_IOLOCK_DEP(flags)	(((flags) & XFS_IOLOCK_DEP_MASK) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 					>> XFS_IOLOCK_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) #define XFS_MMAPLOCK_DEP(flags)	(((flags) & XFS_MMAPLOCK_DEP_MASK) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 					>> XFS_MMAPLOCK_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) #define XFS_ILOCK_DEP(flags)	(((flags) & XFS_ILOCK_DEP_MASK) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 					>> XFS_ILOCK_SHIFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)  * Layouts are broken in the BREAK_WRITE case to ensure that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347)  * layout-holders do not collide with local writes. Additionally,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)  * layouts are broken in the BREAK_UNMAP case to make sure the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)  * layout-holder has a consistent view of the file's extent map. While
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)  * BREAK_WRITE breaks can be satisfied by recalling FL_LAYOUT leases,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351)  * BREAK_UNMAP breaks additionally require waiting for busy dax-pages to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)  * go idle.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) enum layout_break_reason {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)         BREAK_WRITE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356)         BREAK_UNMAP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)  * For multiple groups support: if S_ISGID bit is set in the parent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)  * directory, group of new file is set to that of the parent, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)  * new subdirectory gets S_ISGID bit from parent.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) #define XFS_INHERIT_GID(pip)	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	(((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 	 (VFS_I(pip)->i_mode & S_ISGID))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) int		xfs_release(struct xfs_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) void		xfs_inactive(struct xfs_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) int		xfs_lookup(struct xfs_inode *dp, struct xfs_name *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 			   struct xfs_inode **ipp, struct xfs_name *ci_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) int		xfs_create(struct xfs_inode *dp, struct xfs_name *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 			   umode_t mode, dev_t rdev, struct xfs_inode **ipp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) int		xfs_create_tmpfile(struct xfs_inode *dp, umode_t mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 			   struct xfs_inode **ipp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) int		xfs_remove(struct xfs_inode *dp, struct xfs_name *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 			   struct xfs_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) int		xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 			 struct xfs_name *target_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) int		xfs_rename(struct xfs_inode *src_dp, struct xfs_name *src_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 			   struct xfs_inode *src_ip, struct xfs_inode *target_dp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 			   struct xfs_name *target_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 			   struct xfs_inode *target_ip, unsigned int flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) void		xfs_ilock(xfs_inode_t *, uint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) int		xfs_ilock_nowait(xfs_inode_t *, uint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) void		xfs_iunlock(xfs_inode_t *, uint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) void		xfs_ilock_demote(xfs_inode_t *, uint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) int		xfs_isilocked(xfs_inode_t *, uint);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) uint		xfs_ilock_data_map_shared(struct xfs_inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) uint		xfs_ilock_attr_map_shared(struct xfs_inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) uint		xfs_ip2xflags(struct xfs_inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) int		xfs_ifree(struct xfs_trans *, struct xfs_inode *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) int		xfs_itruncate_extents_flags(struct xfs_trans **,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 				struct xfs_inode *, int, xfs_fsize_t, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) void		xfs_iext_realloc(xfs_inode_t *, int, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) int		xfs_log_force_inode(struct xfs_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) void		xfs_iunpin_wait(xfs_inode_t *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) #define xfs_ipincount(ip)	((unsigned int) atomic_read(&ip->i_pincount))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) int		xfs_iflush_cluster(struct xfs_buf *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) void		xfs_lock_two_inodes(struct xfs_inode *ip0, uint ip0_mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 				struct xfs_inode *ip1, uint ip1_mode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) xfs_extlen_t	xfs_get_extsz_hint(struct xfs_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) xfs_extlen_t	xfs_get_cowextsz_hint(struct xfs_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) int		xfs_dir_ialloc(struct xfs_trans **, struct xfs_inode *, umode_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 			       xfs_nlink_t, dev_t, prid_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 			       struct xfs_inode **);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) static inline int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) xfs_itruncate_extents(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	struct xfs_trans	**tpp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 	struct xfs_inode	*ip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	int			whichfork,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) 	xfs_fsize_t		new_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) 	return xfs_itruncate_extents_flags(tpp, ip, whichfork, new_size, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) /* from xfs_file.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) enum xfs_prealloc_flags {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	XFS_PREALLOC_SET	= (1 << 1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 	XFS_PREALLOC_CLEAR	= (1 << 2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 	XFS_PREALLOC_SYNC	= (1 << 3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 	XFS_PREALLOC_INVISIBLE	= (1 << 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) int	xfs_update_prealloc_flags(struct xfs_inode *ip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 				  enum xfs_prealloc_flags flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) int	xfs_break_layouts(struct inode *inode, uint *iolock,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 		enum layout_break_reason reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) /* from xfs_iops.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) extern void xfs_setup_inode(struct xfs_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) extern void xfs_setup_iops(struct xfs_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) extern void xfs_diflags_to_iflags(struct xfs_inode *ip, bool init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443)  * When setting up a newly allocated inode, we need to call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)  * xfs_finish_inode_setup() once the inode is fully instantiated at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445)  * the VFS level to prevent the rest of the world seeing the inode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)  * before we've completed instantiation. Otherwise we can do it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)  * the moment the inode lookup is complete.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) static inline void xfs_finish_inode_setup(struct xfs_inode *ip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) 	xfs_iflags_clear(ip, XFS_INEW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 	barrier();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) 	unlock_new_inode(VFS_I(ip));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 	wake_up_bit(&ip->i_flags, __XFS_INEW_BIT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) static inline void xfs_setup_existing_inode(struct xfs_inode *ip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) 	xfs_setup_inode(ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) 	xfs_setup_iops(ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) 	xfs_finish_inode_setup(ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) void xfs_irele(struct xfs_inode *ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) extern struct kmem_zone	*xfs_inode_zone;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) /* The default CoW extent size hint. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) #define XFS_DEFAULT_COWEXTSZ_HINT 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) int xfs_iunlink_init(struct xfs_perag *pag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) void xfs_iunlink_destroy(struct xfs_perag *pag);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) void xfs_end_io(struct work_struct *work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) int xfs_ilock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) void xfs_iunlock2_io_mmap(struct xfs_inode *ip1, struct xfs_inode *ip2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) #endif	/* __XFS_INODE_H__ */