70 p = (
char *)(hdr + 1);
73 btp = xfs_dir2_block_tail_p(mp, hdr);
74 lep = xfs_dir2_block_leaf_p(btp);
78 endp = (
char *)hdr + mp->m_dirblksize;
81 count = lastfree = freeseen = 0;
112 (
char *)dup - (
char *)hdr);
116 ASSERT((freeseen & (1 << i)) == 0);
136 (
char *)dep - (
char *)hdr);
140 addr = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
142 ((
char *)dep - (
char *)hdr));
145 hash = mp->m_dirnameops->hashname(&
name);
153 p += xfs_dir2_data_entsize(dep->
namelen);
184 #if defined(DEBUG) && defined(__KERNEL__)
190 #if defined(DEBUG) && defined(__KERNEL__)
198 for (dfp = &hdr->bestfree[0], seenzero = matched = 0;
215 if (dfp > &hdr->bestfree[0])
229 for (dfp = &hdr->bestfree[0];
261 new.offset =
cpu_to_be16((
char *)dup - (
char *)hdr);
352 p = (
char *)(hdr + 1);
354 btp = xfs_dir2_block_tail_p(mp, hdr);
355 endp = (
char *)xfs_dir2_block_leaf_p(btp);
357 endp = (
char *)hdr + mp->m_dirblksize;
367 ASSERT((
char *)dup - (
char *)hdr ==
377 ASSERT((
char *)dep - (
char *)hdr ==
379 p += xfs_dir2_data_entsize(dep->
namelen);
410 error =
xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(mp, blkno), -1, &bp,
434 t = mp->m_dirblksize - (
uint)
sizeof(*hdr);
437 *xfs_dir2_data_unused_tag_p(dup) =
cpu_to_be16((
char *)dup - (
char *)hdr);
452 struct xfs_trans *tp,
462 (
uint)((
char *)(xfs_dir2_data_entry_tag_p(dep) + 1) -
471 struct xfs_trans *tp,
487 struct xfs_trans *tp,
506 (
uint)((
char *)xfs_dir2_data_unused_tag_p(dup) - (
char *)hdr),
507 (
uint)((
char *)xfs_dir2_data_unused_tag_p(dup) - (
char *)hdr +
517 struct xfs_trans *tp,
540 endptr = (
char *)hdr + mp->m_dirblksize;
545 btp = xfs_dir2_block_tail_p(mp, hdr);
546 endptr = (
char *)xfs_dir2_block_leaf_p(btp);
552 if (
offset >
sizeof(*hdr)) {
565 if ((
char *)hdr +
offset +
len < endptr) {
578 if (prevdup && postdup) {
596 be16_add_cpu(&prevdup->length, len +
be16_to_cpu(postdup->length));
597 *xfs_dir2_data_unused_tag_p(prevdup) =
630 be16_add_cpu(&prevdup->length, len);
631 *xfs_dir2_data_unused_tag_p(prevdup) =
659 *xfs_dir2_data_unused_tag_p(newdup) =
686 *xfs_dir2_data_unused_tag_p(newdup) =
691 *needscanp = needscan;
699 struct xfs_trans *tp,
720 ASSERT(offset >= (
char *)dup - (
char *)hdr);
722 ASSERT((
char *)dup - (
char *)hdr ==
be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)));
732 matchfront = (
char *)dup - (
char *)hdr ==
offset;
733 matchback = (
char *)dup + oldlen - (
char *)hdr == offset + len;
740 if (matchfront && matchback) {
751 else if (matchfront) {
755 *xfs_dir2_data_unused_tag_p(newdup) =
772 needscan = dfp == &hdr->
bestfree[2];
779 else if (matchback) {
782 *xfs_dir2_data_unused_tag_p(newdup) =
799 needscan = dfp == &hdr->
bestfree[2];
809 *xfs_dir2_data_unused_tag_p(newdup) =
815 *xfs_dir2_data_unused_tag_p(newdup2) =
836 *needscanp = needscan;