Lines Matching refs:ip
55 struct xfs_inode *ip) in xfs_get_extsz_hint() argument
61 if (xfs_is_always_cow_inode(ip)) in xfs_get_extsz_hint()
63 if ((ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE) && ip->i_d.di_extsize) in xfs_get_extsz_hint()
64 return ip->i_d.di_extsize; in xfs_get_extsz_hint()
65 if (XFS_IS_REALTIME_INODE(ip)) in xfs_get_extsz_hint()
66 return ip->i_mount->m_sb.sb_rextsize; in xfs_get_extsz_hint()
78 struct xfs_inode *ip) in xfs_get_cowextsz_hint() argument
83 if (ip->i_d.di_flags2 & XFS_DIFLAG2_COWEXTSIZE) in xfs_get_cowextsz_hint()
84 a = ip->i_d.di_cowextsize; in xfs_get_cowextsz_hint()
85 b = xfs_get_extsz_hint(ip); in xfs_get_cowextsz_hint()
110 struct xfs_inode *ip) in xfs_ilock_data_map_shared() argument
114 if (ip->i_df.if_format == XFS_DINODE_FMT_BTREE && in xfs_ilock_data_map_shared()
115 (ip->i_df.if_flags & XFS_IFEXTENTS) == 0) in xfs_ilock_data_map_shared()
117 xfs_ilock(ip, lock_mode); in xfs_ilock_data_map_shared()
123 struct xfs_inode *ip) in xfs_ilock_attr_map_shared() argument
127 if (ip->i_afp && in xfs_ilock_attr_map_shared()
128 ip->i_afp->if_format == XFS_DINODE_FMT_BTREE && in xfs_ilock_attr_map_shared()
129 (ip->i_afp->if_flags & XFS_IFEXTENTS) == 0) in xfs_ilock_attr_map_shared()
131 xfs_ilock(ip, lock_mode); in xfs_ilock_attr_map_shared()
167 xfs_inode_t *ip, in xfs_ilock() argument
170 trace_xfs_ilock(ip, lock_flags, _RET_IP_); in xfs_ilock()
186 down_write_nested(&VFS_I(ip)->i_rwsem, in xfs_ilock()
189 down_read_nested(&VFS_I(ip)->i_rwsem, in xfs_ilock()
194 mrupdate_nested(&ip->i_mmaplock, XFS_MMAPLOCK_DEP(lock_flags)); in xfs_ilock()
196 mraccess_nested(&ip->i_mmaplock, XFS_MMAPLOCK_DEP(lock_flags)); in xfs_ilock()
199 mrupdate_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags)); in xfs_ilock()
201 mraccess_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags)); in xfs_ilock()
218 xfs_inode_t *ip, in xfs_ilock_nowait() argument
221 trace_xfs_ilock_nowait(ip, lock_flags, _RET_IP_); in xfs_ilock_nowait()
237 if (!down_write_trylock(&VFS_I(ip)->i_rwsem)) in xfs_ilock_nowait()
240 if (!down_read_trylock(&VFS_I(ip)->i_rwsem)) in xfs_ilock_nowait()
245 if (!mrtryupdate(&ip->i_mmaplock)) in xfs_ilock_nowait()
248 if (!mrtryaccess(&ip->i_mmaplock)) in xfs_ilock_nowait()
253 if (!mrtryupdate(&ip->i_lock)) in xfs_ilock_nowait()
256 if (!mrtryaccess(&ip->i_lock)) in xfs_ilock_nowait()
263 mrunlock_excl(&ip->i_mmaplock); in xfs_ilock_nowait()
265 mrunlock_shared(&ip->i_mmaplock); in xfs_ilock_nowait()
268 up_write(&VFS_I(ip)->i_rwsem); in xfs_ilock_nowait()
270 up_read(&VFS_I(ip)->i_rwsem); in xfs_ilock_nowait()
289 xfs_inode_t *ip, in xfs_iunlock() argument
307 up_write(&VFS_I(ip)->i_rwsem); in xfs_iunlock()
309 up_read(&VFS_I(ip)->i_rwsem); in xfs_iunlock()
312 mrunlock_excl(&ip->i_mmaplock); in xfs_iunlock()
314 mrunlock_shared(&ip->i_mmaplock); in xfs_iunlock()
317 mrunlock_excl(&ip->i_lock); in xfs_iunlock()
319 mrunlock_shared(&ip->i_lock); in xfs_iunlock()
321 trace_xfs_iunlock(ip, lock_flags, _RET_IP_); in xfs_iunlock()
330 xfs_inode_t *ip, in xfs_ilock_demote() argument
338 mrdemote(&ip->i_lock); in xfs_ilock_demote()
340 mrdemote(&ip->i_mmaplock); in xfs_ilock_demote()
342 downgrade_write(&VFS_I(ip)->i_rwsem); in xfs_ilock_demote()
344 trace_xfs_ilock_demote(ip, lock_flags, _RET_IP_); in xfs_ilock_demote()
350 xfs_inode_t *ip, in xfs_isilocked() argument
355 return !!ip->i_lock.mr_writer; in xfs_isilocked()
356 return rwsem_is_locked(&ip->i_lock.mr_lock); in xfs_isilocked()
361 return !!ip->i_mmaplock.mr_writer; in xfs_isilocked()
362 return rwsem_is_locked(&ip->i_mmaplock.mr_lock); in xfs_isilocked()
368 lockdep_is_held_type(&VFS_I(ip)->i_rwsem, 0); in xfs_isilocked()
369 return rwsem_is_locked(&VFS_I(ip)->i_rwsem); in xfs_isilocked()
655 struct xfs_inode *ip) in xfs_ip2xflags() argument
657 struct xfs_icdinode *dic = &ip->i_d; in xfs_ip2xflags()
659 return _xfs_dic2xflags(dic->di_flags, dic->di_flags2, XFS_IFORK_Q(ip)); in xfs_ip2xflags()
704 struct xfs_inode *ip, in xfs_inode_inherit_flags() argument
708 umode_t mode = VFS_I(ip)->i_mode; in xfs_inode_inherit_flags()
715 ip->i_d.di_extsize = pip->i_d.di_extsize; in xfs_inode_inherit_flags()
721 xfs_sb_version_hasrealtime(&ip->i_mount->m_sb)) in xfs_inode_inherit_flags()
725 ip->i_d.di_extsize = pip->i_d.di_extsize; in xfs_inode_inherit_flags()
746 ip->i_d.di_flags |= di_flags; in xfs_inode_inherit_flags()
752 struct xfs_inode *ip, in xfs_inode_inherit_flags2() argument
756 ip->i_d.di_flags2 |= XFS_DIFLAG2_COWEXTSIZE; in xfs_inode_inherit_flags2()
757 ip->i_d.di_cowextsize = pip->i_d.di_cowextsize; in xfs_inode_inherit_flags2()
760 ip->i_d.di_flags2 |= XFS_DIFLAG2_DAX; in xfs_inode_inherit_flags2()
808 xfs_inode_t *ip; in xfs_ialloc() local
846 XFS_ILOCK_EXCL, &ip); in xfs_ialloc()
849 ASSERT(ip != NULL); in xfs_ialloc()
850 inode = VFS_I(ip); in xfs_ialloc()
853 ip->i_d.di_projid = prid; in xfs_ialloc()
873 ip->i_d.di_size = 0; in xfs_ialloc()
874 ip->i_df.if_nextents = 0; in xfs_ialloc()
875 ASSERT(ip->i_d.di_nblocks == 0); in xfs_ialloc()
882 ip->i_d.di_extsize = 0; in xfs_ialloc()
883 ip->i_d.di_dmevmask = 0; in xfs_ialloc()
884 ip->i_d.di_dmstate = 0; in xfs_ialloc()
885 ip->i_d.di_flags = 0; in xfs_ialloc()
889 ip->i_d.di_flags2 = mp->m_ino_geo.new_diflags2; in xfs_ialloc()
890 ip->i_d.di_cowextsize = 0; in xfs_ialloc()
891 ip->i_d.di_crtime = tv; in xfs_ialloc()
900 ip->i_df.if_format = XFS_DINODE_FMT_DEV; in xfs_ialloc()
901 ip->i_df.if_flags = 0; in xfs_ialloc()
907 xfs_inode_inherit_flags(ip, pip); in xfs_ialloc()
909 xfs_inode_inherit_flags2(ip, pip); in xfs_ialloc()
912 ip->i_df.if_format = XFS_DINODE_FMT_EXTENTS; in xfs_ialloc()
913 ip->i_df.if_flags = XFS_IFEXTENTS; in xfs_ialloc()
914 ip->i_df.if_bytes = 0; in xfs_ialloc()
915 ip->i_df.if_u1.if_root = NULL; in xfs_ialloc()
924 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); in xfs_ialloc()
925 xfs_trans_log_inode(tp, ip, flags); in xfs_ialloc()
928 xfs_setup_inode(ip); in xfs_ialloc()
930 *ipp = ip; in xfs_ialloc()
958 xfs_inode_t *ip; in xfs_dir_ialloc() local
983 &ip); in xfs_dir_ialloc()
994 if (!ialloc_context && !ip) { in xfs_dir_ialloc()
1053 &ialloc_context, &ip); in xfs_dir_ialloc()
1064 ASSERT(!ialloc_context && ip); in xfs_dir_ialloc()
1068 *ipp = ip; in xfs_dir_ialloc()
1082 xfs_inode_t *ip) in xfs_droplink() argument
1084 xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); in xfs_droplink()
1086 drop_nlink(VFS_I(ip)); in xfs_droplink()
1087 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_droplink()
1089 if (VFS_I(ip)->i_nlink) in xfs_droplink()
1092 return xfs_iunlink(tp, ip); in xfs_droplink()
1101 xfs_inode_t *ip) in xfs_bumplink() argument
1103 xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); in xfs_bumplink()
1105 inc_nlink(VFS_I(ip)); in xfs_bumplink()
1106 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_bumplink()
1119 struct xfs_inode *ip = NULL; in xfs_create() local
1185 error = xfs_dir_ialloc(&tp, dp, mode, is_dir ? 2 : 1, rdev, prid, &ip); in xfs_create()
1199 error = xfs_dir_createname(tp, dp, name, ip->i_ino, in xfs_create()
1209 error = xfs_dir_init(tp, ip, dp); in xfs_create()
1229 xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp); in xfs_create()
1239 *ipp = ip; in xfs_create()
1250 if (ip) { in xfs_create()
1251 xfs_finish_inode_setup(ip); in xfs_create()
1252 xfs_irele(ip); in xfs_create()
1271 struct xfs_inode *ip = NULL; in xfs_create_tmpfile() local
1307 error = xfs_dir_ialloc(&tp, dp, mode, 0, 0, prid, &ip); in xfs_create_tmpfile()
1319 xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp); in xfs_create_tmpfile()
1321 error = xfs_iunlink(tp, ip); in xfs_create_tmpfile()
1333 *ipp = ip; in xfs_create_tmpfile()
1344 if (ip) { in xfs_create_tmpfile()
1345 xfs_finish_inode_setup(ip); in xfs_create_tmpfile()
1346 xfs_irele(ip); in xfs_create_tmpfile()
1450 struct xfs_inode *ip) in xfs_itruncate_clear_reflink_flags() argument
1455 if (!xfs_is_reflink_inode(ip)) in xfs_itruncate_clear_reflink_flags()
1457 dfork = XFS_IFORK_PTR(ip, XFS_DATA_FORK); in xfs_itruncate_clear_reflink_flags()
1458 cfork = XFS_IFORK_PTR(ip, XFS_COW_FORK); in xfs_itruncate_clear_reflink_flags()
1460 ip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK; in xfs_itruncate_clear_reflink_flags()
1462 xfs_inode_clear_cowblocks_tag(ip); in xfs_itruncate_clear_reflink_flags()
1489 struct xfs_inode *ip, in xfs_itruncate_extents_flags() argument
1494 struct xfs_mount *mp = ip->i_mount; in xfs_itruncate_extents_flags()
1500 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); in xfs_itruncate_extents_flags()
1501 ASSERT(!atomic_read(&VFS_I(ip)->i_count) || in xfs_itruncate_extents_flags()
1502 xfs_isilocked(ip, XFS_IOLOCK_EXCL)); in xfs_itruncate_extents_flags()
1503 ASSERT(new_size <= XFS_ISIZE(ip)); in xfs_itruncate_extents_flags()
1505 ASSERT(ip->i_itemp != NULL); in xfs_itruncate_extents_flags()
1506 ASSERT(ip->i_itemp->ili_lock_flags == 0); in xfs_itruncate_extents_flags()
1507 ASSERT(!XFS_NOT_DQATTACHED(mp, ip)); in xfs_itruncate_extents_flags()
1509 trace_xfs_itruncate_extents_start(ip, new_size); in xfs_itruncate_extents_flags()
1532 error = __xfs_bunmapi(tp, ip, first_unmap_block, &unmap_len, in xfs_itruncate_extents_flags()
1545 error = xfs_reflink_cancel_cow_blocks(ip, &tp, in xfs_itruncate_extents_flags()
1550 xfs_itruncate_clear_reflink_flags(ip); in xfs_itruncate_extents_flags()
1557 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_itruncate_extents_flags()
1559 trace_xfs_itruncate_extents_end(ip, new_size); in xfs_itruncate_extents_flags()
1568 xfs_inode_t *ip) in xfs_release() argument
1570 xfs_mount_t *mp = ip->i_mount; in xfs_release()
1573 if (!S_ISREG(VFS_I(ip)->i_mode) || (VFS_I(ip)->i_mode == 0)) in xfs_release()
1593 truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED); in xfs_release()
1595 xfs_iflags_clear(ip, XFS_IDIRTY_RELEASE); in xfs_release()
1596 if (ip->i_delayed_blks > 0) { in xfs_release()
1597 error = filemap_flush(VFS_I(ip)->i_mapping); in xfs_release()
1604 if (VFS_I(ip)->i_nlink == 0) in xfs_release()
1607 if (xfs_can_free_eofblocks(ip, false)) { in xfs_release()
1623 if (xfs_iflags_test(ip, XFS_IDIRTY_RELEASE)) in xfs_release()
1632 if (xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) { in xfs_release()
1633 error = xfs_free_eofblocks(ip); in xfs_release()
1634 xfs_iunlock(ip, XFS_IOLOCK_EXCL); in xfs_release()
1640 if (ip->i_delayed_blks) in xfs_release()
1641 xfs_iflags_set(ip, XFS_IDIRTY_RELEASE); in xfs_release()
1653 struct xfs_inode *ip) in xfs_inactive_truncate() argument
1655 struct xfs_mount *mp = ip->i_mount; in xfs_inactive_truncate()
1664 xfs_ilock(ip, XFS_ILOCK_EXCL); in xfs_inactive_truncate()
1665 xfs_trans_ijoin(tp, ip, 0); in xfs_inactive_truncate()
1672 ip->i_d.di_size = 0; in xfs_inactive_truncate()
1673 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_inactive_truncate()
1675 error = xfs_itruncate_extents(&tp, ip, XFS_DATA_FORK, 0); in xfs_inactive_truncate()
1679 ASSERT(ip->i_df.if_nextents == 0); in xfs_inactive_truncate()
1685 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_inactive_truncate()
1691 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_inactive_truncate()
1702 struct xfs_inode *ip) in xfs_inactive_ifree() argument
1704 struct xfs_mount *mp = ip->i_mount; in xfs_inactive_ifree()
1757 xfs_ilock(ip, XFS_ILOCK_EXCL); in xfs_inactive_ifree()
1758 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); in xfs_inactive_ifree()
1760 error = xfs_ifree(tp, ip); in xfs_inactive_ifree()
1761 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); in xfs_inactive_ifree()
1780 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_ICOUNT, -1); in xfs_inactive_ifree()
1804 xfs_inode_t *ip) in xfs_inactive() argument
1814 if (VFS_I(ip)->i_mode == 0) { in xfs_inactive()
1815 ASSERT(ip->i_df.if_broot_bytes == 0); in xfs_inactive()
1819 mp = ip->i_mount; in xfs_inactive()
1820 ASSERT(!xfs_iflags_test(ip, XFS_IRECOVERY)); in xfs_inactive()
1827 if (xfs_inode_has_cow_data(ip)) in xfs_inactive()
1828 xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true); in xfs_inactive()
1830 if (VFS_I(ip)->i_nlink != 0) { in xfs_inactive()
1840 if (xfs_can_free_eofblocks(ip, true)) in xfs_inactive()
1841 xfs_free_eofblocks(ip); in xfs_inactive()
1846 if (S_ISREG(VFS_I(ip)->i_mode) && in xfs_inactive()
1847 (ip->i_d.di_size != 0 || XFS_ISIZE(ip) != 0 || in xfs_inactive()
1848 ip->i_df.if_nextents > 0 || ip->i_delayed_blks > 0)) in xfs_inactive()
1851 error = xfs_qm_dqattach(ip); in xfs_inactive()
1855 if (S_ISLNK(VFS_I(ip)->i_mode)) in xfs_inactive()
1856 error = xfs_inactive_symlink(ip); in xfs_inactive()
1858 error = xfs_inactive_truncate(ip); in xfs_inactive()
1867 if (XFS_IFORK_Q(ip)) { in xfs_inactive()
1868 error = xfs_attr_inactive(ip); in xfs_inactive()
1873 ASSERT(!ip->i_afp); in xfs_inactive()
1874 ASSERT(ip->i_d.di_forkoff == 0); in xfs_inactive()
1879 error = xfs_inactive_ifree(ip); in xfs_inactive()
1886 xfs_qm_dqdetach(ip); in xfs_inactive()
2169 struct xfs_inode *ip, in xfs_iunlink_update_inode() argument
2182 error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &dip, &ibp, 0); in xfs_iunlink_update_inode()
2189 xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, dip, in xfs_iunlink_update_inode()
2203 xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, in xfs_iunlink_update_inode()
2211 xfs_iunlink_update_dinode(tp, agno, XFS_INO_TO_AGINO(mp, ip->i_ino), in xfs_iunlink_update_inode()
2212 ibp, dip, &ip->i_imap, next_agino); in xfs_iunlink_update_inode()
2229 struct xfs_inode *ip) in xfs_iunlink() argument
2235 xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, ip->i_ino); in xfs_iunlink()
2236 xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino); in xfs_iunlink()
2240 ASSERT(VFS_I(ip)->i_nlink == 0); in xfs_iunlink()
2241 ASSERT(VFS_I(ip)->i_mode != 0); in xfs_iunlink()
2242 trace_xfs_iunlink(ip); in xfs_iunlink()
2269 error = xfs_iunlink_update_inode(tp, ip, agno, next_agino, in xfs_iunlink()
2408 struct xfs_inode *ip) in xfs_iunlink_remove() argument
2415 xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, ip->i_ino); in xfs_iunlink_remove()
2416 xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino); in xfs_iunlink_remove()
2422 trace_xfs_iunlink_remove(ip); in xfs_iunlink_remove()
2446 error = xfs_iunlink_update_inode(tp, ip, agno, NULLAGINO, &next_agino); in xfs_iunlink_remove()
2510 struct xfs_inode *ip; in xfs_ifree_mark_inode_stale() local
2514 ip = radix_tree_lookup(&pag->pag_ici_root, XFS_INO_TO_AGINO(mp, inum)); in xfs_ifree_mark_inode_stale()
2517 if (!ip) { in xfs_ifree_mark_inode_stale()
2528 spin_lock(&ip->i_flags_lock); in xfs_ifree_mark_inode_stale()
2529 if (ip->i_ino != inum || __xfs_iflags_test(ip, XFS_ISTALE)) in xfs_ifree_mark_inode_stale()
2538 if (ip != free_ip) { in xfs_ifree_mark_inode_stale()
2539 if (!xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) { in xfs_ifree_mark_inode_stale()
2540 spin_unlock(&ip->i_flags_lock); in xfs_ifree_mark_inode_stale()
2546 ip->i_flags |= XFS_ISTALE; in xfs_ifree_mark_inode_stale()
2553 iip = ip->i_itemp; in xfs_ifree_mark_inode_stale()
2554 if (__xfs_iflags_test(ip, XFS_IFLUSHING)) { in xfs_ifree_mark_inode_stale()
2569 __xfs_iflags_set(ip, XFS_IFLUSHING); in xfs_ifree_mark_inode_stale()
2570 spin_unlock(&ip->i_flags_lock); in xfs_ifree_mark_inode_stale()
2581 if (ip != free_ip) in xfs_ifree_mark_inode_stale()
2582 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_ifree_mark_inode_stale()
2586 if (ip != free_ip) in xfs_ifree_mark_inode_stale()
2587 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_ifree_mark_inode_stale()
2589 spin_unlock(&ip->i_flags_lock); in xfs_ifree_mark_inode_stale()
2683 struct xfs_inode *ip) in xfs_ifree() argument
2687 struct xfs_inode_log_item *iip = ip->i_itemp; in xfs_ifree()
2689 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); in xfs_ifree()
2690 ASSERT(VFS_I(ip)->i_nlink == 0); in xfs_ifree()
2691 ASSERT(ip->i_df.if_nextents == 0); in xfs_ifree()
2692 ASSERT(ip->i_d.di_size == 0 || !S_ISREG(VFS_I(ip)->i_mode)); in xfs_ifree()
2693 ASSERT(ip->i_d.di_nblocks == 0); in xfs_ifree()
2701 error = xfs_difree(tp, ip->i_ino, &xic); in xfs_ifree()
2705 error = xfs_iunlink_remove(tp, ip); in xfs_ifree()
2714 if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) { in xfs_ifree()
2715 kmem_free(ip->i_df.if_u1.if_data); in xfs_ifree()
2716 ip->i_df.if_u1.if_data = NULL; in xfs_ifree()
2717 ip->i_df.if_bytes = 0; in xfs_ifree()
2720 VFS_I(ip)->i_mode = 0; /* mark incore inode as free */ in xfs_ifree()
2721 ip->i_d.di_flags = 0; in xfs_ifree()
2722 ip->i_d.di_flags2 = ip->i_mount->m_ino_geo.new_diflags2; in xfs_ifree()
2723 ip->i_d.di_dmevmask = 0; in xfs_ifree()
2724 ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */ in xfs_ifree()
2725 ip->i_df.if_format = XFS_DINODE_FMT_EXTENTS; in xfs_ifree()
2736 VFS_I(ip)->i_generation++; in xfs_ifree()
2737 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_ifree()
2740 error = xfs_ifree_cluster(ip, tp, &xic); in xfs_ifree()
2752 struct xfs_inode *ip) in xfs_iunpin() argument
2754 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); in xfs_iunpin()
2756 trace_xfs_inode_unpin_nowait(ip, _RET_IP_); in xfs_iunpin()
2759 xfs_log_force_seq(ip->i_mount, ip->i_itemp->ili_commit_seq, 0, NULL); in xfs_iunpin()
2765 struct xfs_inode *ip) in __xfs_iunpin_wait() argument
2767 wait_queue_head_t *wq = bit_waitqueue(&ip->i_flags, __XFS_IPINNED_BIT); in __xfs_iunpin_wait()
2768 DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_IPINNED_BIT); in __xfs_iunpin_wait()
2770 xfs_iunpin(ip); in __xfs_iunpin_wait()
2774 if (xfs_ipincount(ip)) in __xfs_iunpin_wait()
2776 } while (xfs_ipincount(ip)); in __xfs_iunpin_wait()
2782 struct xfs_inode *ip) in xfs_iunpin_wait() argument
2784 if (xfs_ipincount(ip)) in xfs_iunpin_wait()
2785 __xfs_iunpin_wait(ip); in xfs_iunpin_wait()
2819 xfs_inode_t *ip) in xfs_remove() argument
2823 int is_dir = S_ISDIR(VFS_I(ip)->i_mode); in xfs_remove()
2836 error = xfs_qm_dqattach(ip); in xfs_remove()
2861 xfs_lock_two_inodes(dp, XFS_ILOCK_EXCL, ip, XFS_ILOCK_EXCL); in xfs_remove()
2864 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); in xfs_remove()
2870 ASSERT(VFS_I(ip)->i_nlink >= 2); in xfs_remove()
2871 if (VFS_I(ip)->i_nlink != 2) { in xfs_remove()
2875 if (!xfs_dir_isempty(ip)) { in xfs_remove()
2886 error = xfs_droplink(tp, ip); in xfs_remove()
2900 error = xfs_droplink(tp, ip); in xfs_remove()
2904 error = xfs_dir_removename(tp, dp, name, ip->i_ino, resblks); in xfs_remove()
2922 if (is_dir && xfs_inode_is_filestream(ip)) in xfs_remove()
2923 xfs_filestream_deassociate(ip); in xfs_remove()
3446 struct xfs_inode *ip, in xfs_iflush() argument
3449 struct xfs_inode_log_item *iip = ip->i_itemp; in xfs_iflush()
3451 struct xfs_mount *mp = ip->i_mount; in xfs_iflush()
3454 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); in xfs_iflush()
3455 ASSERT(xfs_iflags_test(ip, XFS_IFLUSHING)); in xfs_iflush()
3456 ASSERT(ip->i_df.if_format != XFS_DINODE_FMT_BTREE || in xfs_iflush()
3457 ip->i_df.if_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)); in xfs_iflush()
3460 dip = xfs_buf_offset(bp, ip->i_imap.im_boffset); in xfs_iflush()
3473 __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip); in xfs_iflush()
3476 if (S_ISREG(VFS_I(ip)->i_mode)) { in xfs_iflush()
3478 ip->i_df.if_format != XFS_DINODE_FMT_EXTENTS && in xfs_iflush()
3479 ip->i_df.if_format != XFS_DINODE_FMT_BTREE, in xfs_iflush()
3483 __func__, ip->i_ino, ip); in xfs_iflush()
3486 } else if (S_ISDIR(VFS_I(ip)->i_mode)) { in xfs_iflush()
3488 ip->i_df.if_format != XFS_DINODE_FMT_EXTENTS && in xfs_iflush()
3489 ip->i_df.if_format != XFS_DINODE_FMT_BTREE && in xfs_iflush()
3490 ip->i_df.if_format != XFS_DINODE_FMT_LOCAL, in xfs_iflush()
3494 __func__, ip->i_ino, ip); in xfs_iflush()
3498 if (XFS_TEST_ERROR(ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp) > in xfs_iflush()
3499 ip->i_d.di_nblocks, mp, XFS_ERRTAG_IFLUSH_5)) { in xfs_iflush()
3503 __func__, ip->i_ino, in xfs_iflush()
3504 ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp), in xfs_iflush()
3505 ip->i_d.di_nblocks, ip); in xfs_iflush()
3508 if (XFS_TEST_ERROR(ip->i_d.di_forkoff > mp->m_sb.sb_inodesize, in xfs_iflush()
3512 __func__, ip->i_ino, ip->i_d.di_forkoff, ip); in xfs_iflush()
3526 ip->i_d.di_flushiter++; in xfs_iflush()
3532 if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL && in xfs_iflush()
3533 xfs_ifork_verify_local_data(ip)) in xfs_iflush()
3535 if (ip->i_afp && ip->i_afp->if_format == XFS_DINODE_FMT_LOCAL && in xfs_iflush()
3536 xfs_ifork_verify_local_attr(ip)) in xfs_iflush()
3544 xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn); in xfs_iflush()
3547 if (ip->i_d.di_flushiter == DI_MAX_FLUSH) in xfs_iflush()
3548 ip->i_d.di_flushiter = 0; in xfs_iflush()
3550 xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK); in xfs_iflush()
3551 if (XFS_IFORK_Q(ip)) in xfs_iflush()
3552 xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK); in xfs_iflush()
3609 struct xfs_inode *ip; in xfs_iflush_cluster() local
3620 ip = iip->ili_inode; in xfs_iflush_cluster()
3625 if (__xfs_iflags_test(ip, XFS_IRECLAIM | XFS_IFLUSHING)) in xfs_iflush_cluster()
3627 if (xfs_ipincount(ip)) in xfs_iflush_cluster()
3637 spin_lock(&ip->i_flags_lock); in xfs_iflush_cluster()
3638 ASSERT(!__xfs_iflags_test(ip, XFS_ISTALE)); in xfs_iflush_cluster()
3639 if (__xfs_iflags_test(ip, XFS_IRECLAIM | XFS_IFLUSHING)) { in xfs_iflush_cluster()
3640 spin_unlock(&ip->i_flags_lock); in xfs_iflush_cluster()
3650 if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) { in xfs_iflush_cluster()
3651 spin_unlock(&ip->i_flags_lock); in xfs_iflush_cluster()
3654 __xfs_iflags_set(ip, XFS_IFLUSHING); in xfs_iflush_cluster()
3655 spin_unlock(&ip->i_flags_lock); in xfs_iflush_cluster()
3665 xfs_iunpin_wait(ip); in xfs_iflush_cluster()
3666 xfs_iflush_abort(ip); in xfs_iflush_cluster()
3667 xfs_iunlock(ip, XFS_ILOCK_SHARED); in xfs_iflush_cluster()
3673 if (xfs_ipincount(ip)) { in xfs_iflush_cluster()
3674 xfs_iflags_clear(ip, XFS_IFLUSHING); in xfs_iflush_cluster()
3675 xfs_iunlock(ip, XFS_ILOCK_SHARED); in xfs_iflush_cluster()
3679 if (!xfs_inode_clean(ip)) in xfs_iflush_cluster()
3680 error = xfs_iflush(ip, bp); in xfs_iflush_cluster()
3682 xfs_iflags_clear(ip, XFS_IFLUSHING); in xfs_iflush_cluster()
3683 xfs_iunlock(ip, XFS_ILOCK_SHARED); in xfs_iflush_cluster()
3708 struct xfs_inode *ip) in xfs_irele() argument
3710 trace_xfs_irele(ip, _RET_IP_); in xfs_irele()
3711 iput(VFS_I(ip)); in xfs_irele()
3719 struct xfs_inode *ip) in xfs_log_force_inode() argument
3723 xfs_ilock(ip, XFS_ILOCK_SHARED); in xfs_log_force_inode()
3724 if (xfs_ipincount(ip)) in xfs_log_force_inode()
3725 seq = ip->i_itemp->ili_commit_seq; in xfs_log_force_inode()
3726 xfs_iunlock(ip, XFS_ILOCK_SHARED); in xfs_log_force_inode()
3730 return xfs_log_force_seq(ip->i_mount, seq, XFS_LOG_SYNC, NULL); in xfs_log_force_inode()