Lines Matching refs:ip
75 struct xfs_inode *ip; in xfs_inode_alloc() local
81 ip = alloc_inode_sb(mp->m_super, xfs_inode_cache, GFP_KERNEL | __GFP_NOFAIL); in xfs_inode_alloc()
83 if (inode_init_always(mp->m_super, VFS_I(ip))) { in xfs_inode_alloc()
84 kmem_cache_free(xfs_inode_cache, ip); in xfs_inode_alloc()
89 VFS_I(ip)->i_mode = 0; in xfs_inode_alloc()
90 VFS_I(ip)->i_state = 0; in xfs_inode_alloc()
91 mapping_set_large_folios(VFS_I(ip)->i_mapping); in xfs_inode_alloc()
94 ASSERT(atomic_read(&ip->i_pincount) == 0); in xfs_inode_alloc()
95 ASSERT(ip->i_ino == 0); in xfs_inode_alloc()
98 ip->i_ino = ino; in xfs_inode_alloc()
99 ip->i_mount = mp; in xfs_inode_alloc()
100 memset(&ip->i_imap, 0, sizeof(struct xfs_imap)); in xfs_inode_alloc()
101 ip->i_cowfp = NULL; in xfs_inode_alloc()
102 memset(&ip->i_af, 0, sizeof(ip->i_af)); in xfs_inode_alloc()
103 ip->i_af.if_format = XFS_DINODE_FMT_EXTENTS; in xfs_inode_alloc()
104 memset(&ip->i_df, 0, sizeof(ip->i_df)); in xfs_inode_alloc()
105 ip->i_flags = 0; in xfs_inode_alloc()
106 ip->i_delayed_blks = 0; in xfs_inode_alloc()
107 ip->i_diflags2 = mp->m_ino_geo.new_diflags2; in xfs_inode_alloc()
108 ip->i_nblocks = 0; in xfs_inode_alloc()
109 ip->i_forkoff = 0; in xfs_inode_alloc()
110 ip->i_sick = 0; in xfs_inode_alloc()
111 ip->i_checked = 0; in xfs_inode_alloc()
112 INIT_WORK(&ip->i_ioend_work, xfs_end_io); in xfs_inode_alloc()
113 INIT_LIST_HEAD(&ip->i_ioend_list); in xfs_inode_alloc()
114 spin_lock_init(&ip->i_ioend_lock); in xfs_inode_alloc()
115 ip->i_next_unlinked = NULLAGINO; in xfs_inode_alloc()
116 ip->i_prev_unlinked = 0; in xfs_inode_alloc()
118 return ip; in xfs_inode_alloc()
126 struct xfs_inode *ip = XFS_I(inode); in xfs_inode_free_callback() local
128 switch (VFS_I(ip)->i_mode & S_IFMT) { in xfs_inode_free_callback()
132 xfs_idestroy_fork(&ip->i_df); in xfs_inode_free_callback()
136 xfs_ifork_zap_attr(ip); in xfs_inode_free_callback()
138 if (ip->i_cowfp) { in xfs_inode_free_callback()
139 xfs_idestroy_fork(ip->i_cowfp); in xfs_inode_free_callback()
140 kmem_cache_free(xfs_ifork_cache, ip->i_cowfp); in xfs_inode_free_callback()
142 if (ip->i_itemp) { in xfs_inode_free_callback()
144 &ip->i_itemp->ili_item.li_flags)); in xfs_inode_free_callback()
145 xfs_inode_item_destroy(ip); in xfs_inode_free_callback()
146 ip->i_itemp = NULL; in xfs_inode_free_callback()
149 kmem_cache_free(xfs_inode_cache, ip); in xfs_inode_free_callback()
154 struct xfs_inode *ip) in __xfs_inode_free() argument
157 ASSERT(atomic_read(&ip->i_pincount) == 0); in __xfs_inode_free()
158 ASSERT(!ip->i_itemp || list_empty(&ip->i_itemp->ili_item.li_bio_list)); in __xfs_inode_free()
159 XFS_STATS_DEC(ip->i_mount, vn_active); in __xfs_inode_free()
161 call_rcu(&VFS_I(ip)->i_rcu, xfs_inode_free_callback); in __xfs_inode_free()
166 struct xfs_inode *ip) in xfs_inode_free() argument
168 ASSERT(!xfs_iflags_test(ip, XFS_IFLUSHING)); in xfs_inode_free()
176 spin_lock(&ip->i_flags_lock); in xfs_inode_free()
177 ip->i_flags = XFS_IRECLAIM; in xfs_inode_free()
178 ip->i_ino = 0; in xfs_inode_free()
179 spin_unlock(&ip->i_flags_lock); in xfs_inode_free()
181 __xfs_inode_free(ip); in xfs_inode_free()
337 struct xfs_inode *ip) __releases(&ip->i_flags_lock) in xfs_iget_recycle() argument
339 struct xfs_mount *mp = ip->i_mount; in xfs_iget_recycle()
340 struct inode *inode = VFS_I(ip); in xfs_iget_recycle()
343 trace_xfs_iget_recycle(ip); in xfs_iget_recycle()
345 if (!xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) in xfs_iget_recycle()
354 ip->i_flags |= XFS_IRECLAIM; in xfs_iget_recycle()
356 spin_unlock(&ip->i_flags_lock); in xfs_iget_recycle()
361 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_iget_recycle()
368 spin_lock(&ip->i_flags_lock); in xfs_iget_recycle()
369 ip->i_flags &= ~(XFS_INEW | XFS_IRECLAIM); in xfs_iget_recycle()
370 ASSERT(ip->i_flags & XFS_IRECLAIMABLE); in xfs_iget_recycle()
371 spin_unlock(&ip->i_flags_lock); in xfs_iget_recycle()
374 trace_xfs_iget_recycle_fail(ip); in xfs_iget_recycle()
379 spin_lock(&ip->i_flags_lock); in xfs_iget_recycle()
386 ip->i_flags &= ~XFS_IRECLAIM_RESET_FLAGS; in xfs_iget_recycle()
387 ip->i_flags |= XFS_INEW; in xfs_iget_recycle()
388 xfs_perag_clear_inode_tag(pag, XFS_INO_TO_AGINO(mp, ip->i_ino), in xfs_iget_recycle()
391 spin_unlock(&ip->i_flags_lock); in xfs_iget_recycle()
409 struct xfs_inode *ip, in xfs_iget_check_free_state() argument
414 if (VFS_I(ip)->i_mode != 0) { in xfs_iget_check_free_state()
415 xfs_warn(ip->i_mount, in xfs_iget_check_free_state()
417 ip->i_ino, VFS_I(ip)->i_mode); in xfs_iget_check_free_state()
421 if (ip->i_nblocks != 0) { in xfs_iget_check_free_state()
422 xfs_warn(ip->i_mount, in xfs_iget_check_free_state()
424 ip->i_ino); in xfs_iget_check_free_state()
431 if (VFS_I(ip)->i_mode == 0) in xfs_iget_check_free_state()
484 struct xfs_inode *ip, in xfs_iget_cache_hit() argument
489 struct inode *inode = VFS_I(ip); in xfs_iget_cache_hit()
490 struct xfs_mount *mp = ip->i_mount; in xfs_iget_cache_hit()
500 spin_lock(&ip->i_flags_lock); in xfs_iget_cache_hit()
501 if (ip->i_ino != ino) in xfs_iget_cache_hit()
522 if (ip->i_flags & (XFS_INEW | XFS_IRECLAIM | XFS_INACTIVATING)) in xfs_iget_cache_hit()
525 if (ip->i_flags & XFS_NEED_INACTIVE) { in xfs_iget_cache_hit()
527 if (VFS_I(ip)->i_nlink == 0) { in xfs_iget_cache_hit()
538 error = xfs_iget_check_free_state(ip, flags); in xfs_iget_cache_hit()
544 (ip->i_flags & XFS_IRECLAIMABLE)) in xfs_iget_cache_hit()
548 if (ip->i_flags & XFS_IRECLAIMABLE) { in xfs_iget_cache_hit()
550 error = xfs_iget_recycle(pag, ip); in xfs_iget_cache_hit()
561 spin_unlock(&ip->i_flags_lock); in xfs_iget_cache_hit()
563 trace_xfs_iget_hit(ip); in xfs_iget_cache_hit()
567 xfs_ilock(ip, lock_flags); in xfs_iget_cache_hit()
570 xfs_iflags_clear(ip, XFS_ISTALE); in xfs_iget_cache_hit()
576 trace_xfs_iget_skip(ip); in xfs_iget_cache_hit()
580 spin_unlock(&ip->i_flags_lock); in xfs_iget_cache_hit()
585 spin_unlock(&ip->i_flags_lock); in xfs_iget_cache_hit()
606 struct xfs_inode *ip; in xfs_iget_cache_miss() local
611 ip = xfs_inode_alloc(mp, ino); in xfs_iget_cache_miss()
612 if (!ip) in xfs_iget_cache_miss()
615 error = xfs_imap(pag, tp, ip->i_ino, &ip->i_imap, flags); in xfs_iget_cache_miss()
631 VFS_I(ip)->i_generation = get_random_u32(); in xfs_iget_cache_miss()
635 error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &bp); in xfs_iget_cache_miss()
639 error = xfs_inode_from_disk(ip, in xfs_iget_cache_miss()
640 xfs_buf_offset(bp, ip->i_imap.im_boffset)); in xfs_iget_cache_miss()
649 trace_xfs_iget_miss(ip); in xfs_iget_cache_miss()
655 error = xfs_iget_check_free_state(ip, flags); in xfs_iget_cache_miss()
675 if (!xfs_ilock_nowait(ip, lock_flags)) in xfs_iget_cache_miss()
690 d_mark_dontcache(VFS_I(ip)); in xfs_iget_cache_miss()
691 ip->i_udquot = NULL; in xfs_iget_cache_miss()
692 ip->i_gdquot = NULL; in xfs_iget_cache_miss()
693 ip->i_pdquot = NULL; in xfs_iget_cache_miss()
694 xfs_iflags_set(ip, iflags); in xfs_iget_cache_miss()
698 error = radix_tree_insert(&pag->pag_ici_root, agino, ip); in xfs_iget_cache_miss()
708 *ipp = ip; in xfs_iget_cache_miss()
715 xfs_iunlock(ip, lock_flags); in xfs_iget_cache_miss()
717 __destroy_inode(VFS_I(ip)); in xfs_iget_cache_miss()
718 xfs_inode_free(ip); in xfs_iget_cache_miss()
743 struct xfs_inode *ip; in xfs_iget() local
763 ip = radix_tree_lookup(&pag->pag_ici_root, agino); in xfs_iget()
765 if (ip) { in xfs_iget()
766 error = xfs_iget_cache_hit(pag, ip, ino, flags, lock_flags); in xfs_iget()
777 error = xfs_iget_cache_miss(mp, pag, tp, ino, &ip, in xfs_iget()
784 *ipp = ip; in xfs_iget()
791 if (xfs_iflags_test(ip, XFS_INEW) && VFS_I(ip)->i_mode != 0) in xfs_iget()
792 xfs_setup_existing_inode(ip); in xfs_iget()
824 struct xfs_inode *ip, in xfs_reclaim_igrab() argument
829 spin_lock(&ip->i_flags_lock); in xfs_reclaim_igrab()
830 if (!__xfs_iflags_test(ip, XFS_IRECLAIMABLE) || in xfs_reclaim_igrab()
831 __xfs_iflags_test(ip, XFS_IRECLAIM)) { in xfs_reclaim_igrab()
833 spin_unlock(&ip->i_flags_lock); in xfs_reclaim_igrab()
838 if (ip->i_sick && in xfs_reclaim_igrab()
840 spin_unlock(&ip->i_flags_lock); in xfs_reclaim_igrab()
844 __xfs_iflags_set(ip, XFS_IRECLAIM); in xfs_reclaim_igrab()
845 spin_unlock(&ip->i_flags_lock); in xfs_reclaim_igrab()
863 struct xfs_inode *ip, in xfs_reclaim_inode() argument
866 xfs_ino_t ino = ip->i_ino; /* for radix_tree_delete */ in xfs_reclaim_inode()
868 if (!xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) in xfs_reclaim_inode()
870 if (xfs_iflags_test_and_set(ip, XFS_IFLUSHING)) in xfs_reclaim_inode()
880 if (xlog_is_shutdown(ip->i_mount->m_log)) { in xfs_reclaim_inode()
881 xfs_iunpin_wait(ip); in xfs_reclaim_inode()
882 xfs_iflush_shutdown_abort(ip); in xfs_reclaim_inode()
885 if (xfs_ipincount(ip)) in xfs_reclaim_inode()
887 if (!xfs_inode_clean(ip)) in xfs_reclaim_inode()
890 xfs_iflags_clear(ip, XFS_IFLUSHING); in xfs_reclaim_inode()
892 trace_xfs_inode_reclaiming(ip); in xfs_reclaim_inode()
904 spin_lock(&ip->i_flags_lock); in xfs_reclaim_inode()
905 ip->i_flags = XFS_IRECLAIM; in xfs_reclaim_inode()
906 ip->i_ino = 0; in xfs_reclaim_inode()
907 ip->i_sick = 0; in xfs_reclaim_inode()
908 ip->i_checked = 0; in xfs_reclaim_inode()
909 spin_unlock(&ip->i_flags_lock); in xfs_reclaim_inode()
911 ASSERT(!ip->i_itemp || ip->i_itemp->ili_item.li_buf == NULL); in xfs_reclaim_inode()
912 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_reclaim_inode()
914 XFS_STATS_INC(ip->i_mount, xs_ig_reclaims); in xfs_reclaim_inode()
924 XFS_INO_TO_AGINO(ip->i_mount, ino))) in xfs_reclaim_inode()
937 xfs_ilock(ip, XFS_ILOCK_EXCL); in xfs_reclaim_inode()
938 ASSERT(!ip->i_udquot && !ip->i_gdquot && !ip->i_pdquot); in xfs_reclaim_inode()
939 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_reclaim_inode()
940 ASSERT(xfs_inode_clean(ip)); in xfs_reclaim_inode()
942 __xfs_inode_free(ip); in xfs_reclaim_inode()
946 xfs_iflags_clear(ip, XFS_IFLUSHING); in xfs_reclaim_inode()
948 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_reclaim_inode()
950 xfs_iflags_clear(ip, XFS_IRECLAIM); in xfs_reclaim_inode()
1029 struct xfs_inode *ip, in xfs_icwalk_match_id() argument
1033 !uid_eq(VFS_I(ip)->i_uid, icw->icw_uid)) in xfs_icwalk_match_id()
1037 !gid_eq(VFS_I(ip)->i_gid, icw->icw_gid)) in xfs_icwalk_match_id()
1041 ip->i_projid != icw->icw_prid) in xfs_icwalk_match_id()
1053 struct xfs_inode *ip, in xfs_icwalk_match_id_union() argument
1057 uid_eq(VFS_I(ip)->i_uid, icw->icw_uid)) in xfs_icwalk_match_id_union()
1061 gid_eq(VFS_I(ip)->i_gid, icw->icw_gid)) in xfs_icwalk_match_id_union()
1065 ip->i_projid == icw->icw_prid) in xfs_icwalk_match_id_union()
1078 struct xfs_inode *ip, in xfs_icwalk_match() argument
1087 match = xfs_icwalk_match_id_union(ip, icw); in xfs_icwalk_match()
1089 match = xfs_icwalk_match_id(ip, icw); in xfs_icwalk_match()
1095 XFS_ISIZE(ip) < icw->icw_min_file_size) in xfs_icwalk_match()
1120 struct xfs_inode *ip, in xfs_inode_free_eofblocks() argument
1128 if (!xfs_iflags_test(ip, XFS_IEOFBLOCKS)) in xfs_inode_free_eofblocks()
1135 if (!wait && mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY)) in xfs_inode_free_eofblocks()
1138 if (!xfs_icwalk_match(ip, icw)) in xfs_inode_free_eofblocks()
1145 if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) { in xfs_inode_free_eofblocks()
1152 if (xfs_can_free_eofblocks(ip, false)) in xfs_inode_free_eofblocks()
1153 return xfs_free_eofblocks(ip); in xfs_inode_free_eofblocks()
1156 trace_xfs_inode_free_eofblocks_invalid(ip); in xfs_inode_free_eofblocks()
1157 xfs_inode_clear_eofblocks_tag(ip); in xfs_inode_free_eofblocks()
1163 struct xfs_inode *ip, in xfs_blockgc_set_iflag() argument
1166 struct xfs_mount *mp = ip->i_mount; in xfs_blockgc_set_iflag()
1175 if (ip->i_flags & iflag) in xfs_blockgc_set_iflag()
1177 spin_lock(&ip->i_flags_lock); in xfs_blockgc_set_iflag()
1178 ip->i_flags |= iflag; in xfs_blockgc_set_iflag()
1179 spin_unlock(&ip->i_flags_lock); in xfs_blockgc_set_iflag()
1181 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); in xfs_blockgc_set_iflag()
1184 xfs_perag_set_inode_tag(pag, XFS_INO_TO_AGINO(mp, ip->i_ino), in xfs_blockgc_set_iflag()
1193 xfs_inode_t *ip) in xfs_inode_set_eofblocks_tag() argument
1195 trace_xfs_inode_set_eofblocks_tag(ip); in xfs_inode_set_eofblocks_tag()
1196 return xfs_blockgc_set_iflag(ip, XFS_IEOFBLOCKS); in xfs_inode_set_eofblocks_tag()
1201 struct xfs_inode *ip, in xfs_blockgc_clear_iflag() argument
1204 struct xfs_mount *mp = ip->i_mount; in xfs_blockgc_clear_iflag()
1210 spin_lock(&ip->i_flags_lock); in xfs_blockgc_clear_iflag()
1211 ip->i_flags &= ~iflag; in xfs_blockgc_clear_iflag()
1212 clear_tag = (ip->i_flags & (XFS_IEOFBLOCKS | XFS_ICOWBLOCKS)) == 0; in xfs_blockgc_clear_iflag()
1213 spin_unlock(&ip->i_flags_lock); in xfs_blockgc_clear_iflag()
1218 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); in xfs_blockgc_clear_iflag()
1221 xfs_perag_clear_inode_tag(pag, XFS_INO_TO_AGINO(mp, ip->i_ino), in xfs_blockgc_clear_iflag()
1230 xfs_inode_t *ip) in xfs_inode_clear_eofblocks_tag() argument
1232 trace_xfs_inode_clear_eofblocks_tag(ip); in xfs_inode_clear_eofblocks_tag()
1233 return xfs_blockgc_clear_iflag(ip, XFS_IEOFBLOCKS); in xfs_inode_clear_eofblocks_tag()
1243 struct xfs_inode *ip) in xfs_prep_free_cowblocks() argument
1249 if (!xfs_inode_has_cow_data(ip)) { in xfs_prep_free_cowblocks()
1250 trace_xfs_inode_free_cowblocks_invalid(ip); in xfs_prep_free_cowblocks()
1251 xfs_inode_clear_cowblocks_tag(ip); in xfs_prep_free_cowblocks()
1259 if ((VFS_I(ip)->i_state & I_DIRTY_PAGES) || in xfs_prep_free_cowblocks()
1260 mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY) || in xfs_prep_free_cowblocks()
1261 mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_WRITEBACK) || in xfs_prep_free_cowblocks()
1262 atomic_read(&VFS_I(ip)->i_dio_count)) in xfs_prep_free_cowblocks()
1282 struct xfs_inode *ip, in xfs_inode_free_cowblocks() argument
1291 if (!xfs_iflags_test(ip, XFS_ICOWBLOCKS)) in xfs_inode_free_cowblocks()
1294 if (!xfs_prep_free_cowblocks(ip)) in xfs_inode_free_cowblocks()
1297 if (!xfs_icwalk_match(ip, icw)) in xfs_inode_free_cowblocks()
1305 !xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL)) { in xfs_inode_free_cowblocks()
1312 if (!xfs_ilock_nowait(ip, XFS_MMAPLOCK_EXCL)) { in xfs_inode_free_cowblocks()
1323 if (xfs_prep_free_cowblocks(ip)) in xfs_inode_free_cowblocks()
1324 ret = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, false); in xfs_inode_free_cowblocks()
1330 xfs_inode_t *ip) in xfs_inode_set_cowblocks_tag() argument
1332 trace_xfs_inode_set_cowblocks_tag(ip); in xfs_inode_set_cowblocks_tag()
1333 return xfs_blockgc_set_iflag(ip, XFS_ICOWBLOCKS); in xfs_inode_set_cowblocks_tag()
1338 xfs_inode_t *ip) in xfs_inode_clear_cowblocks_tag() argument
1340 trace_xfs_inode_clear_cowblocks_tag(ip); in xfs_inode_clear_cowblocks_tag()
1341 return xfs_blockgc_clear_iflag(ip, XFS_ICOWBLOCKS); in xfs_inode_clear_cowblocks_tag()
1389 struct xfs_inode *ip) in xfs_blockgc_igrab() argument
1391 struct inode *inode = VFS_I(ip); in xfs_blockgc_igrab()
1396 spin_lock(&ip->i_flags_lock); in xfs_blockgc_igrab()
1397 if (!ip->i_ino) in xfs_blockgc_igrab()
1400 if (ip->i_flags & XFS_BLOCKGC_NOGRAB_IFLAGS) in xfs_blockgc_igrab()
1402 spin_unlock(&ip->i_flags_lock); in xfs_blockgc_igrab()
1405 if (xfs_is_shutdown(ip->i_mount)) in xfs_blockgc_igrab()
1416 spin_unlock(&ip->i_flags_lock); in xfs_blockgc_igrab()
1423 struct xfs_inode *ip, in xfs_blockgc_scan_inode() argument
1429 error = xfs_inode_free_eofblocks(ip, icw, &lockflags); in xfs_blockgc_scan_inode()
1433 error = xfs_inode_free_cowblocks(ip, icw, &lockflags); in xfs_blockgc_scan_inode()
1436 xfs_iunlock(ip, lockflags); in xfs_blockgc_scan_inode()
1437 xfs_irele(ip); in xfs_blockgc_scan_inode()
1565 struct xfs_inode *ip, in xfs_blockgc_free_quota() argument
1568 return xfs_blockgc_free_dquots(ip->i_mount, in xfs_blockgc_free_quota()
1569 xfs_inode_dquot(ip, XFS_DQTYPE_USER), in xfs_blockgc_free_quota()
1570 xfs_inode_dquot(ip, XFS_DQTYPE_GROUP), in xfs_blockgc_free_quota()
1571 xfs_inode_dquot(ip, XFS_DQTYPE_PROJ), iwalk_flags); in xfs_blockgc_free_quota()
1592 struct xfs_inode *ip, in xfs_icwalk_igrab() argument
1597 return xfs_blockgc_igrab(ip); in xfs_icwalk_igrab()
1599 return xfs_reclaim_igrab(ip, icw); in xfs_icwalk_igrab()
1612 struct xfs_inode *ip, in xfs_icwalk_process_inode() argument
1620 error = xfs_blockgc_scan_inode(ip, icw); in xfs_icwalk_process_inode()
1623 xfs_reclaim_inode(ip, pag); in xfs_icwalk_process_inode()
1675 struct xfs_inode *ip = batch[i]; in xfs_icwalk_ag() local
1677 if (done || !xfs_icwalk_igrab(goal, ip, icw)) in xfs_icwalk_ag()
1692 if (XFS_INO_TO_AGNO(mp, ip->i_ino) != pag->pag_agno) in xfs_icwalk_ag()
1694 first_index = XFS_INO_TO_AGINO(mp, ip->i_ino + 1); in xfs_icwalk_ag()
1695 if (first_index < XFS_INO_TO_AGINO(mp, ip->i_ino)) in xfs_icwalk_ag()
1770 struct xfs_inode *ip, in xfs_check_delalloc() argument
1773 struct xfs_ifork *ifp = xfs_ifork_ptr(ip, whichfork); in xfs_check_delalloc()
1777 if (!ifp || !xfs_iext_lookup_extent(ip, ifp, 0, &icur, &got)) in xfs_check_delalloc()
1781 xfs_warn(ip->i_mount, in xfs_check_delalloc()
1783 ip->i_ino, in xfs_check_delalloc()
1790 #define xfs_check_delalloc(ip, whichfork) do { } while (0) argument
1796 struct xfs_inode *ip) in xfs_inodegc_set_reclaimable() argument
1798 struct xfs_mount *mp = ip->i_mount; in xfs_inodegc_set_reclaimable()
1801 if (!xfs_is_shutdown(mp) && ip->i_delayed_blks) { in xfs_inodegc_set_reclaimable()
1802 xfs_check_delalloc(ip, XFS_DATA_FORK); in xfs_inodegc_set_reclaimable()
1803 xfs_check_delalloc(ip, XFS_COW_FORK); in xfs_inodegc_set_reclaimable()
1807 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); in xfs_inodegc_set_reclaimable()
1809 spin_lock(&ip->i_flags_lock); in xfs_inodegc_set_reclaimable()
1811 trace_xfs_inode_set_reclaimable(ip); in xfs_inodegc_set_reclaimable()
1812 ip->i_flags &= ~(XFS_NEED_INACTIVE | XFS_INACTIVATING); in xfs_inodegc_set_reclaimable()
1813 ip->i_flags |= XFS_IRECLAIMABLE; in xfs_inodegc_set_reclaimable()
1814 xfs_perag_set_inode_tag(pag, XFS_INO_TO_AGINO(mp, ip->i_ino), in xfs_inodegc_set_reclaimable()
1817 spin_unlock(&ip->i_flags_lock); in xfs_inodegc_set_reclaimable()
1829 struct xfs_inode *ip) in xfs_inodegc_inactivate() argument
1833 trace_xfs_inode_inactivating(ip); in xfs_inodegc_inactivate()
1834 error = xfs_inactive(ip); in xfs_inodegc_inactivate()
1835 xfs_inodegc_set_reclaimable(ip); in xfs_inodegc_inactivate()
1847 struct xfs_inode *ip, *n; in xfs_inodegc_worker() local
1872 ip = llist_entry(node, struct xfs_inode, i_gclist); in xfs_inodegc_worker()
1876 llist_for_each_entry_safe(ip, n, node, i_gclist) { in xfs_inodegc_worker()
1879 xfs_iflags_set(ip, XFS_INACTIVATING); in xfs_inodegc_worker()
1880 error = xfs_inodegc_inactivate(ip); in xfs_inodegc_worker()
1967 struct xfs_inode *ip) in xfs_inodegc_want_queue_rt_file() argument
1969 struct xfs_mount *mp = ip->i_mount; in xfs_inodegc_want_queue_rt_file()
1971 if (!XFS_IS_REALTIME_INODE(ip)) in xfs_inodegc_want_queue_rt_file()
1982 # define xfs_inodegc_want_queue_rt_file(ip) (false) argument
1994 struct xfs_inode *ip, in xfs_inodegc_want_queue_work() argument
1997 struct xfs_mount *mp = ip->i_mount; in xfs_inodegc_want_queue_work()
2007 if (xfs_inodegc_want_queue_rt_file(ip)) in xfs_inodegc_want_queue_work()
2010 if (xfs_inode_near_dquot_enforcement(ip, XFS_DQTYPE_USER)) in xfs_inodegc_want_queue_work()
2013 if (xfs_inode_near_dquot_enforcement(ip, XFS_DQTYPE_GROUP)) in xfs_inodegc_want_queue_work()
2016 if (xfs_inode_near_dquot_enforcement(ip, XFS_DQTYPE_PROJ)) in xfs_inodegc_want_queue_work()
2041 struct xfs_inode *ip, in xfs_inodegc_want_flush_work() argument
2064 struct xfs_inode *ip) in xfs_inodegc_queue() argument
2066 struct xfs_mount *mp = ip->i_mount; in xfs_inodegc_queue()
2073 trace_xfs_inode_set_need_inactive(ip); in xfs_inodegc_queue()
2074 spin_lock(&ip->i_flags_lock); in xfs_inodegc_queue()
2075 ip->i_flags |= XFS_NEED_INACTIVE; in xfs_inodegc_queue()
2076 spin_unlock(&ip->i_flags_lock); in xfs_inodegc_queue()
2080 llist_add(&ip->i_gclist, &gc->list); in xfs_inodegc_queue()
2103 if (xfs_inodegc_want_queue_work(ip, items)) in xfs_inodegc_queue()
2111 if (xfs_inodegc_want_flush_work(ip, items, shrinker_hits)) { in xfs_inodegc_queue()
2129 struct xfs_inode *ip) in xfs_inode_mark_reclaimable() argument
2131 struct xfs_mount *mp = ip->i_mount; in xfs_inode_mark_reclaimable()
2139 ASSERT_ALWAYS(!xfs_iflags_test(ip, XFS_ALL_IRECLAIM_FLAGS)); in xfs_inode_mark_reclaimable()
2141 need_inactive = xfs_inode_needs_inactive(ip); in xfs_inode_mark_reclaimable()
2143 xfs_inodegc_queue(ip); in xfs_inode_mark_reclaimable()
2148 xfs_qm_dqdetach(ip); in xfs_inode_mark_reclaimable()
2149 xfs_inodegc_set_reclaimable(ip); in xfs_inode_mark_reclaimable()