xfs_inode.h (0ea8a56de21be24cb79abb03dee79aabcd60a316) xfs_inode.h (f93e5436f0ee5a85eaa3a86d2614d215873fb18b)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#ifndef __XFS_INODE_H__
7#define __XFS_INODE_H__
8

--- 180 unchanged lines hidden (view full) ---

189 * Check if an inode has any data in the COW fork. This might be often false
190 * even for inodes with the reflink flag when there is no pending COW operation.
191 */
192static inline bool xfs_inode_has_cow_data(struct xfs_inode *ip)
193{
194 return ip->i_cowfp && ip->i_cowfp->if_bytes;
195}
196
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#ifndef __XFS_INODE_H__
7#define __XFS_INODE_H__
8

--- 180 unchanged lines hidden (view full) ---

189 * Check if an inode has any data in the COW fork. This might be often false
190 * even for inodes with the reflink flag when there is no pending COW operation.
191 */
192static inline bool xfs_inode_has_cow_data(struct xfs_inode *ip)
193{
194 return ip->i_cowfp && ip->i_cowfp->if_bytes;
195}
196
197static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
198{
199 return ip->i_d.di_flags2 & XFS_DIFLAG2_BIGTIME;
200}
201
197/*
198 * Return the buftarg used for data allocations on a given inode.
199 */
200#define xfs_inode_buftarg(ip) \
201 (XFS_IS_REALTIME_INODE(ip) ? \
202 (ip)->i_mount->m_rtdev_targp : (ip)->i_mount->m_ddev_targp)
203
204/*
205 * In-core inode flags.
206 */
207#define XFS_IRECLAIM (1 << 0) /* started reclaiming this inode */
208#define XFS_ISTALE (1 << 1) /* inode has been staled */
209#define XFS_IRECLAIMABLE (1 << 2) /* inode can be reclaimed */
210#define __XFS_INEW_BIT 3 /* inode has just been allocated */
211#define XFS_INEW (1 << __XFS_INEW_BIT)
212#define XFS_ITRUNCATED (1 << 5) /* truncated down so flush-on-close */
213#define XFS_IDIRTY_RELEASE (1 << 6) /* dirty release already seen */
202/*
203 * Return the buftarg used for data allocations on a given inode.
204 */
205#define xfs_inode_buftarg(ip) \
206 (XFS_IS_REALTIME_INODE(ip) ? \
207 (ip)->i_mount->m_rtdev_targp : (ip)->i_mount->m_ddev_targp)
208
209/*
210 * In-core inode flags.
211 */
212#define XFS_IRECLAIM (1 << 0) /* started reclaiming this inode */
213#define XFS_ISTALE (1 << 1) /* inode has been staled */
214#define XFS_IRECLAIMABLE (1 << 2) /* inode can be reclaimed */
215#define __XFS_INEW_BIT 3 /* inode has just been allocated */
216#define XFS_INEW (1 << __XFS_INEW_BIT)
217#define XFS_ITRUNCATED (1 << 5) /* truncated down so flush-on-close */
218#define XFS_IDIRTY_RELEASE (1 << 6) /* dirty release already seen */
214#define __XFS_IFLOCK_BIT 7 /* inode is being flushed right now */
215#define XFS_IFLOCK (1 << __XFS_IFLOCK_BIT)
219#define XFS_IFLUSHING (1 << 7) /* inode is being flushed */
216#define __XFS_IPINNED_BIT 8 /* wakeup key for zero pin count */
217#define XFS_IPINNED (1 << __XFS_IPINNED_BIT)
218#define XFS_IEOFBLOCKS (1 << 9) /* has the preallocblocks tag set */
219/*
220 * If this unlinked inode is in the middle of recovery, don't let drop_inode
221 * truncate and free the inode. This can happen if we iget the inode during
222 * log recovery to replay a bmap operation on the inode.
223 */

--- 5 unchanged lines hidden (view full) ---

229 * inode lookup. This prevents unintended behaviour on the new inode from
230 * ocurring.
231 */
232#define XFS_IRECLAIM_RESET_FLAGS \
233 (XFS_IRECLAIMABLE | XFS_IRECLAIM | \
234 XFS_IDIRTY_RELEASE | XFS_ITRUNCATED)
235
236/*
220#define __XFS_IPINNED_BIT 8 /* wakeup key for zero pin count */
221#define XFS_IPINNED (1 << __XFS_IPINNED_BIT)
222#define XFS_IEOFBLOCKS (1 << 9) /* has the preallocblocks tag set */
223/*
224 * If this unlinked inode is in the middle of recovery, don't let drop_inode
225 * truncate and free the inode. This can happen if we iget the inode during
226 * log recovery to replay a bmap operation on the inode.
227 */

--- 5 unchanged lines hidden (view full) ---

233 * inode lookup. This prevents unintended behaviour on the new inode from
234 * ocurring.
235 */
236#define XFS_IRECLAIM_RESET_FLAGS \
237 (XFS_IRECLAIMABLE | XFS_IRECLAIM | \
238 XFS_IDIRTY_RELEASE | XFS_ITRUNCATED)
239
240/*
237 * Synchronize processes attempting to flush the in-core inode back to disk.
238 */
239
240static inline int xfs_isiflocked(struct xfs_inode *ip)
241{
242 return xfs_iflags_test(ip, XFS_IFLOCK);
243}
244
245extern void __xfs_iflock(struct xfs_inode *ip);
246
247static inline int xfs_iflock_nowait(struct xfs_inode *ip)
248{
249 return !xfs_iflags_test_and_set(ip, XFS_IFLOCK);
250}
251
252static inline void xfs_iflock(struct xfs_inode *ip)
253{
254 if (!xfs_iflock_nowait(ip))
255 __xfs_iflock(ip);
256}
257
258static inline void xfs_ifunlock(struct xfs_inode *ip)
259{
260 ASSERT(xfs_isiflocked(ip));
261 xfs_iflags_clear(ip, XFS_IFLOCK);
262 smp_mb();
263 wake_up_bit(&ip->i_flags, __XFS_IFLOCK_BIT);
264}
265
266/*
267 * Flags for inode locking.
268 * Bit ranges: 1<<1 - 1<<16-1 -- iolock/ilock modes (bitfield)
269 * 1<<16 - 1<<32-1 -- lockdep annotation (integers)
270 */
271#define XFS_IOLOCK_EXCL (1<<0)
272#define XFS_IOLOCK_SHARED (1<<1)
273#define XFS_ILOCK_EXCL (1<<2)
274#define XFS_ILOCK_SHARED (1<<3)

--- 231 unchanged lines hidden ---
241 * Flags for inode locking.
242 * Bit ranges: 1<<1 - 1<<16-1 -- iolock/ilock modes (bitfield)
243 * 1<<16 - 1<<32-1 -- lockdep annotation (integers)
244 */
245#define XFS_IOLOCK_EXCL (1<<0)
246#define XFS_IOLOCK_SHARED (1<<1)
247#define XFS_ILOCK_EXCL (1<<2)
248#define XFS_ILOCK_SHARED (1<<3)

--- 231 unchanged lines hidden ---