Lines Matching refs:ip
56 struct xfs_inode *ip) in xfs_get_extsz_hint() argument
62 if (xfs_is_always_cow_inode(ip)) in xfs_get_extsz_hint()
64 if ((ip->i_diflags & XFS_DIFLAG_EXTSIZE) && ip->i_extsize) in xfs_get_extsz_hint()
65 return ip->i_extsize; in xfs_get_extsz_hint()
66 if (XFS_IS_REALTIME_INODE(ip)) in xfs_get_extsz_hint()
67 return ip->i_mount->m_sb.sb_rextsize; in xfs_get_extsz_hint()
79 struct xfs_inode *ip) in xfs_get_cowextsz_hint() argument
84 if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE) in xfs_get_cowextsz_hint()
85 a = ip->i_cowextsize; in xfs_get_cowextsz_hint()
86 b = xfs_get_extsz_hint(ip); in xfs_get_cowextsz_hint()
111 struct xfs_inode *ip) in xfs_ilock_data_map_shared() argument
115 if (xfs_need_iread_extents(&ip->i_df)) 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 && xfs_need_iread_extents(ip->i_afp)) in xfs_ilock_attr_map_shared()
129 xfs_ilock(ip, lock_mode); in xfs_ilock_attr_map_shared()
165 xfs_inode_t *ip, in xfs_ilock() argument
168 trace_xfs_ilock(ip, lock_flags, _RET_IP_); in xfs_ilock()
184 down_write_nested(&VFS_I(ip)->i_rwsem, in xfs_ilock()
187 down_read_nested(&VFS_I(ip)->i_rwsem, in xfs_ilock()
192 down_write_nested(&VFS_I(ip)->i_mapping->invalidate_lock, in xfs_ilock()
195 down_read_nested(&VFS_I(ip)->i_mapping->invalidate_lock, in xfs_ilock()
200 mrupdate_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags)); in xfs_ilock()
202 mraccess_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags)); in xfs_ilock()
219 xfs_inode_t *ip, in xfs_ilock_nowait() argument
222 trace_xfs_ilock_nowait(ip, lock_flags, _RET_IP_); in xfs_ilock_nowait()
238 if (!down_write_trylock(&VFS_I(ip)->i_rwsem)) in xfs_ilock_nowait()
241 if (!down_read_trylock(&VFS_I(ip)->i_rwsem)) in xfs_ilock_nowait()
246 if (!down_write_trylock(&VFS_I(ip)->i_mapping->invalidate_lock)) in xfs_ilock_nowait()
249 if (!down_read_trylock(&VFS_I(ip)->i_mapping->invalidate_lock)) in xfs_ilock_nowait()
254 if (!mrtryupdate(&ip->i_lock)) in xfs_ilock_nowait()
257 if (!mrtryaccess(&ip->i_lock)) in xfs_ilock_nowait()
264 up_write(&VFS_I(ip)->i_mapping->invalidate_lock); in xfs_ilock_nowait()
266 up_read(&VFS_I(ip)->i_mapping->invalidate_lock); in xfs_ilock_nowait()
269 up_write(&VFS_I(ip)->i_rwsem); in xfs_ilock_nowait()
271 up_read(&VFS_I(ip)->i_rwsem); in xfs_ilock_nowait()
290 xfs_inode_t *ip, in xfs_iunlock() argument
308 up_write(&VFS_I(ip)->i_rwsem); in xfs_iunlock()
310 up_read(&VFS_I(ip)->i_rwsem); in xfs_iunlock()
313 up_write(&VFS_I(ip)->i_mapping->invalidate_lock); in xfs_iunlock()
315 up_read(&VFS_I(ip)->i_mapping->invalidate_lock); in xfs_iunlock()
318 mrunlock_excl(&ip->i_lock); in xfs_iunlock()
320 mrunlock_shared(&ip->i_lock); in xfs_iunlock()
322 trace_xfs_iunlock(ip, lock_flags, _RET_IP_); in xfs_iunlock()
331 xfs_inode_t *ip, in xfs_ilock_demote() argument
339 mrdemote(&ip->i_lock); in xfs_ilock_demote()
341 downgrade_write(&VFS_I(ip)->i_mapping->invalidate_lock); in xfs_ilock_demote()
343 downgrade_write(&VFS_I(ip)->i_rwsem); in xfs_ilock_demote()
345 trace_xfs_ilock_demote(ip, lock_flags, _RET_IP_); in xfs_ilock_demote()
371 struct xfs_inode *ip, in xfs_isilocked() argument
376 return !!ip->i_lock.mr_writer; in xfs_isilocked()
377 return rwsem_is_locked(&ip->i_lock.mr_lock); in xfs_isilocked()
381 return __xfs_rwsem_islocked(&VFS_I(ip)->i_rwsem, in xfs_isilocked()
386 return __xfs_rwsem_islocked(&VFS_I(ip)->i_rwsem, in xfs_isilocked()
606 struct xfs_inode *ip) in xfs_ip2xflags() argument
610 if (ip->i_diflags & XFS_DIFLAG_ANY) { in xfs_ip2xflags()
611 if (ip->i_diflags & XFS_DIFLAG_REALTIME) in xfs_ip2xflags()
613 if (ip->i_diflags & XFS_DIFLAG_PREALLOC) in xfs_ip2xflags()
615 if (ip->i_diflags & XFS_DIFLAG_IMMUTABLE) in xfs_ip2xflags()
617 if (ip->i_diflags & XFS_DIFLAG_APPEND) in xfs_ip2xflags()
619 if (ip->i_diflags & XFS_DIFLAG_SYNC) in xfs_ip2xflags()
621 if (ip->i_diflags & XFS_DIFLAG_NOATIME) in xfs_ip2xflags()
623 if (ip->i_diflags & XFS_DIFLAG_NODUMP) in xfs_ip2xflags()
625 if (ip->i_diflags & XFS_DIFLAG_RTINHERIT) in xfs_ip2xflags()
627 if (ip->i_diflags & XFS_DIFLAG_PROJINHERIT) in xfs_ip2xflags()
629 if (ip->i_diflags & XFS_DIFLAG_NOSYMLINKS) in xfs_ip2xflags()
631 if (ip->i_diflags & XFS_DIFLAG_EXTSIZE) in xfs_ip2xflags()
633 if (ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT) in xfs_ip2xflags()
635 if (ip->i_diflags & XFS_DIFLAG_NODEFRAG) in xfs_ip2xflags()
637 if (ip->i_diflags & XFS_DIFLAG_FILESTREAM) in xfs_ip2xflags()
641 if (ip->i_diflags2 & XFS_DIFLAG2_ANY) { in xfs_ip2xflags()
642 if (ip->i_diflags2 & XFS_DIFLAG2_DAX) in xfs_ip2xflags()
644 if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE) in xfs_ip2xflags()
648 if (XFS_IFORK_Q(ip)) in xfs_ip2xflags()
695 struct xfs_inode *ip, in xfs_inode_inherit_flags() argument
700 umode_t mode = VFS_I(ip)->i_mode; in xfs_inode_inherit_flags()
707 ip->i_extsize = pip->i_extsize; in xfs_inode_inherit_flags()
713 xfs_has_realtime(ip->i_mount)) in xfs_inode_inherit_flags()
717 ip->i_extsize = pip->i_extsize; in xfs_inode_inherit_flags()
738 ip->i_diflags |= di_flags; in xfs_inode_inherit_flags()
750 failaddr = xfs_inode_validate_extsize(ip->i_mount, ip->i_extsize, in xfs_inode_inherit_flags()
751 VFS_I(ip)->i_mode, ip->i_diflags); in xfs_inode_inherit_flags()
753 ip->i_diflags &= ~(XFS_DIFLAG_EXTSIZE | in xfs_inode_inherit_flags()
755 ip->i_extsize = 0; in xfs_inode_inherit_flags()
762 struct xfs_inode *ip, in xfs_inode_inherit_flags2() argument
768 ip->i_diflags2 |= XFS_DIFLAG2_COWEXTSIZE; in xfs_inode_inherit_flags2()
769 ip->i_cowextsize = pip->i_cowextsize; in xfs_inode_inherit_flags2()
772 ip->i_diflags2 |= XFS_DIFLAG2_DAX; in xfs_inode_inherit_flags2()
775 failaddr = xfs_inode_validate_cowextsize(ip->i_mount, ip->i_cowextsize, in xfs_inode_inherit_flags2()
776 VFS_I(ip)->i_mode, ip->i_diflags, ip->i_diflags2); in xfs_inode_inherit_flags2()
778 ip->i_diflags2 &= ~XFS_DIFLAG2_COWEXTSIZE; in xfs_inode_inherit_flags2()
779 ip->i_cowextsize = 0; in xfs_inode_inherit_flags2()
802 struct xfs_inode *ip; in xfs_init_new_inode() local
824 error = xfs_iget(mp, tp, ino, XFS_IGET_CREATE, XFS_ILOCK_EXCL, &ip); in xfs_init_new_inode()
828 ASSERT(ip != NULL); in xfs_init_new_inode()
829 inode = VFS_I(ip); in xfs_init_new_inode()
832 ip->i_projid = prid; in xfs_init_new_inode()
852 ip->i_disk_size = 0; in xfs_init_new_inode()
853 ip->i_df.if_nextents = 0; in xfs_init_new_inode()
854 ASSERT(ip->i_nblocks == 0); in xfs_init_new_inode()
861 ip->i_extsize = 0; in xfs_init_new_inode()
862 ip->i_diflags = 0; in xfs_init_new_inode()
866 ip->i_cowextsize = 0; in xfs_init_new_inode()
867 ip->i_crtime = tv; in xfs_init_new_inode()
876 ip->i_df.if_format = XFS_DINODE_FMT_DEV; in xfs_init_new_inode()
882 xfs_inode_inherit_flags(ip, pip); in xfs_init_new_inode()
884 xfs_inode_inherit_flags2(ip, pip); in xfs_init_new_inode()
887 ip->i_df.if_format = XFS_DINODE_FMT_EXTENTS; in xfs_init_new_inode()
888 ip->i_df.if_bytes = 0; in xfs_init_new_inode()
889 ip->i_df.if_u1.if_root = NULL; in xfs_init_new_inode()
905 ip->i_forkoff = xfs_default_attroffset(ip) >> 3; in xfs_init_new_inode()
906 ip->i_afp = xfs_ifork_alloc(XFS_DINODE_FMT_EXTENTS, 0); in xfs_init_new_inode()
912 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); in xfs_init_new_inode()
913 xfs_trans_log_inode(tp, ip, flags); in xfs_init_new_inode()
916 xfs_setup_inode(ip); in xfs_init_new_inode()
918 *ipp = ip; in xfs_init_new_inode()
930 xfs_inode_t *ip) in xfs_droplink() argument
932 xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); in xfs_droplink()
934 drop_nlink(VFS_I(ip)); in xfs_droplink()
935 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_droplink()
937 if (VFS_I(ip)->i_nlink) in xfs_droplink()
940 return xfs_iunlink(tp, ip); in xfs_droplink()
949 xfs_inode_t *ip) in xfs_bumplink() argument
951 xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG); in xfs_bumplink()
953 inc_nlink(VFS_I(ip)); in xfs_bumplink()
954 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_bumplink()
969 struct xfs_inode *ip = NULL; in xfs_create() local
1039 is_dir ? 2 : 1, rdev, prid, init_xattrs, &ip); in xfs_create()
1053 error = xfs_dir_createname(tp, dp, name, ip->i_ino, in xfs_create()
1063 error = xfs_dir_init(tp, ip, dp); in xfs_create()
1083 xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp); in xfs_create()
1093 *ipp = ip; in xfs_create()
1104 if (ip) { in xfs_create()
1105 xfs_finish_inode_setup(ip); in xfs_create()
1106 xfs_irele(ip); in xfs_create()
1126 struct xfs_inode *ip = NULL; in xfs_create_tmpfile() local
1163 0, 0, prid, false, &ip); in xfs_create_tmpfile()
1175 xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp); in xfs_create_tmpfile()
1177 error = xfs_iunlink(tp, ip); in xfs_create_tmpfile()
1189 *ipp = ip; in xfs_create_tmpfile()
1200 if (ip) { in xfs_create_tmpfile()
1201 xfs_finish_inode_setup(ip); in xfs_create_tmpfile()
1202 xfs_irele(ip); in xfs_create_tmpfile()
1315 struct xfs_inode *ip) in xfs_itruncate_clear_reflink_flags() argument
1320 if (!xfs_is_reflink_inode(ip)) in xfs_itruncate_clear_reflink_flags()
1322 dfork = XFS_IFORK_PTR(ip, XFS_DATA_FORK); in xfs_itruncate_clear_reflink_flags()
1323 cfork = XFS_IFORK_PTR(ip, XFS_COW_FORK); in xfs_itruncate_clear_reflink_flags()
1325 ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK; in xfs_itruncate_clear_reflink_flags()
1327 xfs_inode_clear_cowblocks_tag(ip); in xfs_itruncate_clear_reflink_flags()
1354 struct xfs_inode *ip, in xfs_itruncate_extents_flags() argument
1359 struct xfs_mount *mp = ip->i_mount; in xfs_itruncate_extents_flags()
1365 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); in xfs_itruncate_extents_flags()
1366 ASSERT(!atomic_read(&VFS_I(ip)->i_count) || in xfs_itruncate_extents_flags()
1367 xfs_isilocked(ip, XFS_IOLOCK_EXCL)); in xfs_itruncate_extents_flags()
1368 ASSERT(new_size <= XFS_ISIZE(ip)); in xfs_itruncate_extents_flags()
1370 ASSERT(ip->i_itemp != NULL); in xfs_itruncate_extents_flags()
1371 ASSERT(ip->i_itemp->ili_lock_flags == 0); in xfs_itruncate_extents_flags()
1372 ASSERT(!XFS_NOT_DQATTACHED(mp, ip)); in xfs_itruncate_extents_flags()
1374 trace_xfs_itruncate_extents_start(ip, new_size); in xfs_itruncate_extents_flags()
1397 error = __xfs_bunmapi(tp, ip, first_unmap_block, &unmap_len, in xfs_itruncate_extents_flags()
1410 error = xfs_reflink_cancel_cow_blocks(ip, &tp, in xfs_itruncate_extents_flags()
1415 xfs_itruncate_clear_reflink_flags(ip); in xfs_itruncate_extents_flags()
1422 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_itruncate_extents_flags()
1424 trace_xfs_itruncate_extents_end(ip, new_size); in xfs_itruncate_extents_flags()
1433 xfs_inode_t *ip) in xfs_release() argument
1435 xfs_mount_t *mp = ip->i_mount; in xfs_release()
1438 if (!S_ISREG(VFS_I(ip)->i_mode) || (VFS_I(ip)->i_mode == 0)) in xfs_release()
1458 truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED); in xfs_release()
1460 xfs_iflags_clear(ip, XFS_IDIRTY_RELEASE); in xfs_release()
1461 if (ip->i_delayed_blks > 0) { in xfs_release()
1462 error = filemap_flush(VFS_I(ip)->i_mapping); in xfs_release()
1469 if (VFS_I(ip)->i_nlink == 0) in xfs_release()
1478 if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) in xfs_release()
1481 if (xfs_can_free_eofblocks(ip, false)) { in xfs_release()
1496 if (xfs_iflags_test(ip, XFS_IDIRTY_RELEASE)) in xfs_release()
1499 error = xfs_free_eofblocks(ip); in xfs_release()
1504 if (ip->i_delayed_blks) in xfs_release()
1505 xfs_iflags_set(ip, XFS_IDIRTY_RELEASE); in xfs_release()
1509 xfs_iunlock(ip, XFS_IOLOCK_EXCL); in xfs_release()
1520 struct xfs_inode *ip) in xfs_inactive_truncate() argument
1522 struct xfs_mount *mp = ip->i_mount; in xfs_inactive_truncate()
1531 xfs_ilock(ip, XFS_ILOCK_EXCL); in xfs_inactive_truncate()
1532 xfs_trans_ijoin(tp, ip, 0); in xfs_inactive_truncate()
1539 ip->i_disk_size = 0; in xfs_inactive_truncate()
1540 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_inactive_truncate()
1542 error = xfs_itruncate_extents(&tp, ip, XFS_DATA_FORK, 0); in xfs_inactive_truncate()
1546 ASSERT(ip->i_df.if_nextents == 0); in xfs_inactive_truncate()
1552 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_inactive_truncate()
1558 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_inactive_truncate()
1569 struct xfs_inode *ip) in xfs_inactive_ifree() argument
1571 struct xfs_mount *mp = ip->i_mount; in xfs_inactive_ifree()
1624 xfs_ilock(ip, XFS_ILOCK_EXCL); in xfs_inactive_ifree()
1625 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); in xfs_inactive_ifree()
1627 error = xfs_ifree(tp, ip); in xfs_inactive_ifree()
1628 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); in xfs_inactive_ifree()
1647 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_ICOUNT, -1); in xfs_inactive_ifree()
1669 struct xfs_inode *ip) in xfs_inode_needs_inactive() argument
1671 struct xfs_mount *mp = ip->i_mount; in xfs_inode_needs_inactive()
1672 struct xfs_ifork *cow_ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK); in xfs_inode_needs_inactive()
1678 if (VFS_I(ip)->i_mode == 0) in xfs_inode_needs_inactive()
1690 if (xfs_is_metadata_inode(ip)) in xfs_inode_needs_inactive()
1698 if (VFS_I(ip)->i_nlink == 0) in xfs_inode_needs_inactive()
1711 return xfs_can_free_eofblocks(ip, true); in xfs_inode_needs_inactive()
1724 xfs_inode_t *ip) in xfs_inactive() argument
1734 if (VFS_I(ip)->i_mode == 0) { in xfs_inactive()
1735 ASSERT(ip->i_df.if_broot_bytes == 0); in xfs_inactive()
1739 mp = ip->i_mount; in xfs_inactive()
1740 ASSERT(!xfs_iflags_test(ip, XFS_IRECOVERY)); in xfs_inactive()
1747 if (xfs_is_metadata_inode(ip)) in xfs_inactive()
1751 if (xfs_inode_has_cow_data(ip)) in xfs_inactive()
1752 xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true); in xfs_inactive()
1754 if (VFS_I(ip)->i_nlink != 0) { in xfs_inactive()
1764 if (xfs_can_free_eofblocks(ip, true)) in xfs_inactive()
1765 xfs_free_eofblocks(ip); in xfs_inactive()
1770 if (S_ISREG(VFS_I(ip)->i_mode) && in xfs_inactive()
1771 (ip->i_disk_size != 0 || XFS_ISIZE(ip) != 0 || in xfs_inactive()
1772 ip->i_df.if_nextents > 0 || ip->i_delayed_blks > 0)) in xfs_inactive()
1775 error = xfs_qm_dqattach(ip); in xfs_inactive()
1779 if (S_ISLNK(VFS_I(ip)->i_mode)) in xfs_inactive()
1780 error = xfs_inactive_symlink(ip); in xfs_inactive()
1782 error = xfs_inactive_truncate(ip); in xfs_inactive()
1791 if (XFS_IFORK_Q(ip)) { in xfs_inactive()
1792 error = xfs_attr_inactive(ip); in xfs_inactive()
1797 ASSERT(!ip->i_afp); in xfs_inactive()
1798 ASSERT(ip->i_forkoff == 0); in xfs_inactive()
1803 xfs_inactive_ifree(ip); in xfs_inactive()
1810 xfs_qm_dqdetach(ip); in xfs_inactive()
2093 struct xfs_inode *ip, in xfs_iunlink_update_inode() argument
2106 error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &ibp); in xfs_iunlink_update_inode()
2109 dip = xfs_buf_offset(ibp, ip->i_imap.im_boffset); in xfs_iunlink_update_inode()
2114 xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, dip, in xfs_iunlink_update_inode()
2128 xfs_inode_verifier_error(ip, -EFSCORRUPTED, __func__, in xfs_iunlink_update_inode()
2136 xfs_iunlink_update_dinode(tp, pag, XFS_INO_TO_AGINO(mp, ip->i_ino), in xfs_iunlink_update_inode()
2137 ibp, dip, &ip->i_imap, next_agino); in xfs_iunlink_update_inode()
2154 struct xfs_inode *ip) in xfs_iunlink() argument
2161 xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino); in xfs_iunlink()
2165 ASSERT(VFS_I(ip)->i_nlink == 0); in xfs_iunlink()
2166 ASSERT(VFS_I(ip)->i_mode != 0); in xfs_iunlink()
2167 trace_xfs_iunlink(ip); in xfs_iunlink()
2169 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); in xfs_iunlink()
2197 error = xfs_iunlink_update_inode(tp, ip, pag, next_agino, in xfs_iunlink()
2341 struct xfs_inode *ip) in xfs_iunlink_remove() argument
2348 xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino); in xfs_iunlink_remove()
2354 trace_xfs_iunlink_remove(ip); in xfs_iunlink_remove()
2378 error = xfs_iunlink_update_inode(tp, ip, pag, NULLAGINO, &next_agino); in xfs_iunlink_remove()
2439 struct xfs_inode *ip; in xfs_ifree_mark_inode_stale() local
2443 ip = radix_tree_lookup(&pag->pag_ici_root, XFS_INO_TO_AGINO(mp, inum)); in xfs_ifree_mark_inode_stale()
2446 if (!ip) { in xfs_ifree_mark_inode_stale()
2457 spin_lock(&ip->i_flags_lock); in xfs_ifree_mark_inode_stale()
2458 if (ip->i_ino != inum || __xfs_iflags_test(ip, XFS_ISTALE)) in xfs_ifree_mark_inode_stale()
2467 if (ip != free_ip) { in xfs_ifree_mark_inode_stale()
2468 if (!xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) { in xfs_ifree_mark_inode_stale()
2469 spin_unlock(&ip->i_flags_lock); in xfs_ifree_mark_inode_stale()
2475 ip->i_flags |= XFS_ISTALE; in xfs_ifree_mark_inode_stale()
2482 iip = ip->i_itemp; in xfs_ifree_mark_inode_stale()
2483 if (__xfs_iflags_test(ip, XFS_IFLUSHING)) { in xfs_ifree_mark_inode_stale()
2498 __xfs_iflags_set(ip, XFS_IFLUSHING); in xfs_ifree_mark_inode_stale()
2499 spin_unlock(&ip->i_flags_lock); in xfs_ifree_mark_inode_stale()
2510 if (ip != free_ip) in xfs_ifree_mark_inode_stale()
2511 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_ifree_mark_inode_stale()
2515 if (ip != free_ip) in xfs_ifree_mark_inode_stale()
2516 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_ifree_mark_inode_stale()
2518 spin_unlock(&ip->i_flags_lock); in xfs_ifree_mark_inode_stale()
2614 struct xfs_inode *ip) in xfs_ifree() argument
2616 struct xfs_mount *mp = ip->i_mount; in xfs_ifree()
2619 struct xfs_inode_log_item *iip = ip->i_itemp; in xfs_ifree()
2622 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); in xfs_ifree()
2623 ASSERT(VFS_I(ip)->i_nlink == 0); in xfs_ifree()
2624 ASSERT(ip->i_df.if_nextents == 0); in xfs_ifree()
2625 ASSERT(ip->i_disk_size == 0 || !S_ISREG(VFS_I(ip)->i_mode)); in xfs_ifree()
2626 ASSERT(ip->i_nblocks == 0); in xfs_ifree()
2628 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); in xfs_ifree()
2633 error = xfs_iunlink_remove(tp, pag, ip); in xfs_ifree()
2637 error = xfs_difree(tp, pag, ip->i_ino, &xic); in xfs_ifree()
2646 if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) { in xfs_ifree()
2647 kmem_free(ip->i_df.if_u1.if_data); in xfs_ifree()
2648 ip->i_df.if_u1.if_data = NULL; in xfs_ifree()
2649 ip->i_df.if_bytes = 0; in xfs_ifree()
2652 VFS_I(ip)->i_mode = 0; /* mark incore inode as free */ in xfs_ifree()
2653 ip->i_diflags = 0; in xfs_ifree()
2654 ip->i_diflags2 = mp->m_ino_geo.new_diflags2; in xfs_ifree()
2655 ip->i_forkoff = 0; /* mark the attr fork not in use */ in xfs_ifree()
2656 ip->i_df.if_format = XFS_DINODE_FMT_EXTENTS; in xfs_ifree()
2657 if (xfs_iflags_test(ip, XFS_IPRESERVE_DM_FIELDS)) in xfs_ifree()
2658 xfs_iflags_clear(ip, XFS_IPRESERVE_DM_FIELDS); in xfs_ifree()
2669 VFS_I(ip)->i_generation++; in xfs_ifree()
2670 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_ifree()
2673 error = xfs_ifree_cluster(tp, pag, ip, &xic); in xfs_ifree()
2686 struct xfs_inode *ip) in xfs_iunpin() argument
2688 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); in xfs_iunpin()
2690 trace_xfs_inode_unpin_nowait(ip, _RET_IP_); in xfs_iunpin()
2693 xfs_log_force_seq(ip->i_mount, ip->i_itemp->ili_commit_seq, 0, NULL); in xfs_iunpin()
2699 struct xfs_inode *ip) in __xfs_iunpin_wait() argument
2701 wait_queue_head_t *wq = bit_waitqueue(&ip->i_flags, __XFS_IPINNED_BIT); in __xfs_iunpin_wait()
2702 DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_IPINNED_BIT); in __xfs_iunpin_wait()
2704 xfs_iunpin(ip); in __xfs_iunpin_wait()
2708 if (xfs_ipincount(ip)) in __xfs_iunpin_wait()
2710 } while (xfs_ipincount(ip)); in __xfs_iunpin_wait()
2716 struct xfs_inode *ip) in xfs_iunpin_wait() argument
2718 if (xfs_ipincount(ip)) in xfs_iunpin_wait()
2719 __xfs_iunpin_wait(ip); in xfs_iunpin_wait()
2753 xfs_inode_t *ip) in xfs_remove() argument
2757 int is_dir = S_ISDIR(VFS_I(ip)->i_mode); in xfs_remove()
2770 error = xfs_qm_dqattach(ip); in xfs_remove()
2795 xfs_lock_two_inodes(dp, XFS_ILOCK_EXCL, ip, XFS_ILOCK_EXCL); in xfs_remove()
2798 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); in xfs_remove()
2804 ASSERT(VFS_I(ip)->i_nlink >= 2); in xfs_remove()
2805 if (VFS_I(ip)->i_nlink != 2) { in xfs_remove()
2809 if (!xfs_dir_isempty(ip)) { in xfs_remove()
2820 error = xfs_droplink(tp, ip); in xfs_remove()
2831 error = xfs_dir_replace(tp, ip, &xfs_name_dotdot, in xfs_remove()
2847 error = xfs_droplink(tp, ip); in xfs_remove()
2851 error = xfs_dir_removename(tp, dp, name, ip->i_ino, resblks); in xfs_remove()
2869 if (is_dir && xfs_inode_is_filestream(ip)) in xfs_remove()
2870 xfs_filestream_deassociate(ip); in xfs_remove()
3443 struct xfs_inode *ip, in xfs_iflush() argument
3446 struct xfs_inode_log_item *iip = ip->i_itemp; in xfs_iflush()
3448 struct xfs_mount *mp = ip->i_mount; in xfs_iflush()
3451 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); in xfs_iflush()
3452 ASSERT(xfs_iflags_test(ip, XFS_IFLUSHING)); in xfs_iflush()
3453 ASSERT(ip->i_df.if_format != XFS_DINODE_FMT_BTREE || in xfs_iflush()
3454 ip->i_df.if_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)); in xfs_iflush()
3457 dip = xfs_buf_offset(bp, ip->i_imap.im_boffset); in xfs_iflush()
3470 __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip); in xfs_iflush()
3473 if (S_ISREG(VFS_I(ip)->i_mode)) { in xfs_iflush()
3475 ip->i_df.if_format != XFS_DINODE_FMT_EXTENTS && in xfs_iflush()
3476 ip->i_df.if_format != XFS_DINODE_FMT_BTREE, in xfs_iflush()
3480 __func__, ip->i_ino, ip); in xfs_iflush()
3483 } else if (S_ISDIR(VFS_I(ip)->i_mode)) { in xfs_iflush()
3485 ip->i_df.if_format != XFS_DINODE_FMT_EXTENTS && in xfs_iflush()
3486 ip->i_df.if_format != XFS_DINODE_FMT_BTREE && in xfs_iflush()
3487 ip->i_df.if_format != XFS_DINODE_FMT_LOCAL, in xfs_iflush()
3491 __func__, ip->i_ino, ip); in xfs_iflush()
3495 if (XFS_TEST_ERROR(ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp) > in xfs_iflush()
3496 ip->i_nblocks, mp, XFS_ERRTAG_IFLUSH_5)) { in xfs_iflush()
3500 __func__, ip->i_ino, in xfs_iflush()
3501 ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp), in xfs_iflush()
3502 ip->i_nblocks, ip); in xfs_iflush()
3505 if (XFS_TEST_ERROR(ip->i_forkoff > mp->m_sb.sb_inodesize, in xfs_iflush()
3509 __func__, ip->i_ino, ip->i_forkoff, ip); in xfs_iflush()
3522 ip->i_flushiter++; in xfs_iflush()
3528 if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL && in xfs_iflush()
3529 xfs_ifork_verify_local_data(ip)) in xfs_iflush()
3531 if (ip->i_afp && ip->i_afp->if_format == XFS_DINODE_FMT_LOCAL && in xfs_iflush()
3532 xfs_ifork_verify_local_attr(ip)) in xfs_iflush()
3540 xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn); in xfs_iflush()
3544 if (ip->i_flushiter == DI_MAX_FLUSH) in xfs_iflush()
3545 ip->i_flushiter = 0; in xfs_iflush()
3548 xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK); in xfs_iflush()
3549 if (XFS_IFORK_Q(ip)) in xfs_iflush()
3550 xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK); in xfs_iflush()
3607 struct xfs_inode *ip; in xfs_iflush_cluster() local
3618 ip = iip->ili_inode; in xfs_iflush_cluster()
3623 if (__xfs_iflags_test(ip, XFS_IRECLAIM | XFS_IFLUSHING)) in xfs_iflush_cluster()
3625 if (xfs_ipincount(ip)) in xfs_iflush_cluster()
3635 spin_lock(&ip->i_flags_lock); in xfs_iflush_cluster()
3636 ASSERT(!__xfs_iflags_test(ip, XFS_ISTALE)); in xfs_iflush_cluster()
3637 if (__xfs_iflags_test(ip, XFS_IRECLAIM | XFS_IFLUSHING)) { in xfs_iflush_cluster()
3638 spin_unlock(&ip->i_flags_lock); in xfs_iflush_cluster()
3648 if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) { in xfs_iflush_cluster()
3649 spin_unlock(&ip->i_flags_lock); in xfs_iflush_cluster()
3652 __xfs_iflags_set(ip, XFS_IFLUSHING); in xfs_iflush_cluster()
3653 spin_unlock(&ip->i_flags_lock); in xfs_iflush_cluster()
3663 xfs_iunpin_wait(ip); in xfs_iflush_cluster()
3664 xfs_iflush_abort(ip); in xfs_iflush_cluster()
3665 xfs_iunlock(ip, XFS_ILOCK_SHARED); in xfs_iflush_cluster()
3671 if (xfs_ipincount(ip)) { in xfs_iflush_cluster()
3672 xfs_iflags_clear(ip, XFS_IFLUSHING); in xfs_iflush_cluster()
3673 xfs_iunlock(ip, XFS_ILOCK_SHARED); in xfs_iflush_cluster()
3677 if (!xfs_inode_clean(ip)) in xfs_iflush_cluster()
3678 error = xfs_iflush(ip, bp); in xfs_iflush_cluster()
3680 xfs_iflags_clear(ip, XFS_IFLUSHING); in xfs_iflush_cluster()
3681 xfs_iunlock(ip, XFS_ILOCK_SHARED); in xfs_iflush_cluster()
3706 struct xfs_inode *ip) in xfs_irele() argument
3708 trace_xfs_irele(ip, _RET_IP_); in xfs_irele()
3709 iput(VFS_I(ip)); in xfs_irele()
3717 struct xfs_inode *ip) in xfs_log_force_inode() argument
3721 xfs_ilock(ip, XFS_ILOCK_SHARED); in xfs_log_force_inode()
3722 if (xfs_ipincount(ip)) in xfs_log_force_inode()
3723 seq = ip->i_itemp->ili_commit_seq; in xfs_log_force_inode()
3724 xfs_iunlock(ip, XFS_ILOCK_SHARED); in xfs_log_force_inode()
3728 return xfs_log_force_seq(ip->i_mount, seq, XFS_LOG_SYNC, NULL); in xfs_log_force_inode()