• Home
  • Raw
  • Download

Lines Matching refs:ip

70 	struct xfs_inode	*ip)  in xfs_get_extsz_hint()  argument
72 if ((ip->i_d.di_flags & XFS_DIFLAG_EXTSIZE) && ip->i_d.di_extsize) in xfs_get_extsz_hint()
73 return ip->i_d.di_extsize; in xfs_get_extsz_hint()
74 if (XFS_IS_REALTIME_INODE(ip)) in xfs_get_extsz_hint()
75 return ip->i_mount->m_sb.sb_rextsize; in xfs_get_extsz_hint()
96 xfs_inode_t *ip) in xfs_ilock_map_shared() argument
100 if ((ip->i_d.di_format == XFS_DINODE_FMT_BTREE) && in xfs_ilock_map_shared()
101 ((ip->i_df.if_flags & XFS_IFEXTENTS) == 0)) { in xfs_ilock_map_shared()
107 xfs_ilock(ip, lock_mode); in xfs_ilock_map_shared()
118 xfs_inode_t *ip, in xfs_iunlock_map_shared() argument
121 xfs_iunlock(ip, lock_mode); in xfs_iunlock_map_shared()
146 xfs_inode_t *ip, in xfs_ilock() argument
149 trace_xfs_ilock(ip, lock_flags, _RET_IP_); in xfs_ilock()
163 mrupdate_nested(&ip->i_iolock, XFS_IOLOCK_DEP(lock_flags)); in xfs_ilock()
165 mraccess_nested(&ip->i_iolock, XFS_IOLOCK_DEP(lock_flags)); in xfs_ilock()
168 mrupdate_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags)); in xfs_ilock()
170 mraccess_nested(&ip->i_lock, XFS_ILOCK_DEP(lock_flags)); in xfs_ilock()
187 xfs_inode_t *ip, in xfs_ilock_nowait() argument
190 trace_xfs_ilock_nowait(ip, lock_flags, _RET_IP_); in xfs_ilock_nowait()
204 if (!mrtryupdate(&ip->i_iolock)) in xfs_ilock_nowait()
207 if (!mrtryaccess(&ip->i_iolock)) in xfs_ilock_nowait()
211 if (!mrtryupdate(&ip->i_lock)) in xfs_ilock_nowait()
214 if (!mrtryaccess(&ip->i_lock)) in xfs_ilock_nowait()
221 mrunlock_excl(&ip->i_iolock); in xfs_ilock_nowait()
223 mrunlock_shared(&ip->i_iolock); in xfs_ilock_nowait()
242 xfs_inode_t *ip, in xfs_iunlock() argument
258 mrunlock_excl(&ip->i_iolock); in xfs_iunlock()
260 mrunlock_shared(&ip->i_iolock); in xfs_iunlock()
263 mrunlock_excl(&ip->i_lock); in xfs_iunlock()
265 mrunlock_shared(&ip->i_lock); in xfs_iunlock()
267 trace_xfs_iunlock(ip, lock_flags, _RET_IP_); in xfs_iunlock()
276 xfs_inode_t *ip, in xfs_ilock_demote() argument
283 mrdemote(&ip->i_lock); in xfs_ilock_demote()
285 mrdemote(&ip->i_iolock); in xfs_ilock_demote()
287 trace_xfs_ilock_demote(ip, lock_flags, _RET_IP_); in xfs_ilock_demote()
293 xfs_inode_t *ip, in xfs_isilocked() argument
298 return !!ip->i_lock.mr_writer; in xfs_isilocked()
299 return rwsem_is_locked(&ip->i_lock.mr_lock); in xfs_isilocked()
304 return !!ip->i_iolock.mr_writer; in xfs_isilocked()
305 return rwsem_is_locked(&ip->i_iolock.mr_lock); in xfs_isilocked()
315 struct xfs_inode *ip) in __xfs_iflock() argument
317 wait_queue_head_t *wq = bit_waitqueue(&ip->i_flags, __XFS_IFLOCK_BIT); in __xfs_iflock()
318 DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_IFLOCK_BIT); in __xfs_iflock()
322 if (xfs_isiflocked(ip)) in __xfs_iflock()
324 } while (!xfs_iflock_nowait(ip)); in __xfs_iflock()
502 xfs_inode_t *ip, in xfs_iformat() argument
513 xfs_warn(ip->i_mount, in xfs_iformat()
515 (unsigned long long)ip->i_ino, in xfs_iformat()
521 ip->i_mount, dip); in xfs_iformat()
525 if (unlikely(dip->di_forkoff > ip->i_mount->m_sb.sb_inodesize)) { in xfs_iformat()
526 xfs_warn(ip->i_mount, "corrupt dinode %Lu, forkoff = 0x%x.", in xfs_iformat()
527 (unsigned long long)ip->i_ino, in xfs_iformat()
530 ip->i_mount, dip); in xfs_iformat()
534 if (unlikely((ip->i_d.di_flags & XFS_DIFLAG_REALTIME) && in xfs_iformat()
535 !ip->i_mount->m_rtdev_targp)) { in xfs_iformat()
536 xfs_warn(ip->i_mount, in xfs_iformat()
538 ip->i_ino); in xfs_iformat()
540 XFS_ERRLEVEL_LOW, ip->i_mount, dip); in xfs_iformat()
544 switch (ip->i_d.di_mode & S_IFMT) { in xfs_iformat()
551 ip->i_mount, dip); in xfs_iformat()
554 ip->i_d.di_size = 0; in xfs_iformat()
555 ip->i_df.if_u2.if_rdev = xfs_dinode_get_rdev(dip); in xfs_iformat()
567 xfs_warn(ip->i_mount, in xfs_iformat()
569 (unsigned long long) ip->i_ino); in xfs_iformat()
572 ip->i_mount, dip); in xfs_iformat()
577 if (unlikely(di_size > XFS_DFORK_DSIZE(dip, ip->i_mount))) { in xfs_iformat()
578 xfs_warn(ip->i_mount, in xfs_iformat()
580 (unsigned long long) ip->i_ino, in xfs_iformat()
584 ip->i_mount, dip); in xfs_iformat()
589 error = xfs_iformat_local(ip, dip, XFS_DATA_FORK, size); in xfs_iformat()
592 error = xfs_iformat_extents(ip, dip, XFS_DATA_FORK); in xfs_iformat()
595 error = xfs_iformat_btree(ip, dip, XFS_DATA_FORK); in xfs_iformat()
599 ip->i_mount); in xfs_iformat()
605 XFS_ERROR_REPORT("xfs_iformat(7)", XFS_ERRLEVEL_LOW, ip->i_mount); in xfs_iformat()
614 ASSERT(ip->i_afp == NULL); in xfs_iformat()
615 ip->i_afp = kmem_zone_zalloc(xfs_ifork_zone, KM_SLEEP | KM_NOFS); in xfs_iformat()
623 xfs_warn(ip->i_mount, in xfs_iformat()
625 (unsigned long long) ip->i_ino, in xfs_iformat()
629 ip->i_mount, dip); in xfs_iformat()
633 error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK, size); in xfs_iformat()
636 error = xfs_iformat_extents(ip, dip, XFS_ATTR_FORK); in xfs_iformat()
639 error = xfs_iformat_btree(ip, dip, XFS_ATTR_FORK); in xfs_iformat()
646 kmem_zone_free(xfs_ifork_zone, ip->i_afp); in xfs_iformat()
647 ip->i_afp = NULL; in xfs_iformat()
648 xfs_idestroy_fork(ip, XFS_DATA_FORK); in xfs_iformat()
665 xfs_inode_t *ip, in xfs_iformat_local() argument
678 if (unlikely(size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) { in xfs_iformat_local()
679 xfs_warn(ip->i_mount, in xfs_iformat_local()
681 (unsigned long long) ip->i_ino, size, in xfs_iformat_local()
682 XFS_DFORK_SIZE(dip, ip->i_mount, whichfork)); in xfs_iformat_local()
684 ip->i_mount, dip); in xfs_iformat_local()
687 ifp = XFS_IFORK_PTR(ip, whichfork); in xfs_iformat_local()
717 xfs_inode_t *ip, in xfs_iformat_extents() argument
727 ifp = XFS_IFORK_PTR(ip, whichfork); in xfs_iformat_extents()
736 if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, ip->i_mount, whichfork))) { in xfs_iformat_extents()
737 xfs_warn(ip->i_mount, "corrupt inode %Lu ((a)extents = %d).", in xfs_iformat_extents()
738 (unsigned long long) ip->i_ino, nex); in xfs_iformat_extents()
740 ip->i_mount, dip); in xfs_iformat_extents()
755 xfs_validate_extents(ifp, nex, XFS_EXTFMT_INODE(ip)); in xfs_iformat_extents()
761 XFS_BMAP_TRACE_EXLIST(ip, nex, whichfork); in xfs_iformat_extents()
763 XFS_EXTFMT_INODE(ip) == XFS_EXTFMT_NOSTATE) in xfs_iformat_extents()
768 ip->i_mount); in xfs_iformat_extents()
786 xfs_inode_t *ip, in xfs_iformat_btree() argument
790 struct xfs_mount *mp = ip->i_mount; in xfs_iformat_btree()
797 ifp = XFS_IFORK_PTR(ip, whichfork); in xfs_iformat_btree()
809 if (unlikely(XFS_IFORK_NEXTENTS(ip, whichfork) <= in xfs_iformat_btree()
810 XFS_IFORK_MAXEXT(ip, whichfork) || in xfs_iformat_btree()
813 XFS_IFORK_NEXTENTS(ip, whichfork) > ip->i_d.di_nblocks)) { in xfs_iformat_btree()
815 (unsigned long long) ip->i_ino); in xfs_iformat_btree()
828 xfs_bmdr_to_bmbt(ip, dfp, XFS_DFORK_SIZE(dip, ip->i_mount, whichfork), in xfs_iformat_btree()
972 xfs_inode_t *ip) in xfs_ip2xflags() argument
974 xfs_icdinode_t *dic = &ip->i_d; in xfs_ip2xflags()
977 (XFS_IFORK_Q(ip) ? XFS_XFLAG_HASATTR : 0); in xfs_ip2xflags()
991 struct xfs_inode *ip, in xfs_dinode_verify() argument
1006 if (be64_to_cpu(dip->di_ino) != ip->i_ino) in xfs_dinode_verify()
1036 xfs_inode_t *ip, in xfs_iread() argument
1046 error = xfs_imap(mp, tp, ip->i_ino, &ip->i_imap, iget_flags); in xfs_iread()
1053 error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &dip, &bp, 0, iget_flags); in xfs_iread()
1058 if (!xfs_dinode_verify(mp, ip, dip)) { in xfs_iread()
1060 __func__, ip->i_ino); in xfs_iread()
1075 xfs_dinode_from_disk(&ip->i_d, dip); in xfs_iread()
1076 error = xfs_iformat(ip, dip); in xfs_iread()
1089 ip->i_d.di_magic = be16_to_cpu(dip->di_magic); in xfs_iread()
1090 ip->i_d.di_version = dip->di_version; in xfs_iread()
1091 ip->i_d.di_gen = be32_to_cpu(dip->di_gen); in xfs_iread()
1092 ip->i_d.di_flushiter = be16_to_cpu(dip->di_flushiter); in xfs_iread()
1095 ip->i_d.di_ino = be64_to_cpu(dip->di_ino); in xfs_iread()
1096 uuid_copy(&ip->i_d.di_uuid, &dip->di_uuid); in xfs_iread()
1106 ip->i_d.di_mode = 0; in xfs_iread()
1120 if (ip->i_d.di_version == 1) { in xfs_iread()
1121 ip->i_d.di_nlink = ip->i_d.di_onlink; in xfs_iread()
1122 ip->i_d.di_onlink = 0; in xfs_iread()
1123 xfs_set_projid(ip, 0); in xfs_iread()
1126 ip->i_delayed_blks = 0; in xfs_iread()
1160 xfs_inode_t *ip, in xfs_iread_extents() argument
1167 if (unlikely(XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)) { in xfs_iread_extents()
1169 ip->i_mount); in xfs_iread_extents()
1172 nextents = XFS_IFORK_NEXTENTS(ip, whichfork); in xfs_iread_extents()
1173 ifp = XFS_IFORK_PTR(ip, whichfork); in xfs_iread_extents()
1181 error = xfs_bmap_read_extents(tp, ip, whichfork); in xfs_iread_extents()
1187 xfs_validate_extents(ifp, nextents, XFS_EXTFMT_INODE(ip)); in xfs_iread_extents()
1236 xfs_inode_t *ip; in xfs_ialloc() local
1262 XFS_ILOCK_EXCL, &ip); in xfs_ialloc()
1265 ASSERT(ip != NULL); in xfs_ialloc()
1267 ip->i_d.di_mode = mode; in xfs_ialloc()
1268 ip->i_d.di_onlink = 0; in xfs_ialloc()
1269 ip->i_d.di_nlink = nlink; in xfs_ialloc()
1270 ASSERT(ip->i_d.di_nlink == nlink); in xfs_ialloc()
1271 ip->i_d.di_uid = current_fsuid(); in xfs_ialloc()
1272 ip->i_d.di_gid = current_fsgid(); in xfs_ialloc()
1273 xfs_set_projid(ip, prid); in xfs_ialloc()
1274 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); in xfs_ialloc()
1283 ip->i_d.di_version == 1) { in xfs_ialloc()
1284 ip->i_d.di_version = 2; in xfs_ialloc()
1294 if ((prid != 0) && (ip->i_d.di_version == 1)) in xfs_ialloc()
1295 xfs_bump_ino_vers2(tp, ip); in xfs_ialloc()
1298 ip->i_d.di_gid = pip->i_d.di_gid; in xfs_ialloc()
1300 ip->i_d.di_mode |= S_ISGID; in xfs_ialloc()
1310 (ip->i_d.di_mode & S_ISGID) && in xfs_ialloc()
1311 (!in_group_p((gid_t)ip->i_d.di_gid))) { in xfs_ialloc()
1312 ip->i_d.di_mode &= ~S_ISGID; in xfs_ialloc()
1315 ip->i_d.di_size = 0; in xfs_ialloc()
1316 ip->i_d.di_nextents = 0; in xfs_ialloc()
1317 ASSERT(ip->i_d.di_nblocks == 0); in xfs_ialloc()
1320 ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec; in xfs_ialloc()
1321 ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec; in xfs_ialloc()
1322 ip->i_d.di_atime = ip->i_d.di_mtime; in xfs_ialloc()
1323 ip->i_d.di_ctime = ip->i_d.di_mtime; in xfs_ialloc()
1328 ip->i_d.di_extsize = 0; in xfs_ialloc()
1329 ip->i_d.di_dmevmask = 0; in xfs_ialloc()
1330 ip->i_d.di_dmstate = 0; in xfs_ialloc()
1331 ip->i_d.di_flags = 0; in xfs_ialloc()
1333 if (ip->i_d.di_version == 3) { in xfs_ialloc()
1334 ASSERT(ip->i_d.di_ino == ino); in xfs_ialloc()
1335 ASSERT(uuid_equal(&ip->i_d.di_uuid, &mp->m_sb.sb_uuid)); in xfs_ialloc()
1336 ip->i_d.di_crc = 0; in xfs_ialloc()
1337 ip->i_d.di_changecount = 1; in xfs_ialloc()
1338 ip->i_d.di_lsn = 0; in xfs_ialloc()
1339 ip->i_d.di_flags2 = 0; in xfs_ialloc()
1340 memset(&(ip->i_d.di_pad2[0]), 0, sizeof(ip->i_d.di_pad2)); in xfs_ialloc()
1341 ip->i_d.di_crtime = ip->i_d.di_mtime; in xfs_ialloc()
1351 ip->i_d.di_format = XFS_DINODE_FMT_DEV; in xfs_ialloc()
1352 ip->i_df.if_u2.if_rdev = rdev; in xfs_ialloc()
1353 ip->i_df.if_flags = 0; in xfs_ialloc()
1373 ip->i_d.di_extsize = pip->i_d.di_extsize; in xfs_ialloc()
1380 ip->i_d.di_extsize = pip->i_d.di_extsize; in xfs_ialloc()
1402 ip->i_d.di_flags |= di_flags; in xfs_ialloc()
1406 ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS; in xfs_ialloc()
1407 ip->i_df.if_flags = XFS_IFEXTENTS; in xfs_ialloc()
1408 ip->i_df.if_bytes = ip->i_df.if_real_bytes = 0; in xfs_ialloc()
1409 ip->i_df.if_u1.if_extents = NULL; in xfs_ialloc()
1417 ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; in xfs_ialloc()
1418 ip->i_d.di_anextents = 0; in xfs_ialloc()
1423 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); in xfs_ialloc()
1424 xfs_trans_log_inode(tp, ip, flags); in xfs_ialloc()
1427 xfs_setup_inode(ip); in xfs_ialloc()
1431 error = xfs_filestream_associate(pip, ip); in xfs_ialloc()
1435 xfs_iflags_set(ip, XFS_IFILESTREAM); in xfs_ialloc()
1438 *ipp = ip; in xfs_ialloc()
1466 struct xfs_inode *ip, in xfs_itruncate_extents() argument
1470 struct xfs_mount *mp = ip->i_mount; in xfs_itruncate_extents()
1482 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); in xfs_itruncate_extents()
1483 ASSERT(!atomic_read(&VFS_I(ip)->i_count) || in xfs_itruncate_extents()
1484 xfs_isilocked(ip, XFS_IOLOCK_EXCL)); in xfs_itruncate_extents()
1485 ASSERT(new_size <= XFS_ISIZE(ip)); in xfs_itruncate_extents()
1487 ASSERT(ip->i_itemp != NULL); in xfs_itruncate_extents()
1488 ASSERT(ip->i_itemp->ili_lock_flags == 0); in xfs_itruncate_extents()
1489 ASSERT(!XFS_NOT_DQATTACHED(mp, ip)); in xfs_itruncate_extents()
1491 trace_xfs_itruncate_extents_start(ip, new_size); in xfs_itruncate_extents()
1511 error = xfs_bunmapi(tp, ip, in xfs_itruncate_extents()
1526 xfs_trans_ijoin(tp, ip, 0); in xfs_itruncate_extents()
1535 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_itruncate_extents()
1542 xfs_trans_ijoin(tp, ip, 0); in xfs_itruncate_extents()
1564 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_itruncate_extents()
1566 trace_xfs_itruncate_extents_end(ip, new_size); in xfs_itruncate_extents()
1589 xfs_inode_t *ip) in xfs_iunlink() argument
1601 ASSERT(ip->i_d.di_nlink == 0); in xfs_iunlink()
1602 ASSERT(ip->i_d.di_mode != 0); in xfs_iunlink()
1610 error = xfs_read_agi(mp, tp, XFS_INO_TO_AGNO(mp, ip->i_ino), &agibp); in xfs_iunlink()
1619 agino = XFS_INO_TO_AGINO(mp, ip->i_ino); in xfs_iunlink()
1632 error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &dip, &ibp, in xfs_iunlink()
1639 offset = ip->i_imap.im_boffset + in xfs_iunlink()
1669 xfs_inode_t *ip) in xfs_iunlink_remove() argument
1687 agno = XFS_INO_TO_AGNO(mp, ip->i_ino); in xfs_iunlink_remove()
1703 agino = XFS_INO_TO_AGINO(mp, ip->i_ino); in xfs_iunlink_remove()
1717 error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &dip, &ibp, in xfs_iunlink_remove()
1728 offset = ip->i_imap.im_boffset + in xfs_iunlink_remove()
1793 error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &dip, &ibp, in xfs_iunlink_remove()
1805 offset = ip->i_imap.im_boffset + in xfs_iunlink_remove()
1854 xfs_inode_t *ip; in xfs_ifree_cluster() local
1936 ip = radix_tree_lookup(&pag->pag_ici_root, in xfs_ifree_cluster()
1940 if (!ip) { in xfs_ifree_cluster()
1952 spin_lock(&ip->i_flags_lock); in xfs_ifree_cluster()
1953 if (ip->i_ino != inum + i || in xfs_ifree_cluster()
1954 __xfs_iflags_test(ip, XFS_ISTALE)) { in xfs_ifree_cluster()
1955 spin_unlock(&ip->i_flags_lock); in xfs_ifree_cluster()
1959 spin_unlock(&ip->i_flags_lock); in xfs_ifree_cluster()
1968 if (ip != free_ip && in xfs_ifree_cluster()
1969 !xfs_ilock_nowait(ip, XFS_ILOCK_EXCL)) { in xfs_ifree_cluster()
1976 xfs_iflock(ip); in xfs_ifree_cluster()
1977 xfs_iflags_set(ip, XFS_ISTALE); in xfs_ifree_cluster()
1983 iip = ip->i_itemp; in xfs_ifree_cluster()
1984 if (!iip || xfs_inode_clean(ip)) { in xfs_ifree_cluster()
1985 ASSERT(ip != free_ip); in xfs_ifree_cluster()
1986 xfs_ifunlock(ip); in xfs_ifree_cluster()
1987 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_ifree_cluster()
2000 if (ip != free_ip) in xfs_ifree_cluster()
2001 xfs_iunlock(ip, XFS_ILOCK_EXCL); in xfs_ifree_cluster()
2025 xfs_inode_t *ip, in xfs_ifree() argument
2034 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); in xfs_ifree()
2035 ASSERT(ip->i_d.di_nlink == 0); in xfs_ifree()
2036 ASSERT(ip->i_d.di_nextents == 0); in xfs_ifree()
2037 ASSERT(ip->i_d.di_anextents == 0); in xfs_ifree()
2038 ASSERT(ip->i_d.di_size == 0 || !S_ISREG(ip->i_d.di_mode)); in xfs_ifree()
2039 ASSERT(ip->i_d.di_nblocks == 0); in xfs_ifree()
2044 error = xfs_iunlink_remove(tp, ip); in xfs_ifree()
2049 error = xfs_difree(tp, ip->i_ino, flist, &delete, &first_ino); in xfs_ifree()
2053 ip->i_d.di_mode = 0; /* mark incore inode as free */ in xfs_ifree()
2054 ip->i_d.di_flags = 0; in xfs_ifree()
2055 ip->i_d.di_dmevmask = 0; in xfs_ifree()
2056 ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */ in xfs_ifree()
2057 ip->i_d.di_format = XFS_DINODE_FMT_EXTENTS; in xfs_ifree()
2058 ip->i_d.di_aformat = XFS_DINODE_FMT_EXTENTS; in xfs_ifree()
2063 ip->i_d.di_gen++; in xfs_ifree()
2065 xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); in xfs_ifree()
2067 error = xfs_imap_to_bp(ip->i_mount, tp, &ip->i_imap, &dip, &ibp, in xfs_ifree()
2087 error = xfs_ifree_cluster(ip, tp, first_ino); in xfs_ifree()
2113 xfs_inode_t *ip, in xfs_iroot_realloc() argument
2117 struct xfs_mount *mp = ip->i_mount; in xfs_iroot_realloc()
2133 ifp = XFS_IFORK_PTR(ip, whichfork); in xfs_iroot_realloc()
2164 XFS_IFORK_SIZE(ip, whichfork) + XFS_BROOT_SIZE_ADJ(ip)); in xfs_iroot_realloc()
2188 XFS_BMBT_BLOCK_LEN(ip->i_mount)); in xfs_iroot_realloc()
2218 XFS_IFORK_SIZE(ip, whichfork) + XFS_BROOT_SIZE_ADJ(ip)); in xfs_iroot_realloc()
2240 xfs_inode_t *ip, in xfs_idata_realloc() argument
2252 ifp = XFS_IFORK_PTR(ip, whichfork); in xfs_idata_realloc()
2312 ASSERT(ifp->if_bytes <= XFS_IFORK_SIZE(ip, whichfork)); in xfs_idata_realloc()
2317 xfs_inode_t *ip, in xfs_idestroy_fork() argument
2322 ifp = XFS_IFORK_PTR(ip, whichfork); in xfs_idestroy_fork()
2334 if (XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_LOCAL) { in xfs_idestroy_fork()
2353 kmem_zone_free(xfs_ifork_zone, ip->i_afp); in xfs_idestroy_fork()
2354 ip->i_afp = NULL; in xfs_idestroy_fork()
2365 struct xfs_inode *ip) in xfs_iunpin() argument
2367 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); in xfs_iunpin()
2369 trace_xfs_inode_unpin_nowait(ip, _RET_IP_); in xfs_iunpin()
2372 xfs_log_force_lsn(ip->i_mount, ip->i_itemp->ili_last_lsn, 0); in xfs_iunpin()
2378 struct xfs_inode *ip) in __xfs_iunpin_wait() argument
2380 wait_queue_head_t *wq = bit_waitqueue(&ip->i_flags, __XFS_IPINNED_BIT); in __xfs_iunpin_wait()
2381 DEFINE_WAIT_BIT(wait, &ip->i_flags, __XFS_IPINNED_BIT); in __xfs_iunpin_wait()
2383 xfs_iunpin(ip); in __xfs_iunpin_wait()
2387 if (xfs_ipincount(ip)) in __xfs_iunpin_wait()
2389 } while (xfs_ipincount(ip)); in __xfs_iunpin_wait()
2395 struct xfs_inode *ip) in xfs_iunpin_wait() argument
2397 if (xfs_ipincount(ip)) in xfs_iunpin_wait()
2398 __xfs_iunpin_wait(ip); in xfs_iunpin_wait()
2414 xfs_inode_t *ip, in xfs_iextents_copy() argument
2424 ifp = XFS_IFORK_PTR(ip, whichfork); in xfs_iextents_copy()
2425 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); in xfs_iextents_copy()
2429 XFS_BMAP_TRACE_EXLIST(ip, nrecs, whichfork); in xfs_iextents_copy()
2456 xfs_validate_extents(ifp, copied, XFS_EXTFMT_INODE(ip)); in xfs_iextents_copy()
2474 xfs_inode_t *ip, in xfs_iflush_fork() argument
2492 ifp = XFS_IFORK_PTR(ip, whichfork); in xfs_iflush_fork()
2502 mp = ip->i_mount; in xfs_iflush_fork()
2503 switch (XFS_IFORK_FORMAT(ip, whichfork)) { in xfs_iflush_fork()
2508 ASSERT(ifp->if_bytes <= XFS_IFORK_SIZE(ip, whichfork)); in xfs_iflush_fork()
2519 ASSERT(XFS_IFORK_NEXTENTS(ip, whichfork) > 0); in xfs_iflush_fork()
2520 (void)xfs_iextents_copy(ip, (xfs_bmbt_rec_t *)cp, in xfs_iflush_fork()
2530 (XFS_IFORK_SIZE(ip, whichfork) + in xfs_iflush_fork()
2531 XFS_BROOT_SIZE_ADJ(ip))); in xfs_iflush_fork()
2541 xfs_dinode_put_rdev(dip, ip->i_df.if_u2.if_rdev); in xfs_iflush_fork()
2549 &ip->i_df.if_u2.if_uuid, in xfs_iflush_fork()
2562 xfs_inode_t *ip, in xfs_iflush_cluster() argument
2565 xfs_mount_t *mp = ip->i_mount; in xfs_iflush_cluster()
2577 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); in xfs_iflush_cluster()
2586 first_index = XFS_INO_TO_AGINO(mp, ip->i_ino) & mask; in xfs_iflush_cluster()
2596 if (iq == ip) in xfs_iflush_cluster()
2605 spin_lock(&ip->i_flags_lock); in xfs_iflush_cluster()
2606 if (!ip->i_ino || in xfs_iflush_cluster()
2608 spin_unlock(&ip->i_flags_lock); in xfs_iflush_cluster()
2611 spin_unlock(&ip->i_flags_lock); in xfs_iflush_cluster()
2723 struct xfs_inode *ip, in xfs_iflush() argument
2726 struct xfs_mount *mp = ip->i_mount; in xfs_iflush()
2733 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); in xfs_iflush()
2734 ASSERT(xfs_isiflocked(ip)); in xfs_iflush()
2735 ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || in xfs_iflush()
2736 ip->i_d.di_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)); in xfs_iflush()
2740 xfs_iunpin_wait(ip); in xfs_iflush()
2750 if (xfs_iflags_test(ip, XFS_ISTALE)) { in xfs_iflush()
2751 xfs_ifunlock(ip); in xfs_iflush()
2771 error = xfs_imap_to_bp(mp, NULL, &ip->i_imap, &dip, &bp, XBF_TRYLOCK, in xfs_iflush()
2774 xfs_ifunlock(ip); in xfs_iflush()
2781 error = xfs_iflush_int(ip, bp); in xfs_iflush()
2796 error = xfs_iflush_cluster(ip, bp); in xfs_iflush()
2812 xfs_iflush_abort(ip, false); in xfs_iflush()
2819 struct xfs_inode *ip, in xfs_iflush_int() argument
2822 struct xfs_inode_log_item *iip = ip->i_itemp; in xfs_iflush_int()
2824 struct xfs_mount *mp = ip->i_mount; in xfs_iflush_int()
2826 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); in xfs_iflush_int()
2827 ASSERT(xfs_isiflocked(ip)); in xfs_iflush_int()
2828 ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || in xfs_iflush_int()
2829 ip->i_d.di_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)); in xfs_iflush_int()
2833 dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset); in xfs_iflush_int()
2839 __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip); in xfs_iflush_int()
2842 if (XFS_TEST_ERROR(ip->i_d.di_magic != XFS_DINODE_MAGIC, in xfs_iflush_int()
2846 __func__, ip->i_ino, ip, ip->i_d.di_magic); in xfs_iflush_int()
2849 if (S_ISREG(ip->i_d.di_mode)) { in xfs_iflush_int()
2851 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && in xfs_iflush_int()
2852 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE), in xfs_iflush_int()
2856 __func__, ip->i_ino, ip); in xfs_iflush_int()
2859 } else if (S_ISDIR(ip->i_d.di_mode)) { in xfs_iflush_int()
2861 (ip->i_d.di_format != XFS_DINODE_FMT_EXTENTS) && in xfs_iflush_int()
2862 (ip->i_d.di_format != XFS_DINODE_FMT_BTREE) && in xfs_iflush_int()
2863 (ip->i_d.di_format != XFS_DINODE_FMT_LOCAL), in xfs_iflush_int()
2867 __func__, ip->i_ino, ip); in xfs_iflush_int()
2871 if (XFS_TEST_ERROR(ip->i_d.di_nextents + ip->i_d.di_anextents > in xfs_iflush_int()
2872 ip->i_d.di_nblocks, mp, XFS_ERRTAG_IFLUSH_5, in xfs_iflush_int()
2877 __func__, ip->i_ino, in xfs_iflush_int()
2878 ip->i_d.di_nextents + ip->i_d.di_anextents, in xfs_iflush_int()
2879 ip->i_d.di_nblocks, ip); in xfs_iflush_int()
2882 if (XFS_TEST_ERROR(ip->i_d.di_forkoff > mp->m_sb.sb_inodesize, in xfs_iflush_int()
2886 __func__, ip->i_ino, ip->i_d.di_forkoff, ip); in xfs_iflush_int()
2894 ip->i_d.di_flushiter++; in xfs_iflush_int()
2902 xfs_dinode_to_disk(dip, &ip->i_d); in xfs_iflush_int()
2905 if (ip->i_d.di_flushiter == DI_MAX_FLUSH) in xfs_iflush_int()
2906 ip->i_d.di_flushiter = 0; in xfs_iflush_int()
2914 ASSERT(ip->i_d.di_version == 1 || xfs_sb_version_hasnlink(&mp->m_sb)); in xfs_iflush_int()
2915 if (ip->i_d.di_version == 1) { in xfs_iflush_int()
2920 ASSERT(ip->i_d.di_nlink <= XFS_MAXLINK_1); in xfs_iflush_int()
2921 dip->di_onlink = cpu_to_be16(ip->i_d.di_nlink); in xfs_iflush_int()
2928 ip->i_d.di_version = 2; in xfs_iflush_int()
2930 ip->i_d.di_onlink = 0; in xfs_iflush_int()
2932 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad)); in xfs_iflush_int()
2935 ASSERT(xfs_get_projid(ip) == 0); in xfs_iflush_int()
2939 xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK, bp); in xfs_iflush_int()
2940 if (XFS_IFORK_Q(ip)) in xfs_iflush_int()
2941 xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK, bp); in xfs_iflush_int()
2985 if (ip->i_d.di_version == 3) in xfs_iflush_int()
3032 xfs_inode_t *ip, /* incore inode pointer */ in xfs_iext_insert() argument
3038 xfs_ifork_t *ifp = (state & BMAP_ATTRFORK) ? ip->i_afp : &ip->i_df; in xfs_iext_insert()
3041 trace_xfs_iext_insert(ip, idx, new, state, _RET_IP_); in xfs_iext_insert()
3284 xfs_inode_t *ip, /* incore inode pointer */ in xfs_iext_remove() argument
3289 xfs_ifork_t *ifp = (state & BMAP_ATTRFORK) ? ip->i_afp : &ip->i_df; in xfs_iext_remove()
3293 trace_xfs_iext_remove(ip, idx, state, _RET_IP_); in xfs_iext_remove()
4037 xfs_can_free_eofblocks(struct xfs_inode *ip, bool force) in xfs_can_free_eofblocks() argument
4040 if (!S_ISREG(ip->i_d.di_mode)) in xfs_can_free_eofblocks()
4047 if (VFS_I(ip)->i_size == 0 && in xfs_can_free_eofblocks()
4048 VN_CACHED(VFS_I(ip)) == 0 && in xfs_can_free_eofblocks()
4049 ip->i_delayed_blks == 0) in xfs_can_free_eofblocks()
4053 if (!(ip->i_df.if_flags & XFS_IFEXTENTS)) in xfs_can_free_eofblocks()
4060 if (ip->i_d.di_flags & (XFS_DIFLAG_PREALLOC | XFS_DIFLAG_APPEND)) in xfs_can_free_eofblocks()
4061 if (!force || ip->i_delayed_blks == 0) in xfs_can_free_eofblocks()