Lines Matching refs:ip

97 static inline bool xfs_inode_on_unlinked_list(const struct xfs_inode *ip)
99 return ip->i_prev_unlinked != 0;
102 static inline bool xfs_inode_has_attr_fork(struct xfs_inode *ip)
104 return ip->i_forkoff > 0;
109 struct xfs_inode *ip,
114 return &ip->i_df;
116 if (!xfs_inode_has_attr_fork(ip))
118 return &ip->i_af;
120 return ip->i_cowfp;
127 static inline unsigned int xfs_inode_fork_boff(struct xfs_inode *ip)
129 return ip->i_forkoff << 3;
132 static inline unsigned int xfs_inode_data_fork_size(struct xfs_inode *ip)
134 if (xfs_inode_has_attr_fork(ip))
135 return xfs_inode_fork_boff(ip);
137 return XFS_LITINO(ip->i_mount);
140 static inline unsigned int xfs_inode_attr_fork_size(struct xfs_inode *ip)
142 if (xfs_inode_has_attr_fork(ip))
143 return XFS_LITINO(ip->i_mount) - xfs_inode_fork_boff(ip);
149 struct xfs_inode *ip,
154 return xfs_inode_data_fork_size(ip);
156 return xfs_inode_attr_fork_size(ip);
169 static inline struct inode *VFS_I(struct xfs_inode *ip)
171 return &ip->i_vnode;
175 static inline const struct inode *VFS_IC(const struct xfs_inode *ip)
177 return &ip->i_vnode;
185 static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
187 if (S_ISREG(VFS_I(ip)->i_mode))
188 return i_size_read(VFS_I(ip));
189 return ip->i_disk_size;
197 xfs_new_eof(struct xfs_inode *ip, xfs_fsize_t new_size)
199 xfs_fsize_t i_size = i_size_read(VFS_I(ip));
203 return new_size > ip->i_disk_size ? new_size : 0;
210 __xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
212 ip->i_flags |= flags;
216 xfs_iflags_set(xfs_inode_t *ip, unsigned short flags)
218 spin_lock(&ip->i_flags_lock);
219 __xfs_iflags_set(ip, flags);
220 spin_unlock(&ip->i_flags_lock);
224 xfs_iflags_clear(xfs_inode_t *ip, unsigned short flags)
226 spin_lock(&ip->i_flags_lock);
227 ip->i_flags &= ~flags;
228 spin_unlock(&ip->i_flags_lock);
232 __xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
234 return (ip->i_flags & flags);
238 xfs_iflags_test(xfs_inode_t *ip, unsigned short flags)
241 spin_lock(&ip->i_flags_lock);
242 ret = __xfs_iflags_test(ip, flags);
243 spin_unlock(&ip->i_flags_lock);
248 xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
252 spin_lock(&ip->i_flags_lock);
253 ret = ip->i_flags & flags;
255 ip->i_flags &= ~flags;
256 spin_unlock(&ip->i_flags_lock);
261 xfs_iflags_test_and_set(xfs_inode_t *ip, unsigned short flags)
265 spin_lock(&ip->i_flags_lock);
266 ret = ip->i_flags & flags;
268 ip->i_flags |= flags;
269 spin_unlock(&ip->i_flags_lock);
282 static inline bool xfs_is_reflink_inode(struct xfs_inode *ip)
284 return ip->i_diflags2 & XFS_DIFLAG2_REFLINK;
287 static inline bool xfs_is_metadata_inode(struct xfs_inode *ip)
289 struct xfs_mount *mp = ip->i_mount;
291 return ip == mp->m_rbmip || ip == mp->m_rsumip ||
292 xfs_is_quota_inode(&mp->m_sb, ip->i_ino);
299 static inline bool xfs_inode_has_cow_data(struct xfs_inode *ip)
301 return ip->i_cowfp && ip->i_cowfp->if_bytes;
304 static inline bool xfs_inode_has_bigtime(struct xfs_inode *ip)
306 return ip->i_diflags2 & XFS_DIFLAG2_BIGTIME;
309 static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip)
311 return ip->i_diflags2 & XFS_DIFLAG2_NREXT64;
317 #define xfs_inode_buftarg(ip) \
318 (XFS_IS_REALTIME_INODE(ip) ? \
319 (ip)->i_mount->m_rtdev_targp : (ip)->i_mount->m_ddev_targp)
507 int xfs_release(struct xfs_inode *ip);
508 int xfs_inactive(struct xfs_inode *ip);
519 struct xfs_inode *ip);
542 int xfs_log_force_inode(struct xfs_inode *ip);
544 #define xfs_ipincount(ip) ((unsigned int) atomic_read(&ip->i_pincount))
550 xfs_extlen_t xfs_get_extsz_hint(struct xfs_inode *ip);
551 xfs_extlen_t xfs_get_cowextsz_hint(struct xfs_inode *ip);
561 struct xfs_inode *ip,
565 return xfs_itruncate_extents_flags(tpp, ip, whichfork, new_size, 0);
574 extern void xfs_setup_inode(struct xfs_inode *ip);
575 extern void xfs_setup_iops(struct xfs_inode *ip);
576 extern void xfs_diflags_to_iflags(struct xfs_inode *ip, bool init);
578 static inline void xfs_update_stable_writes(struct xfs_inode *ip)
580 if (bdev_stable_writes(xfs_inode_buftarg(ip)->bt_bdev))
581 mapping_set_stable_writes(VFS_I(ip)->i_mapping);
583 mapping_clear_stable_writes(VFS_I(ip)->i_mapping);
593 static inline void xfs_finish_inode_setup(struct xfs_inode *ip)
595 xfs_iflags_clear(ip, XFS_INEW);
597 unlock_new_inode(VFS_I(ip));
600 static inline void xfs_setup_existing_inode(struct xfs_inode *ip)
602 xfs_setup_inode(ip);
603 xfs_setup_iops(ip);
604 xfs_finish_inode_setup(ip);
607 void xfs_irele(struct xfs_inode *ip);
614 bool xfs_inode_needs_inactive(struct xfs_inode *ip);
624 struct xfs_inode *ip)
626 return VFS_I(ip)->i_nlink == 0 && !xfs_inode_on_unlinked_list(ip);
628 int xfs_inode_reload_unlinked_bucket(struct xfs_trans *tp, struct xfs_inode *ip);
629 int xfs_inode_reload_unlinked(struct xfs_inode *ip);
631 bool xfs_ifork_zapped(const struct xfs_inode *ip, int whichfork);
632 void xfs_inode_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip,
637 const struct xfs_inode *ip;
643 void xfs_dir_update_hook(struct xfs_inode *dp, struct xfs_inode *ip,
657 # define xfs_dir_update_hook(dp, ip, delta, name) ((void)0)