Lines Matching defs:ip

53 	struct xfs_inode	*ip)
59 if (xfs_is_always_cow_inode(ip))
61 if ((ip->i_diflags & XFS_DIFLAG_EXTSIZE) && ip->i_extsize)
62 return ip->i_extsize;
63 if (XFS_IS_REALTIME_INODE(ip))
64 return ip->i_mount->m_sb.sb_rextsize;
76 struct xfs_inode *ip)
81 if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
82 a = ip->i_cowextsize;
83 b = xfs_get_extsz_hint(ip);
95 * call xfs_ilock(ip, XFS_ILOCK_SHARED) is that the inode lock also guards to
108 struct xfs_inode *ip)
112 if (xfs_need_iread_extents(&ip->i_df))
114 xfs_ilock(ip, lock_mode);
120 struct xfs_inode *ip)
124 if (xfs_inode_has_attr_fork(ip) && xfs_need_iread_extents(&ip->i_af))
126 xfs_ilock(ip, lock_mode);
182 xfs_inode_t *ip,
185 trace_xfs_ilock(ip, lock_flags, _RET_IP_);
190 down_write_nested(&VFS_I(ip)->i_rwsem,
193 down_read_nested(&VFS_I(ip)->i_rwsem,
198 down_write_nested(&VFS_I(ip)->i_mapping->invalidate_lock,
201 down_read_nested(&VFS_I(ip)->i_mapping->invalidate_lock,
206 down_write_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags));
208 down_read_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags));
218 * ip -- the inode being locked
225 xfs_inode_t *ip,
228 trace_xfs_ilock_nowait(ip, lock_flags, _RET_IP_);
233 if (!down_write_trylock(&VFS_I(ip)->i_rwsem))
236 if (!down_read_trylock(&VFS_I(ip)->i_rwsem))
241 if (!down_write_trylock(&VFS_I(ip)->i_mapping->invalidate_lock))
244 if (!down_read_trylock(&VFS_I(ip)->i_mapping->invalidate_lock))
249 if (!down_write_trylock(&ip->i_lock))
252 if (!down_read_trylock(&ip->i_lock))
259 up_write(&VFS_I(ip)->i_mapping->invalidate_lock);
261 up_read(&VFS_I(ip)->i_mapping->invalidate_lock);
264 up_write(&VFS_I(ip)->i_rwsem);
266 up_read(&VFS_I(ip)->i_rwsem);
277 * ip -- the inode being unlocked
285 xfs_inode_t *ip,
291 up_write(&VFS_I(ip)->i_rwsem);
293 up_read(&VFS_I(ip)->i_rwsem);
296 up_write(&VFS_I(ip)->i_mapping->invalidate_lock);
298 up_read(&VFS_I(ip)->i_mapping->invalidate_lock);
301 up_write(&ip->i_lock);
303 up_read(&ip->i_lock);
305 trace_xfs_iunlock(ip, lock_flags, _RET_IP_);
314 xfs_inode_t *ip,
322 downgrade_write(&ip->i_lock);
324 downgrade_write(&VFS_I(ip)->i_mapping->invalidate_lock);
326 downgrade_write(&VFS_I(ip)->i_rwsem);
328 trace_xfs_ilock_demote(ip, lock_flags, _RET_IP_);
333 struct xfs_inode *ip,
341 rwsem_assert_held(&ip->i_lock);
343 rwsem_assert_held_write_nolockdep(&ip->i_lock);
346 rwsem_assert_held(&VFS_I(ip)->i_mapping->invalidate_lock);
348 rwsem_assert_held_write(&VFS_I(ip)->i_mapping->invalidate_lock);
351 rwsem_assert_held(&VFS_I(ip)->i_rwsem);
353 rwsem_assert_held_write(&VFS_I(ip)->i_rwsem);
570 struct xfs_inode *ip)
574 if (ip->i_diflags & XFS_DIFLAG_ANY) {
575 if (ip->i_diflags & XFS_DIFLAG_REALTIME)
577 if (ip->i_diflags & XFS_DIFLAG_PREALLOC)
579 if (ip->i_diflags & XFS_DIFLAG_IMMUTABLE)
581 if (ip->i_diflags & XFS_DIFLAG_APPEND)
583 if (ip->i_diflags & XFS_DIFLAG_SYNC)
585 if (ip->i_diflags & XFS_DIFLAG_NOATIME)
587 if (ip->i_diflags & XFS_DIFLAG_NODUMP)
589 if (ip->i_diflags & XFS_DIFLAG_RTINHERIT)
591 if (ip->i_diflags & XFS_DIFLAG_PROJINHERIT)
593 if (ip->i_diflags & XFS_DIFLAG_NOSYMLINKS)
595 if (ip->i_diflags & XFS_DIFLAG_EXTSIZE)
597 if (ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT)
599 if (ip->i_diflags & XFS_DIFLAG_NODEFRAG)
601 if (ip->i_diflags & XFS_DIFLAG_FILESTREAM)
605 if (ip->i_diflags2 & XFS_DIFLAG2_ANY) {
606 if (ip->i_diflags2 & XFS_DIFLAG2_DAX)
608 if (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE)
612 if (xfs_inode_has_attr_fork(ip))
661 struct xfs_inode *ip,
666 umode_t mode = VFS_I(ip)->i_mode;
673 ip->i_extsize = pip->i_extsize;
679 xfs_has_realtime(ip->i_mount))
683 ip->i_extsize = pip->i_extsize;
704 ip->i_diflags |= di_flags;
716 failaddr = xfs_inode_validate_extsize(ip->i_mount, ip->i_extsize,
717 VFS_I(ip)->i_mode, ip->i_diflags);
719 ip->i_diflags &= ~(XFS_DIFLAG_EXTSIZE |
721 ip->i_extsize = 0;
728 struct xfs_inode *ip,
734 ip->i_diflags2 |= XFS_DIFLAG2_COWEXTSIZE;
735 ip->i_cowextsize = pip->i_cowextsize;
738 ip->i_diflags2 |= XFS_DIFLAG2_DAX;
741 failaddr = xfs_inode_validate_cowextsize(ip->i_mount, ip->i_cowextsize,
742 VFS_I(ip)->i_mode, ip->i_diflags, ip->i_diflags2);
744 ip->i_diflags2 &= ~XFS_DIFLAG2_COWEXTSIZE;
745 ip->i_cowextsize = 0;
768 struct xfs_inode *ip;
792 error = xfs_iget(mp, tp, ino, XFS_IGET_CREATE, XFS_ILOCK_EXCL, &ip);
796 ASSERT(ip != NULL);
797 inode = VFS_I(ip);
800 ip->i_projid = prid;
819 ip->i_disk_size = 0;
820 ip->i_df.if_nextents = 0;
821 ASSERT(ip->i_nblocks == 0);
827 ip->i_extsize = 0;
828 ip->i_diflags = 0;
832 ip->i_cowextsize = 0;
833 ip->i_crtime = tv;
842 ip->i_df.if_format = XFS_DINODE_FMT_DEV;
848 xfs_inode_inherit_flags(ip, pip);
850 xfs_inode_inherit_flags2(ip, pip);
853 ip->i_df.if_format = XFS_DINODE_FMT_EXTENTS;
854 ip->i_df.if_bytes = 0;
855 ip->i_df.if_data = NULL;
871 ip->i_forkoff = xfs_default_attroffset(ip) >> 3;
872 xfs_ifork_init_attr(ip, XFS_DINODE_FMT_EXTENTS, 0);
878 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
879 xfs_trans_log_inode(tp, ip, flags);
882 xfs_setup_inode(ip);
884 *ipp = ip;
896 xfs_inode_t *ip)
898 if (VFS_I(ip)->i_nlink == 0) {
899 xfs_alert(ip->i_mount,
901 __func__, ip->i_ino);
905 xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG);
907 drop_nlink(VFS_I(ip));
908 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
910 if (VFS_I(ip)->i_nlink)
913 return xfs_iunlink(tp, ip);
922 xfs_inode_t *ip)
924 xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG);
926 inc_nlink(VFS_I(ip));
927 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
960 struct xfs_inode *ip,
967 .ip = ip,
971 struct xfs_mount *mp = ip->i_mount;
1017 struct xfs_inode *ip = NULL;
1084 is_dir ? 2 : 1, rdev, prid, init_xattrs, &ip);
1098 error = xfs_dir_createname(tp, dp, name, ip->i_ino,
1108 error = xfs_dir_init(tp, ip, dp);
1116 * Create ip with a reference from dp, and add '.' and '..' references
1119 xfs_dir_update_hook(dp, ip, 1, name);
1134 xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp);
1144 *ipp = ip;
1155 if (ip) {
1156 xfs_finish_inode_setup(ip);
1157 xfs_irele(ip);
1177 struct xfs_inode *ip = NULL;
1214 0, 0, prid, false, &ip);
1226 xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp);
1228 error = xfs_iunlink(tp, ip);
1240 *ipp = ip;
1251 if (ip) {
1252 xfs_finish_inode_setup(ip);
1253 xfs_irele(ip);
1369 struct xfs_inode *ip)
1374 if (!xfs_is_reflink_inode(ip))
1376 dfork = xfs_ifork_ptr(ip, XFS_DATA_FORK);
1377 cfork = xfs_ifork_ptr(ip, XFS_COW_FORK);
1379 ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK;
1381 xfs_inode_clear_cowblocks_tag(ip);
1408 struct xfs_inode *ip,
1413 struct xfs_mount *mp = ip->i_mount;
1418 xfs_assert_ilocked(ip, XFS_ILOCK_EXCL);
1419 if (atomic_read(&VFS_I(ip)->i_count))
1420 xfs_assert_ilocked(ip, XFS_IOLOCK_EXCL);
1421 ASSERT(new_size <= XFS_ISIZE(ip));
1423 ASSERT(ip->i_itemp != NULL);
1424 ASSERT(ip->i_itemp->ili_lock_flags == 0);
1425 ASSERT(!XFS_NOT_DQATTACHED(mp, ip));
1427 trace_xfs_itruncate_extents_start(ip, new_size);
1447 error = xfs_bunmapi_range(&tp, ip, flags, first_unmap_block,
1454 error = xfs_reflink_cancel_cow_blocks(ip, &tp,
1459 xfs_itruncate_clear_reflink_flags(ip);
1466 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
1468 trace_xfs_itruncate_extents_end(ip, new_size);
1477 xfs_inode_t *ip)
1479 xfs_mount_t *mp = ip->i_mount;
1482 if (!S_ISREG(VFS_I(ip)->i_mode) || (VFS_I(ip)->i_mode == 0))
1502 truncated = xfs_iflags_test_and_clear(ip, XFS_ITRUNCATED);
1504 xfs_iflags_clear(ip, XFS_IDIRTY_RELEASE);
1505 if (ip->i_delayed_blks > 0) {
1506 error = filemap_flush(VFS_I(ip)->i_mapping);
1513 if (VFS_I(ip)->i_nlink == 0)
1522 if (!xfs_ilock_nowait(ip, XFS_IOLOCK_EXCL))
1525 if (xfs_can_free_eofblocks(ip, false)) {
1540 if (xfs_iflags_test(ip, XFS_IDIRTY_RELEASE))
1543 error = xfs_free_eofblocks(ip);
1548 if (ip->i_delayed_blks)
1549 xfs_iflags_set(ip, XFS_IDIRTY_RELEASE);
1553 xfs_iunlock(ip, XFS_IOLOCK_EXCL);
1564 struct xfs_inode *ip)
1566 struct xfs_mount *mp = ip->i_mount;
1575 xfs_ilock(ip, XFS_ILOCK_EXCL);
1576 xfs_trans_ijoin(tp, ip, 0);
1583 ip->i_disk_size = 0;
1584 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
1586 error = xfs_itruncate_extents(&tp, ip, XFS_DATA_FORK, 0);
1590 ASSERT(ip->i_df.if_nextents == 0);
1596 xfs_iunlock(ip, XFS_ILOCK_EXCL);
1602 xfs_iunlock(ip, XFS_ILOCK_EXCL);
1613 struct xfs_inode *ip)
1615 struct xfs_mount *mp = ip->i_mount;
1668 xfs_ilock(ip, XFS_ILOCK_EXCL);
1669 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
1671 error = xfs_ifree(tp, ip);
1672 xfs_assert_ilocked(ip, XFS_ILOCK_EXCL);
1691 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_ICOUNT, -1);
1704 struct xfs_inode *ip)
1706 struct xfs_mount *mp = ip->i_mount;
1707 struct xfs_ifork *cow_ifp = xfs_ifork_ptr(ip, XFS_COW_FORK);
1713 if (VFS_I(ip)->i_mode == 0)
1728 if (xfs_is_metadata_inode(ip))
1736 if (VFS_I(ip)->i_nlink == 0)
1749 return xfs_can_free_eofblocks(ip, true);
1758 struct xfs_inode *ip)
1760 struct xfs_mount *mp = ip->i_mount;
1765 xfs_inode_measure_sickness(ip, &sick, &checked);
1769 trace_xfs_inode_unfixed_corruption(ip, sick);
1774 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
1795 xfs_inode_t *ip)
1805 if (VFS_I(ip)->i_mode == 0) {
1806 ASSERT(ip->i_df.if_broot_bytes == 0);
1810 mp = ip->i_mount;
1811 ASSERT(!xfs_iflags_test(ip, XFS_IRECOVERY));
1813 xfs_inactive_health(ip);
1823 if (xfs_is_metadata_inode(ip))
1827 if (xfs_inode_has_cow_data(ip))
1828 xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true);
1830 if (VFS_I(ip)->i_nlink != 0) {
1840 if (xfs_can_free_eofblocks(ip, true))
1841 error = xfs_free_eofblocks(ip);
1846 if (S_ISREG(VFS_I(ip)->i_mode) &&
1847 (ip->i_disk_size != 0 || XFS_ISIZE(ip) != 0 ||
1848 ip->i_df.if_nextents > 0 || ip->i_delayed_blks > 0))
1851 if (xfs_iflags_test(ip, XFS_IQUOTAUNCHECKED)) {
1860 xfs_qm_dqdetach(ip);
1862 error = xfs_qm_dqattach(ip);
1867 if (S_ISLNK(VFS_I(ip)->i_mode))
1868 error = xfs_inactive_symlink(ip);
1870 error = xfs_inactive_truncate(ip);
1879 if (xfs_inode_has_attr_fork(ip)) {
1880 error = xfs_attr_inactive(ip);
1885 ASSERT(ip->i_forkoff == 0);
1890 error = xfs_inactive_ifree(ip);
1897 xfs_qm_dqdetach(ip);
1945 struct xfs_inode *ip;
1948 ip = radix_tree_lookup(&pag->pag_ici_root, agino);
1949 if (!ip) {
1959 if (WARN_ON_ONCE(!ip->i_ino)) {
1963 ASSERT(!xfs_iflags_test(ip, XFS_IRECLAIMABLE | XFS_IRECLAIM));
1965 return ip;
1978 struct xfs_inode *ip;
1984 ip = xfs_iunlink_lookup(pag, next_agino);
1985 if (!ip)
1988 ip->i_prev_unlinked = prev_agino;
2098 struct xfs_inode *ip)
2103 xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
2135 error = xfs_iunlink_log_inode(tp, ip, pag, next_agino);
2138 ip->i_next_unlinked = next_agino;
2142 ip->i_prev_unlinked = NULLAGINO;
2148 * a tmpfile via O_TMPFILE. The inode @ip must have nlink == 0.
2156 struct xfs_inode *ip)
2163 ASSERT(VFS_I(ip)->i_nlink == 0);
2164 ASSERT(VFS_I(ip)->i_mode != 0);
2165 trace_xfs_iunlink(ip);
2167 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
2174 error = xfs_iunlink_insert_inode(tp, pag, agibp, ip);
2185 struct xfs_inode *ip)
2189 xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
2194 trace_xfs_iunlink_remove(ip);
2213 error = xfs_iunlink_log_inode(tp, ip, pag, NULLAGINO);
2221 error = xfs_iunlink_update_backref(pag, ip->i_prev_unlinked,
2222 ip->i_next_unlinked);
2224 error = xfs_iunlink_reload_next(tp, agibp, ip->i_prev_unlinked,
2225 ip->i_next_unlinked);
2232 prev_ip = xfs_iunlink_lookup(pag, ip->i_prev_unlinked);
2234 xfs_inode_mark_sick(ip, XFS_SICK_INO_CORE);
2239 ip->i_next_unlinked);
2240 prev_ip->i_next_unlinked = ip->i_next_unlinked;
2244 ip->i_next_unlinked);
2247 ip->i_next_unlinked = NULLAGINO;
2248 ip->i_prev_unlinked = 0;
2259 struct xfs_inode *ip)
2264 trace_xfs_iunlink_remove(ip);
2271 return xfs_iunlink_remove_inode(tp, pag, agibp, ip);
2287 struct xfs_inode *ip;
2291 ip = radix_tree_lookup(&pag->pag_ici_root, XFS_INO_TO_AGINO(mp, inum));
2294 if (!ip) {
2305 spin_lock(&ip->i_flags_lock);
2306 if (ip->i_ino != inum || __xfs_iflags_test(ip, XFS_ISTALE))
2315 if (ip != free_ip) {
2316 if (!xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) {
2317 spin_unlock(&ip->i_flags_lock);
2323 ip->i_flags |= XFS_ISTALE;
2330 iip = ip->i_itemp;
2331 if (__xfs_iflags_test(ip, XFS_IFLUSHING)) {
2346 __xfs_iflags_set(ip, XFS_IFLUSHING);
2347 spin_unlock(&ip->i_flags_lock);
2358 if (ip != free_ip)
2359 xfs_iunlock(ip, XFS_ILOCK_EXCL);
2363 if (ip != free_ip)
2364 xfs_iunlock(ip, XFS_ILOCK_EXCL);
2366 spin_unlock(&ip->i_flags_lock);
2461 struct xfs_inode *ip)
2463 struct xfs_mount *mp = ip->i_mount;
2466 struct xfs_inode_log_item *iip = ip->i_itemp;
2469 xfs_assert_ilocked(ip, XFS_ILOCK_EXCL);
2470 ASSERT(VFS_I(ip)->i_nlink == 0);
2471 ASSERT(ip->i_df.if_nextents == 0);
2472 ASSERT(ip->i_disk_size == 0 || !S_ISREG(VFS_I(ip)->i_mode));
2473 ASSERT(ip->i_nblocks == 0);
2475 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
2483 error = xfs_difree(tp, pag, ip->i_ino, &xic);
2487 error = xfs_iunlink_remove(tp, pag, ip);
2496 if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL) {
2497 kfree(ip->i_df.if_data);
2498 ip->i_df.if_data = NULL;
2499 ip->i_df.if_bytes = 0;
2502 VFS_I(ip)->i_mode = 0; /* mark incore inode as free */
2503 ip->i_diflags = 0;
2504 ip->i_diflags2 = mp->m_ino_geo.new_diflags2;
2505 ip->i_forkoff = 0; /* mark the attr fork not in use */
2506 ip->i_df.if_format = XFS_DINODE_FMT_EXTENTS;
2507 if (xfs_iflags_test(ip, XFS_IPRESERVE_DM_FIELDS))
2508 xfs_iflags_clear(ip, XFS_IPRESERVE_DM_FIELDS);
2519 VFS_I(ip)->i_generation++;
2520 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
2523 error = xfs_ifree_cluster(tp, pag, ip, &xic);
2536 struct xfs_inode *ip)
2538 xfs_assert_ilocked(ip, XFS_ILOCK_EXCL | XFS_ILOCK_SHARED);
2540 trace_xfs_inode_unpin_nowait(ip, _RET_IP_);
2543 xfs_log_force_seq(ip->i_mount, ip->i_itemp->ili_commit_seq, 0, NULL);
2549 struct xfs_inode *ip)
2551 wait_queue_head_t *wq = bit_waitqueue(&ip->i_flags, __XFS_IPINNED_BIT);
2552 DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_IPINNED_BIT);
2554 xfs_iunpin(ip);
2558 if (xfs_ipincount(ip))
2560 } while (xfs_ipincount(ip));
2566 struct xfs_inode *ip)
2568 if (xfs_ipincount(ip))
2569 __xfs_iunpin_wait(ip);
2603 xfs_inode_t *ip)
2607 int is_dir = S_ISDIR(VFS_I(ip)->i_mode);
2623 error = xfs_qm_dqattach(ip);
2639 error = xfs_trans_alloc_dir(dp, &M_RES(mp)->tr_remove, ip, &resblks,
2650 ASSERT(VFS_I(ip)->i_nlink >= 2);
2651 if (VFS_I(ip)->i_nlink != 2) {
2655 if (!xfs_dir_isempty(ip)) {
2660 /* Drop the link from ip's "..". */
2665 /* Drop the "." link from ip to self. */
2666 error = xfs_droplink(tp, ip);
2677 error = xfs_dir_replace(tp, ip, &xfs_name_dotdot,
2692 /* Drop the link from dp to ip. */
2693 error = xfs_droplink(tp, ip);
2697 error = xfs_dir_removename(tp, dp, name, ip->i_ino, resblks);
2704 * Drop the link from dp to ip, and if ip was a directory, remove the
2707 xfs_dir_update_hook(dp, ip, -1, name);
2721 if (is_dir && xfs_inode_is_filestream(ip))
2722 xfs_filestream_deassociate(ip);
3328 struct xfs_inode *ip,
3331 struct xfs_inode_log_item *iip = ip->i_itemp;
3333 struct xfs_mount *mp = ip->i_mount;
3336 xfs_assert_ilocked(ip, XFS_ILOCK_EXCL | XFS_ILOCK_SHARED);
3337 ASSERT(xfs_iflags_test(ip, XFS_IFLUSHING));
3338 ASSERT(ip->i_df.if_format != XFS_DINODE_FMT_BTREE ||
3339 ip->i_df.if_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK));
3342 dip = xfs_buf_offset(bp, ip->i_imap.im_boffset);
3355 __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip);
3358 if (S_ISREG(VFS_I(ip)->i_mode)) {
3360 ip->i_df.if_format != XFS_DINODE_FMT_EXTENTS &&
3361 ip->i_df.if_format != XFS_DINODE_FMT_BTREE,
3365 __func__, ip->i_ino, ip);
3368 } else if (S_ISDIR(VFS_I(ip)->i_mode)) {
3370 ip->i_df.if_format != XFS_DINODE_FMT_EXTENTS &&
3371 ip->i_df.if_format != XFS_DINODE_FMT_BTREE &&
3372 ip->i_df.if_format != XFS_DINODE_FMT_LOCAL,
3376 __func__, ip->i_ino, ip);
3380 if (XFS_TEST_ERROR(ip->i_df.if_nextents + xfs_ifork_nextents(&ip->i_af) >
3381 ip->i_nblocks, mp, XFS_ERRTAG_IFLUSH_5)) {
3385 __func__, ip->i_ino,
3386 ip->i_df.if_nextents + xfs_ifork_nextents(&ip->i_af),
3387 ip->i_nblocks, ip);
3390 if (XFS_TEST_ERROR(ip->i_forkoff > mp->m_sb.sb_inodesize,
3394 __func__, ip->i_ino, ip->i_forkoff, ip);
3407 ip->i_flushiter++;
3413 if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL &&
3414 xfs_ifork_verify_local_data(ip))
3416 if (xfs_inode_has_attr_fork(ip) &&
3417 ip->i_af.if_format == XFS_DINODE_FMT_LOCAL &&
3418 xfs_ifork_verify_local_attr(ip))
3426 xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn);
3430 if (ip->i_flushiter == DI_MAX_FLUSH)
3431 ip->i_flushiter = 0;
3434 xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK);
3435 if (xfs_inode_has_attr_fork(ip))
3436 xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK);
3472 xfs_inode_mark_sick(ip, XFS_SICK_INO_CORE);
3495 struct xfs_inode *ip;
3506 ip = iip->ili_inode;
3511 if (__xfs_iflags_test(ip, XFS_IRECLAIM | XFS_IFLUSHING))
3513 if (xfs_ipincount(ip))
3523 spin_lock(&ip->i_flags_lock);
3524 ASSERT(!__xfs_iflags_test(ip, XFS_ISTALE));
3525 if (__xfs_iflags_test(ip, XFS_IRECLAIM | XFS_IFLUSHING)) {
3526 spin_unlock(&ip->i_flags_lock);
3536 if (!xfs_ilock_nowait(ip, XFS_ILOCK_SHARED)) {
3537 spin_unlock(&ip->i_flags_lock);
3540 __xfs_iflags_set(ip, XFS_IFLUSHING);
3541 spin_unlock(&ip->i_flags_lock);
3551 xfs_iunpin_wait(ip);
3552 xfs_iflush_abort(ip);
3553 xfs_iunlock(ip, XFS_ILOCK_SHARED);
3559 if (xfs_ipincount(ip)) {
3560 xfs_iflags_clear(ip, XFS_IFLUSHING);
3561 xfs_iunlock(ip, XFS_ILOCK_SHARED);
3565 if (!xfs_inode_clean(ip))
3566 error = xfs_iflush(ip, bp);
3568 xfs_iflags_clear(ip, XFS_IFLUSHING);
3569 xfs_iunlock(ip, XFS_ILOCK_SHARED);
3604 struct xfs_inode *ip)
3606 trace_xfs_irele(ip, _RET_IP_);
3607 iput(VFS_I(ip));
3615 struct xfs_inode *ip)
3619 xfs_ilock(ip, XFS_ILOCK_SHARED);
3620 if (xfs_ipincount(ip))
3621 seq = ip->i_itemp->ili_commit_seq;
3622 xfs_iunlock(ip, XFS_ILOCK_SHARED);
3626 return xfs_log_force_seq(ip->i_mount, seq, XFS_LOG_SYNC, NULL);
3802 struct xfs_inode *ip)
3808 xfs_agnumber_t agno = XFS_INO_TO_AGNO(mp, ip->i_ino);
3809 xfs_agino_t agino = XFS_INO_TO_AGINO(mp, ip->i_ino);
3827 if (!xfs_inode_unlinked_incomplete(ip)) {
3835 trace_xfs_inode_reload_unlinked_bucket(ip);
3848 next_ip = ip;
3890 struct xfs_inode *ip)
3895 error = xfs_trans_alloc_empty(ip->i_mount, &tp);
3899 xfs_ilock(ip, XFS_ILOCK_SHARED);
3900 if (xfs_inode_unlinked_incomplete(ip))
3901 error = xfs_inode_reload_unlinked_bucket(tp, ip);
3902 xfs_iunlock(ip, XFS_ILOCK_SHARED);
3911 const struct xfs_inode *ip,
3918 switch (ip->i_vnode.i_mode & S_IFMT) {
3926 return ip->i_sick & (XFS_SICK_INO_BMBTD_ZAPPED | datamask);
3928 return ip->i_sick & XFS_SICK_INO_BMBTA_ZAPPED;
3938 struct xfs_inode *ip,
3942 struct xfs_ifork *ifp = xfs_ifork_ptr(ip, XFS_DATA_FORK);
3945 if (XFS_IS_REALTIME_INODE(ip))
3947 *dblocks = ip->i_nblocks - *rblocks;