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