Lines Matching defs:ip
53 struct xfs_inode *ip;
60 ip = kmem_zone_alloc(xfs_inode_zone, KM_SLEEP);
61 if (!ip)
63 if (inode_init_always(mp->m_super, VFS_I(ip))) {
64 kmem_zone_free(xfs_inode_zone, ip);
68 ASSERT(atomic_read(&ip->i_iocount) == 0);
69 ASSERT(atomic_read(&ip->i_pincount) == 0);
70 ASSERT(!spin_is_locked(&ip->i_flags_lock));
71 ASSERT(completion_done(&ip->i_flush));
73 mrlock_init(&ip->i_iolock, MRLOCK_BARRIER, "xfsio", ip->i_ino);
76 ip->i_ino = ino;
77 ip->i_mount = mp;
78 memset(&ip->i_imap, 0, sizeof(struct xfs_imap));
79 ip->i_afp = NULL;
80 memset(&ip->i_df, 0, sizeof(xfs_ifork_t));
81 ip->i_flags = 0;
82 ip->i_update_core = 0;
83 ip->i_delayed_blks = 0;
84 memset(&ip->i_d, 0, sizeof(xfs_icdinode_t));
85 ip->i_size = 0;
86 ip->i_new_size = 0;
89 VFS_I(ip)->i_state = I_NEW;
91 return ip;
96 struct xfs_inode *ip)
98 switch (ip->i_d.di_mode & S_IFMT) {
102 xfs_idestroy_fork(ip, XFS_DATA_FORK);
106 if (ip->i_afp)
107 xfs_idestroy_fork(ip, XFS_ATTR_FORK);
109 if (ip->i_itemp) {
115 xfs_log_item_t *lip = &ip->i_itemp->ili_item;
119 XFS_FORCED_SHUTDOWN(ip->i_mount));
127 xfs_inode_item_destroy(ip);
128 ip->i_itemp = NULL;
132 ASSERT(atomic_read(&ip->i_iocount) == 0);
133 ASSERT(atomic_read(&ip->i_pincount) == 0);
134 ASSERT(!spin_is_locked(&ip->i_flags_lock));
135 ASSERT(completion_done(&ip->i_flush));
137 kmem_zone_free(xfs_inode_zone, ip);
146 struct xfs_inode *ip,
150 struct inode *inode = VFS_I(ip);
151 struct xfs_mount *mp = ip->i_mount;
154 spin_lock(&ip->i_flags_lock);
156 if (ip->i_flags & (XFS_INEW|XFS_IRECLAIM)) {
157 trace_xfs_iget_skip(ip);
166 if (ip->i_d.di_mode == 0 && !(flags & XFS_IGET_CREATE)) {
175 if (ip->i_flags & XFS_IRECLAIMABLE) {
176 trace_xfs_iget_reclaim(ip);
184 ip->i_flags |= XFS_IRECLAIM;
186 spin_unlock(&ip->i_flags_lock);
196 spin_lock(&ip->i_flags_lock);
198 ip->i_flags &= ~XFS_INEW;
199 ip->i_flags |= XFS_IRECLAIMABLE;
200 __xfs_inode_set_reclaim_tag(pag, ip);
201 trace_xfs_iget_reclaim_fail(ip);
206 spin_lock(&ip->i_flags_lock);
207 ip->i_flags &= ~(XFS_IRECLAIMABLE | XFS_IRECLAIM);
208 ip->i_flags |= XFS_INEW;
209 __xfs_inode_clear_reclaim_tag(mp, pag, ip);
211 spin_unlock(&ip->i_flags_lock);
216 trace_xfs_iget_skip(ip);
222 spin_unlock(&ip->i_flags_lock);
224 trace_xfs_iget_hit(ip);
228 xfs_ilock(ip, lock_flags);
230 xfs_iflags_clear(ip, XFS_ISTALE);
236 spin_unlock(&ip->i_flags_lock);
252 struct xfs_inode *ip;
256 ip = xfs_inode_alloc(mp, ino);
257 if (!ip)
260 error = xfs_iread(mp, tp, ip, flags);
264 trace_xfs_iget_miss(ip);
266 if ((ip->i_d.di_mode == 0) && !(flags & XFS_IGET_CREATE)) {
286 if (!xfs_ilock_nowait(ip, lock_flags))
293 error = radix_tree_insert(&pag->pag_ici_root, agino, ip);
302 ip->i_udquot = ip->i_gdquot = NULL;
303 xfs_iflags_set(ip, XFS_INEW);
308 *ipp = ip;
315 xfs_iunlock(ip, lock_flags);
317 __destroy_inode(VFS_I(ip));
318 xfs_inode_free(ip);
353 xfs_inode_t *ip;
369 ip = radix_tree_lookup(&pag->pag_ici_root, agino);
371 if (ip) {
372 error = xfs_iget_cache_hit(pag, ip, flags, lock_flags);
379 error = xfs_iget_cache_miss(mp, pag, tp, ino, &ip,
386 *ipp = ip;
388 ASSERT(ip->i_df.if_ext_max ==
389 XFS_IFORK_DSIZE(ip) / sizeof(xfs_bmbt_rec_t));
394 if (xfs_iflags_test(ip, XFS_INEW) && ip->i_d.di_mode != 0)
395 xfs_setup_inode(ip);
427 xfs_inode_t *ip)
431 if ((ip->i_d.di_format == XFS_DINODE_FMT_BTREE) &&
432 ((ip->i_df.if_flags & XFS_IFEXTENTS) == 0)) {
438 xfs_ilock(ip, lock_mode);
449 xfs_inode_t *ip,
452 xfs_iunlock(ip, lock_mode);
463 * ip -- the inode being locked
477 xfs_inode_t *ip,
492 mrupdate_nested(&ip->i_iolock, XFS_IOLOCK_DEP(lock_flags));
494 mraccess_nested(&ip->i_iolock, XFS_IOLOCK_DEP(lock_flags));
497 mrupdate_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags));
499 mraccess_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags));
501 trace_xfs_ilock(ip, lock_flags, _RET_IP_);
511 * ip -- the inode being locked
518 xfs_inode_t *ip,
533 if (!mrtryupdate(&ip->i_iolock))
536 if (!mrtryaccess(&ip->i_iolock))
540 if (!mrtryupdate(&ip->i_lock))
543 if (!mrtryaccess(&ip->i_lock))
546 trace_xfs_ilock_nowait(ip, lock_flags, _RET_IP_);
551 mrunlock_excl(&ip->i_iolock);
553 mrunlock_shared(&ip->i_iolock);
564 * ip -- the inode being unlocked
572 xfs_inode_t *ip,
589 mrunlock_excl(&ip->i_iolock);
591 mrunlock_shared(&ip->i_iolock);
594 mrunlock_excl(&ip->i_lock);
596 mrunlock_shared(&ip->i_lock);
599 !(lock_flags & XFS_IUNLOCK_NONOTIFY) && ip->i_itemp) {
605 xfs_trans_unlocked_item(ip->i_itemp->ili_item.li_ailp,
606 (xfs_log_item_t*)(ip->i_itemp));
608 trace_xfs_iunlock(ip, lock_flags, _RET_IP_);
617 xfs_inode_t *ip,
624 mrdemote(&ip->i_lock);
626 mrdemote(&ip->i_iolock);
628 trace_xfs_ilock_demote(ip, lock_flags, _RET_IP_);
634 xfs_inode_t *ip,
639 return !!ip->i_lock.mr_writer;
640 return rwsem_is_locked(&ip->i_lock.mr_lock);
645 return !!ip->i_iolock.mr_writer;
646 return rwsem_is_locked(&ip->i_iolock.mr_lock);