Lines Matching refs:dip
171 struct xfs_dinode *dip = xfs_buf_offset(bp, ioffset); in xrep_dinode_buf_core() local
179 agino = be32_to_cpu(dip->di_next_unlinked); in xrep_dinode_buf_core()
184 if (dip->di_magic == cpu_to_be16(XFS_DINODE_MAGIC) && in xrep_dinode_buf_core()
185 xfs_dinode_good_version(mp, dip->di_version)) in xrep_dinode_buf_core()
188 if (xfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize, in xrep_dinode_buf_core()
196 dip->di_magic = cpu_to_be16(XFS_DINODE_MAGIC); in xrep_dinode_buf_core()
197 dip->di_version = 3; in xrep_dinode_buf_core()
200 dip->di_next_unlinked = cpu_to_be32(NULLAGINO); in xrep_dinode_buf_core()
201 xfs_dinode_calc_crc(mp, dip); in xrep_dinode_buf_core()
226 struct xfs_dinode *dip) in xrep_dinode_header() argument
228 trace_xrep_dinode_header(sc, dip); in xrep_dinode_header()
230 dip->di_magic = cpu_to_be16(XFS_DINODE_MAGIC); in xrep_dinode_header()
231 if (!xfs_dinode_good_version(sc->mp, dip->di_version)) in xrep_dinode_header()
232 dip->di_version = 3; in xrep_dinode_header()
233 dip->di_ino = cpu_to_be64(sc->sm->sm_ino); in xrep_dinode_header()
234 uuid_copy(&dip->di_uuid, &sc->mp->m_sb.sb_meta_uuid); in xrep_dinode_header()
235 dip->di_gen = cpu_to_be32(sc->sm->sm_gen); in xrep_dinode_header()
483 struct xfs_dinode *dip) in xrep_dinode_mode() argument
486 uint16_t mode = be16_to_cpu(dip->di_mode); in xrep_dinode_mode()
489 trace_xrep_dinode_mode(sc, dip); in xrep_dinode_mode()
512 dip->di_mode = cpu_to_be16(mode); in xrep_dinode_mode()
513 dip->di_uid = 0; in xrep_dinode_mode()
514 dip->di_gid = 0; in xrep_dinode_mode()
522 struct xfs_dinode *dip) in xrep_dinode_nlinks() argument
524 if (dip->di_version > 1) in xrep_dinode_nlinks()
525 dip->di_onlink = 0; in xrep_dinode_nlinks()
527 dip->di_nlink = 0; in xrep_dinode_nlinks()
534 struct xfs_dinode *dip, in xrep_dinode_flags() argument
538 uint64_t flags2 = be64_to_cpu(dip->di_flags2); in xrep_dinode_flags()
539 uint16_t flags = be16_to_cpu(dip->di_flags); in xrep_dinode_flags()
540 uint16_t mode = be16_to_cpu(dip->di_mode); in xrep_dinode_flags()
542 trace_xrep_dinode_flags(sc, dip); in xrep_dinode_flags()
565 dip->di_nrext64_pad = 0; in xrep_dinode_flags()
566 else if (dip->di_version >= 3) in xrep_dinode_flags()
567 dip->di_v3_pad = 0; in xrep_dinode_flags()
568 dip->di_flags = cpu_to_be16(flags); in xrep_dinode_flags()
569 dip->di_flags2 = cpu_to_be64(flags2); in xrep_dinode_flags()
579 struct xfs_dinode *dip) in xrep_dinode_zap_symlink() argument
584 trace_xrep_dinode_zap_symlink(sc, dip); in xrep_dinode_zap_symlink()
586 dip->di_format = XFS_DINODE_FMT_LOCAL; in xrep_dinode_zap_symlink()
587 dip->di_size = cpu_to_be64(1); in xrep_dinode_zap_symlink()
588 p = XFS_DFORK_PTR(dip, XFS_DATA_FORK); in xrep_dinode_zap_symlink()
602 struct xfs_dinode *dip) in xrep_dinode_zap_dir() argument
609 trace_xrep_dinode_zap_dir(sc, dip); in xrep_dinode_zap_dir()
611 dip->di_format = XFS_DINODE_FMT_LOCAL; in xrep_dinode_zap_dir()
613 sfp = XFS_DFORK_PTR(dip, XFS_DATA_FORK); in xrep_dinode_zap_dir()
617 dip->di_size = cpu_to_be64(xfs_dir2_sf_hdr_size(i8count)); in xrep_dinode_zap_dir()
625 struct xfs_dinode *dip) in xrep_dinode_size() argument
628 uint64_t size = be64_to_cpu(dip->di_size); in xrep_dinode_size()
629 uint16_t mode = be16_to_cpu(dip->di_mode); in xrep_dinode_size()
631 trace_xrep_dinode_size(sc, dip); in xrep_dinode_size()
639 dip->di_size = 0; in xrep_dinode_size()
643 dip->di_size = cpu_to_be64(size & ~(1ULL << 63)); in xrep_dinode_size()
653 dip->di_size = cpu_to_be64(XFS_SYMLINK_MAXLEN); in xrep_dinode_size()
655 xrep_dinode_zap_symlink(ri, dip); in xrep_dinode_size()
665 dip->di_size = cpu_to_be64(XFS_DIR2_SPACE_SIZE); in xrep_dinode_size()
667 xrep_dinode_zap_dir(ri, dip); in xrep_dinode_size()
676 struct xfs_dinode *dip) in xrep_dinode_extsize_hints() argument
679 uint64_t flags2 = be64_to_cpu(dip->di_flags2); in xrep_dinode_extsize_hints()
680 uint16_t flags = be16_to_cpu(dip->di_flags); in xrep_dinode_extsize_hints()
681 uint16_t mode = be16_to_cpu(dip->di_mode); in xrep_dinode_extsize_hints()
685 trace_xrep_dinode_extsize_hints(sc, dip); in xrep_dinode_extsize_hints()
687 fa = xfs_inode_validate_extsize(mp, be32_to_cpu(dip->di_extsize), in xrep_dinode_extsize_hints()
690 dip->di_extsize = 0; in xrep_dinode_extsize_hints()
691 dip->di_flags &= ~cpu_to_be16(XFS_DIFLAG_EXTSIZE | in xrep_dinode_extsize_hints()
695 if (dip->di_version < 3) in xrep_dinode_extsize_hints()
698 fa = xfs_inode_validate_cowextsize(mp, be32_to_cpu(dip->di_cowextsize), in xrep_dinode_extsize_hints()
701 dip->di_cowextsize = 0; in xrep_dinode_extsize_hints()
702 dip->di_flags2 &= ~cpu_to_be64(XFS_DIFLAG2_COWEXTSIZE); in xrep_dinode_extsize_hints()
793 struct xfs_dinode *dip, in xrep_dinode_bad_extents_fork() argument
803 nex = xfs_dfork_nextents(dip, whichfork); in xrep_dinode_bad_extents_fork()
807 dp = XFS_DFORK_PTR(dip, whichfork); in xrep_dinode_bad_extents_fork()
809 isrt = dip->di_flags & cpu_to_be16(XFS_DIFLAG_REALTIME); in xrep_dinode_bad_extents_fork()
827 struct xfs_dinode *dip, in xrep_dinode_bad_bmbt_fork() argument
838 nex = xfs_dfork_nextents(dip, whichfork); in xrep_dinode_bad_bmbt_fork()
845 dfp = XFS_DFORK_PTR(dip, whichfork); in xrep_dinode_bad_bmbt_fork()
882 struct xfs_dinode *dip, in xrep_dinode_check_dfork() argument
894 data_size = be64_to_cpu(dip->di_size); in xrep_dinode_check_dfork()
898 fmt = XFS_DFORK_FORMAT(dip, XFS_DATA_FORK); in xrep_dinode_check_dfork()
926 dfork_size = XFS_DFORK_SIZE(dip, sc->mp, XFS_DATA_FORK); in xrep_dinode_check_dfork()
927 dfork_ptr = XFS_DFORK_PTR(dip, XFS_DATA_FORK); in xrep_dinode_check_dfork()
946 if (xrep_dinode_bad_extents_fork(sc, dip, dfork_size, in xrep_dinode_check_dfork()
951 if (xrep_dinode_bad_bmbt_fork(sc, dip, dfork_size, in xrep_dinode_check_dfork()
964 struct xfs_dinode *dip, in xrep_dinode_set_data_nextents() argument
967 if (xfs_dinode_has_large_extent_counts(dip)) in xrep_dinode_set_data_nextents()
968 dip->di_big_nextents = cpu_to_be64(nextents); in xrep_dinode_set_data_nextents()
970 dip->di_nextents = cpu_to_be32(nextents); in xrep_dinode_set_data_nextents()
975 struct xfs_dinode *dip, in xrep_dinode_set_attr_nextents() argument
978 if (xfs_dinode_has_large_extent_counts(dip)) in xrep_dinode_set_attr_nextents()
979 dip->di_big_anextents = cpu_to_be32(nextents); in xrep_dinode_set_attr_nextents()
981 dip->di_anextents = cpu_to_be16(nextents); in xrep_dinode_set_attr_nextents()
988 struct xfs_dinode *dip, in xrep_dinode_zap_dfork() argument
993 trace_xrep_dinode_zap_dfork(sc, dip); in xrep_dinode_zap_dfork()
997 xrep_dinode_set_data_nextents(dip, 0); in xrep_dinode_zap_dfork()
1007 dip->di_format = XFS_DINODE_FMT_DEV; in xrep_dinode_zap_dfork()
1008 dip->di_size = 0; in xrep_dinode_zap_dfork()
1017 dip->di_format = XFS_DINODE_FMT_EXTENTS; in xrep_dinode_zap_dfork()
1024 xrep_dinode_zap_symlink(ri, dip); in xrep_dinode_zap_dfork()
1027 xrep_dinode_zap_dir(ri, dip); in xrep_dinode_zap_dfork()
1039 struct xfs_dinode *dip) in xrep_dinode_check_afork() argument
1045 if (XFS_DFORK_BOFF(dip) == 0) in xrep_dinode_check_afork()
1046 return dip->di_aformat != XFS_DINODE_FMT_EXTENTS || in xrep_dinode_check_afork()
1047 xfs_dfork_attr_extents(dip) != 0; in xrep_dinode_check_afork()
1049 afork_size = XFS_DFORK_SIZE(dip, sc->mp, XFS_ATTR_FORK); in xrep_dinode_check_afork()
1050 afork_ptr = XFS_DFORK_PTR(dip, XFS_ATTR_FORK); in xrep_dinode_check_afork()
1052 switch (XFS_DFORK_FORMAT(dip, XFS_ATTR_FORK)) { in xrep_dinode_check_afork()
1066 if (xrep_dinode_bad_extents_fork(sc, dip, afork_size, in xrep_dinode_check_afork()
1071 if (xrep_dinode_bad_bmbt_fork(sc, dip, afork_size, in xrep_dinode_check_afork()
1089 struct xfs_dinode *dip, in xrep_dinode_zap_afork() argument
1094 trace_xrep_dinode_zap_afork(sc, dip); in xrep_dinode_zap_afork()
1098 dip->di_aformat = XFS_DINODE_FMT_EXTENTS; in xrep_dinode_zap_afork()
1099 xrep_dinode_set_attr_nextents(dip, 0); in xrep_dinode_zap_afork()
1107 if (dip->di_format != XFS_DINODE_FMT_BTREE) in xrep_dinode_zap_afork()
1108 dip->di_forkoff = 0; in xrep_dinode_zap_afork()
1109 dip->di_mode = cpu_to_be16(mode & ~0777); in xrep_dinode_zap_afork()
1110 dip->di_uid = 0; in xrep_dinode_zap_afork()
1111 dip->di_gid = 0; in xrep_dinode_zap_afork()
1118 struct xfs_dinode *dip, in xrep_dinode_ensure_forkoff() argument
1128 trace_xrep_dinode_ensure_forkoff(sc, dip); in xrep_dinode_ensure_forkoff()
1140 switch (dip->di_aformat) { in xrep_dinode_ensure_forkoff()
1147 afork_min = XFS_DFORK_SIZE(dip, sc->mp, XFS_ATTR_FORK); in xrep_dinode_ensure_forkoff()
1150 attr_extents = xfs_dfork_attr_extents(dip); in xrep_dinode_ensure_forkoff()
1175 bmdr = XFS_DFORK_PTR(dip, XFS_ATTR_FORK); in xrep_dinode_ensure_forkoff()
1185 switch (dip->di_format) { in xrep_dinode_ensure_forkoff()
1198 dfork_min = be64_to_cpu(dip->di_size); in xrep_dinode_ensure_forkoff()
1201 data_extents = xfs_dfork_data_extents(dip); in xrep_dinode_ensure_forkoff()
1225 bmdr = XFS_DFORK_PTR(dip, XFS_DATA_FORK); in xrep_dinode_ensure_forkoff()
1248 if (dip->di_format == XFS_DINODE_FMT_EXTENTS && in xrep_dinode_ensure_forkoff()
1249 xfs_dfork_data_extents(dip) == 0 && in xrep_dinode_ensure_forkoff()
1251 bmdr_minsz > XFS_DFORK_DSIZE(dip, sc->mp)) { in xrep_dinode_ensure_forkoff()
1257 xrep_dinode_zap_afork(ri, dip, mode); in xrep_dinode_ensure_forkoff()
1263 before = XFS_DFORK_APTR(dip); in xrep_dinode_ensure_forkoff()
1264 dip->di_forkoff = bmdr_minsz >> 3; in xrep_dinode_ensure_forkoff()
1265 after = XFS_DFORK_APTR(dip); in xrep_dinode_ensure_forkoff()
1266 memmove(after, before, XFS_DFORK_ASIZE(dip, sc->mp)); in xrep_dinode_ensure_forkoff()
1274 if (dip->di_aformat == XFS_DINODE_FMT_EXTENTS && in xrep_dinode_ensure_forkoff()
1275 xfs_dfork_attr_extents(dip) == 0 && in xrep_dinode_ensure_forkoff()
1277 bmdr_minsz > XFS_DFORK_ASIZE(dip, sc->mp)) { in xrep_dinode_ensure_forkoff()
1278 if (dip->di_format == XFS_DINODE_FMT_BTREE) { in xrep_dinode_ensure_forkoff()
1289 xrep_dinode_zap_afork(ri, dip, mode); in xrep_dinode_ensure_forkoff()
1296 dip->di_forkoff = (lit_sz - bmdr_minsz) >> 3; in xrep_dinode_ensure_forkoff()
1309 struct xfs_dinode *dip) in xrep_dinode_zap_forks() argument
1319 trace_xrep_dinode_zap_forks(sc, dip); in xrep_dinode_zap_forks()
1321 mode = be16_to_cpu(dip->di_mode); in xrep_dinode_zap_forks()
1323 data_extents = xfs_dfork_data_extents(dip); in xrep_dinode_zap_forks()
1324 attr_extents = xfs_dfork_attr_extents(dip); in xrep_dinode_zap_forks()
1325 nblocks = be64_to_cpu(dip->di_nblocks); in xrep_dinode_zap_forks()
1336 zap_datafork = xrep_dinode_check_dfork(sc, dip, mode); in xrep_dinode_zap_forks()
1338 zap_attrfork = xrep_dinode_check_afork(sc, dip); in xrep_dinode_zap_forks()
1342 xrep_dinode_zap_afork(ri, dip, mode); in xrep_dinode_zap_forks()
1344 xrep_dinode_zap_dfork(ri, dip, mode); in xrep_dinode_zap_forks()
1345 xrep_dinode_ensure_forkoff(ri, dip, mode); in xrep_dinode_zap_forks()
1351 data_extents = xfs_dfork_data_extents(dip); in xrep_dinode_zap_forks()
1352 attr_extents = xfs_dfork_attr_extents(dip); in xrep_dinode_zap_forks()
1354 dip->di_nblocks = 0; in xrep_dinode_zap_forks()
1364 struct xfs_dinode *dip; in xrep_dinode_core() local
1386 dip = xfs_buf_offset(bp, ri->imap.im_boffset); in xrep_dinode_core()
1387 xrep_dinode_header(sc, dip); in xrep_dinode_core()
1388 iget_error = xrep_dinode_mode(ri, dip); in xrep_dinode_core()
1391 xrep_dinode_nlinks(dip); in xrep_dinode_core()
1392 xrep_dinode_flags(sc, dip, ri->rt_extents > 0); in xrep_dinode_core()
1393 xrep_dinode_size(ri, dip); in xrep_dinode_core()
1394 xrep_dinode_extsize_hints(sc, dip); in xrep_dinode_core()
1395 xrep_dinode_zap_forks(ri, dip); in xrep_dinode_core()
1399 trace_xrep_dinode_fixed(sc, dip); in xrep_dinode_core()
1400 xfs_dinode_calc_crc(sc->mp, dip); in xrep_dinode_core()