Commit bbaaf53808c778bda24f8245a440c5ceacc1a37d

Authored by Christoph Hellwig
Committed by Tim Shimmin
1 parent 54aa8e26e9

[XFS] Reduce shouting by removing unnecessary macros from dir2 code.

SGI-PV: 966505
SGI-Modid: xfs-linux-melb:xfs-kern:28947a

Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>

Showing 11 changed files with 283 additions and 324 deletions Side-by-side Diff

... ... @@ -55,9 +55,9 @@
55 55 XFS_MAX_BLOCKSIZE);
56 56 mp->m_dirblksize = 1 << (mp->m_sb.sb_blocklog + mp->m_sb.sb_dirblklog);
57 57 mp->m_dirblkfsbs = 1 << mp->m_sb.sb_dirblklog;
58   - mp->m_dirdatablk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_DATA_FIRSTDB(mp));
59   - mp->m_dirleafblk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_LEAF_FIRSTDB(mp));
60   - mp->m_dirfreeblk = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_FREE_FIRSTDB(mp));
  58 + mp->m_dirdatablk = xfs_dir2_db_to_da(mp, XFS_DIR2_DATA_FIRSTDB(mp));
  59 + mp->m_dirleafblk = xfs_dir2_db_to_da(mp, XFS_DIR2_LEAF_FIRSTDB(mp));
  60 + mp->m_dirfreeblk = xfs_dir2_db_to_da(mp, XFS_DIR2_FREE_FIRSTDB(mp));
61 61 mp->m_attr_node_ents =
62 62 (mp->m_sb.sb_blocksize - (uint)sizeof(xfs_da_node_hdr_t)) /
63 63 (uint)sizeof(xfs_da_node_entry_t);
... ... @@ -554,7 +554,7 @@
554 554 */
555 555 if (mapp != &map)
556 556 kmem_free(mapp, sizeof(*mapp) * count);
557   - *dbp = XFS_DIR2_DA_TO_DB(mp, (xfs_dablk_t)bno);
  557 + *dbp = xfs_dir2_da_to_db(mp, (xfs_dablk_t)bno);
558 558 /*
559 559 * Update file's size if this is the data space and it grew.
560 560 */
... ... @@ -706,7 +706,7 @@
706 706 dp = args->dp;
707 707 mp = dp->i_mount;
708 708 tp = args->trans;
709   - da = XFS_DIR2_DB_TO_DA(mp, db);
  709 + da = xfs_dir2_db_to_da(mp, db);
710 710 /*
711 711 * Unmap the fsblock(s).
712 712 */
... ... @@ -742,7 +742,7 @@
742 742 /*
743 743 * If the block isn't the last one in the directory, we're done.
744 744 */
745   - if (dp->i_d.di_size > XFS_DIR2_DB_OFF_TO_BYTE(mp, db + 1, 0))
  745 + if (dp->i_d.di_size > xfs_dir2_db_off_to_byte(mp, db + 1, 0))
746 746 return 0;
747 747 bno = da;
748 748 if ((error = xfs_bmap_last_before(tp, dp, &bno, XFS_DATA_FORK))) {
fs/xfs/xfs_dir2_block.c
... ... @@ -115,13 +115,13 @@
115 115 xfs_da_brelse(tp, bp);
116 116 return XFS_ERROR(EFSCORRUPTED);
117 117 }
118   - len = XFS_DIR2_DATA_ENTSIZE(args->namelen);
  118 + len = xfs_dir2_data_entsize(args->namelen);
119 119 /*
120 120 * Set up pointers to parts of the block.
121 121 */
122 122 bf = block->hdr.bestfree;
123   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
124   - blp = XFS_DIR2_BLOCK_LEAF_P(btp);
  123 + btp = xfs_dir2_block_tail_p(mp, block);
  124 + blp = xfs_dir2_block_leaf_p(btp);
125 125 /*
126 126 * No stale entries? Need space for entry and new leaf.
127 127 */
... ... @@ -396,7 +396,7 @@
396 396 * Fill in the leaf entry.
397 397 */
398 398 blp[mid].hashval = cpu_to_be32(args->hashval);
399   - blp[mid].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
  399 + blp[mid].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp,
400 400 (char *)dep - (char *)block));
401 401 xfs_dir2_block_log_leaf(tp, bp, lfloglow, lfloghigh);
402 402 /*
... ... @@ -411,7 +411,7 @@
411 411 dep->inumber = cpu_to_be64(args->inumber);
412 412 dep->namelen = args->namelen;
413 413 memcpy(dep->name, args->name, args->namelen);
414   - tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
  414 + tagp = xfs_dir2_data_entry_tag_p(dep);
415 415 *tagp = cpu_to_be16((char *)dep - (char *)block);
416 416 /*
417 417 * Clean up the bestfree array and log the header, tail, and entry.
... ... @@ -455,7 +455,7 @@
455 455 /*
456 456 * If the block number in the offset is out of range, we're done.
457 457 */
458   - if (XFS_DIR2_DATAPTR_TO_DB(mp, uio->uio_offset) > mp->m_dirdatablk) {
  458 + if (xfs_dir2_dataptr_to_db(mp, uio->uio_offset) > mp->m_dirdatablk) {
459 459 *eofp = 1;
460 460 return 0;
461 461 }
462 462  
463 463  
... ... @@ -471,15 +471,15 @@
471 471 * Extract the byte offset we start at from the seek pointer.
472 472 * We'll skip entries before this.
473 473 */
474   - wantoff = XFS_DIR2_DATAPTR_TO_OFF(mp, uio->uio_offset);
  474 + wantoff = xfs_dir2_dataptr_to_off(mp, uio->uio_offset);
475 475 block = bp->data;
476 476 xfs_dir2_data_check(dp, bp);
477 477 /*
478 478 * Set up values for the loop.
479 479 */
480   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
  480 + btp = xfs_dir2_block_tail_p(mp, block);
481 481 ptr = (char *)block->u;
482   - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp);
  482 + endptr = (char *)xfs_dir2_block_leaf_p(btp);
483 483 p.dbp = dbp;
484 484 p.put = put;
485 485 p.uio = uio;
... ... @@ -502,7 +502,7 @@
502 502 /*
503 503 * Bump pointer for the next iteration.
504 504 */
505   - ptr += XFS_DIR2_DATA_ENTSIZE(dep->namelen);
  505 + ptr += xfs_dir2_data_entsize(dep->namelen);
506 506 /*
507 507 * The entry is before the desired starting point, skip it.
508 508 */
... ... @@ -513,7 +513,7 @@
513 513 */
514 514 p.namelen = dep->namelen;
515 515  
516   - p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
  516 + p.cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
517 517 ptr - (char *)block);
518 518 p.ino = be64_to_cpu(dep->inumber);
519 519 #if XFS_BIG_INUMS
... ... @@ -531,7 +531,7 @@
531 531 */
532 532 if (!p.done) {
533 533 uio->uio_offset =
534   - XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
  534 + xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
535 535 (char *)dep - (char *)block);
536 536 xfs_da_brelse(tp, bp);
537 537 return error;
... ... @@ -545,7 +545,7 @@
545 545 *eofp = 1;
546 546  
547 547 uio->uio_offset =
548   - XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk + 1, 0);
  548 + xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0);
549 549  
550 550 xfs_da_brelse(tp, bp);
551 551  
... ... @@ -569,8 +569,8 @@
569 569  
570 570 mp = tp->t_mountp;
571 571 block = bp->data;
572   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
573   - blp = XFS_DIR2_BLOCK_LEAF_P(btp);
  572 + btp = xfs_dir2_block_tail_p(mp, block);
  573 + blp = xfs_dir2_block_leaf_p(btp);
574 574 xfs_da_log_buf(tp, bp, (uint)((char *)&blp[first] - (char *)block),
575 575 (uint)((char *)&blp[last + 1] - (char *)block - 1));
576 576 }
... ... @@ -589,7 +589,7 @@
589 589  
590 590 mp = tp->t_mountp;
591 591 block = bp->data;
592   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
  592 + btp = xfs_dir2_block_tail_p(mp, block);
593 593 xfs_da_log_buf(tp, bp, (uint)((char *)btp - (char *)block),
594 594 (uint)((char *)(btp + 1) - (char *)block - 1));
595 595 }
596 596  
... ... @@ -623,13 +623,13 @@
623 623 mp = dp->i_mount;
624 624 block = bp->data;
625 625 xfs_dir2_data_check(dp, bp);
626   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
627   - blp = XFS_DIR2_BLOCK_LEAF_P(btp);
  626 + btp = xfs_dir2_block_tail_p(mp, block);
  627 + blp = xfs_dir2_block_leaf_p(btp);
628 628 /*
629 629 * Get the offset from the leaf entry, to point to the data.
630 630 */
631 631 dep = (xfs_dir2_data_entry_t *)
632   - ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address)));
  632 + ((char *)block + xfs_dir2_dataptr_to_off(mp, be32_to_cpu(blp[ent].address)));
633 633 /*
634 634 * Fill in inode number, release the block.
635 635 */
... ... @@ -675,8 +675,8 @@
675 675 ASSERT(bp != NULL);
676 676 block = bp->data;
677 677 xfs_dir2_data_check(dp, bp);
678   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
679   - blp = XFS_DIR2_BLOCK_LEAF_P(btp);
  678 + btp = xfs_dir2_block_tail_p(mp, block);
  679 + blp = xfs_dir2_block_leaf_p(btp);
680 680 /*
681 681 * Loop doing a binary search for our hash value.
682 682 * Find our entry, ENOENT if it's not there.
... ... @@ -713,7 +713,7 @@
713 713 * Get pointer to the entry from the leaf.
714 714 */
715 715 dep = (xfs_dir2_data_entry_t *)
716   - ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, addr));
  716 + ((char *)block + xfs_dir2_dataptr_to_off(mp, addr));
717 717 /*
718 718 * Compare, if it's right give back buffer & entry number.
719 719 */
720 720  
721 721  
... ... @@ -768,20 +768,20 @@
768 768 tp = args->trans;
769 769 mp = dp->i_mount;
770 770 block = bp->data;
771   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
772   - blp = XFS_DIR2_BLOCK_LEAF_P(btp);
  771 + btp = xfs_dir2_block_tail_p(mp, block);
  772 + blp = xfs_dir2_block_leaf_p(btp);
773 773 /*
774 774 * Point to the data entry using the leaf entry.
775 775 */
776 776 dep = (xfs_dir2_data_entry_t *)
777   - ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address)));
  777 + ((char *)block + xfs_dir2_dataptr_to_off(mp, be32_to_cpu(blp[ent].address)));
778 778 /*
779 779 * Mark the data entry's space free.
780 780 */
781 781 needlog = needscan = 0;
782 782 xfs_dir2_data_make_free(tp, bp,
783 783 (xfs_dir2_data_aoff_t)((char *)dep - (char *)block),
784   - XFS_DIR2_DATA_ENTSIZE(dep->namelen), &needlog, &needscan);
  784 + xfs_dir2_data_entsize(dep->namelen), &needlog, &needscan);
785 785 /*
786 786 * Fix up the block tail.
787 787 */
788 788  
... ... @@ -843,13 +843,13 @@
843 843 dp = args->dp;
844 844 mp = dp->i_mount;
845 845 block = bp->data;
846   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
847   - blp = XFS_DIR2_BLOCK_LEAF_P(btp);
  846 + btp = xfs_dir2_block_tail_p(mp, block);
  847 + blp = xfs_dir2_block_leaf_p(btp);
848 848 /*
849 849 * Point to the data entry we need to change.
850 850 */
851 851 dep = (xfs_dir2_data_entry_t *)
852   - ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(blp[ent].address)));
  852 + ((char *)block + xfs_dir2_dataptr_to_off(mp, be32_to_cpu(blp[ent].address)));
853 853 ASSERT(be64_to_cpu(dep->inumber) != args->inumber);
854 854 /*
855 855 * Change the inode number to the new value.
... ... @@ -912,7 +912,7 @@
912 912 mp = dp->i_mount;
913 913 leaf = lbp->data;
914 914 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC);
915   - ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
  915 + ltp = xfs_dir2_leaf_tail_p(mp, leaf);
916 916 /*
917 917 * If there are data blocks other than the first one, take this
918 918 * opportunity to remove trailing empty data blocks that may have
... ... @@ -920,7 +920,7 @@
920 920 * These will show up in the leaf bests table.
921 921 */
922 922 while (dp->i_d.di_size > mp->m_dirblksize) {
923   - bestsp = XFS_DIR2_LEAF_BESTS_P(ltp);
  923 + bestsp = xfs_dir2_leaf_bests_p(ltp);
924 924 if (be16_to_cpu(bestsp[be32_to_cpu(ltp->bestcount) - 1]) ==
925 925 mp->m_dirblksize - (uint)sizeof(block->hdr)) {
926 926 if ((error =
927 927  
... ... @@ -974,14 +974,14 @@
974 974 /*
975 975 * Initialize the block tail.
976 976 */
977   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
  977 + btp = xfs_dir2_block_tail_p(mp, block);
978 978 btp->count = cpu_to_be32(be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale));
979 979 btp->stale = 0;
980 980 xfs_dir2_block_log_tail(tp, dbp);
981 981 /*
982 982 * Initialize the block leaf area. We compact out stale entries.
983 983 */
984   - lep = XFS_DIR2_BLOCK_LEAF_P(btp);
  984 + lep = xfs_dir2_block_leaf_p(btp);
985 985 for (from = to = 0; from < be16_to_cpu(leaf->hdr.count); from++) {
986 986 if (be32_to_cpu(leaf->ents[from].address) == XFS_DIR2_NULL_DATAPTR)
987 987 continue;
... ... @@ -1067,7 +1067,7 @@
1067 1067 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size);
1068 1068 ASSERT(dp->i_df.if_u1.if_data != NULL);
1069 1069 sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
1070   - ASSERT(dp->i_d.di_size >= XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count));
  1070 + ASSERT(dp->i_d.di_size >= xfs_dir2_sf_hdr_size(sfp->hdr.i8count));
1071 1071 /*
1072 1072 * Copy the directory into the stack buffer.
1073 1073 * Then pitch the incore inode data so we can make extents.
1074 1074  
... ... @@ -1119,10 +1119,10 @@
1119 1119 /*
1120 1120 * Fill in the tail.
1121 1121 */
1122   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
  1122 + btp = xfs_dir2_block_tail_p(mp, block);
1123 1123 btp->count = cpu_to_be32(sfp->hdr.count + 2); /* ., .. */
1124 1124 btp->stale = 0;
1125   - blp = XFS_DIR2_BLOCK_LEAF_P(btp);
  1125 + blp = xfs_dir2_block_leaf_p(btp);
1126 1126 endoffset = (uint)((char *)blp - (char *)block);
1127 1127 /*
1128 1128 * Remove the freespace, we'll manage it.
1129 1129  
1130 1130  
1131 1131  
1132 1132  
... ... @@ -1138,25 +1138,25 @@
1138 1138 dep->inumber = cpu_to_be64(dp->i_ino);
1139 1139 dep->namelen = 1;
1140 1140 dep->name[0] = '.';
1141   - tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
  1141 + tagp = xfs_dir2_data_entry_tag_p(dep);
1142 1142 *tagp = cpu_to_be16((char *)dep - (char *)block);
1143 1143 xfs_dir2_data_log_entry(tp, bp, dep);
1144 1144 blp[0].hashval = cpu_to_be32(xfs_dir_hash_dot);
1145   - blp[0].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
  1145 + blp[0].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp,
1146 1146 (char *)dep - (char *)block));
1147 1147 /*
1148 1148 * Create entry for ..
1149 1149 */
1150 1150 dep = (xfs_dir2_data_entry_t *)
1151 1151 ((char *)block + XFS_DIR2_DATA_DOTDOT_OFFSET);
1152   - dep->inumber = cpu_to_be64(XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent));
  1152 + dep->inumber = cpu_to_be64(xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent));
1153 1153 dep->namelen = 2;
1154 1154 dep->name[0] = dep->name[1] = '.';
1155   - tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
  1155 + tagp = xfs_dir2_data_entry_tag_p(dep);
1156 1156 *tagp = cpu_to_be16((char *)dep - (char *)block);
1157 1157 xfs_dir2_data_log_entry(tp, bp, dep);
1158 1158 blp[1].hashval = cpu_to_be32(xfs_dir_hash_dotdot);
1159   - blp[1].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
  1159 + blp[1].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp,
1160 1160 (char *)dep - (char *)block));
1161 1161 offset = XFS_DIR2_DATA_FIRST_OFFSET;
1162 1162 /*
... ... @@ -1165,7 +1165,7 @@
1165 1165 if ((i = 0) == sfp->hdr.count)
1166 1166 sfep = NULL;
1167 1167 else
1168   - sfep = XFS_DIR2_SF_FIRSTENTRY(sfp);
  1168 + sfep = xfs_dir2_sf_firstentry(sfp);
1169 1169 /*
1170 1170 * Need to preserve the existing offset values in the sf directory.
1171 1171 * Insert holes (unused entries) where necessary.
... ... @@ -1177,7 +1177,7 @@
1177 1177 if (sfep == NULL)
1178 1178 newoffset = endoffset;
1179 1179 else
1180   - newoffset = XFS_DIR2_SF_GET_OFFSET(sfep);
  1180 + newoffset = xfs_dir2_sf_get_offset(sfep);
1181 1181 /*
1182 1182 * There should be a hole here, make one.
1183 1183 */
... ... @@ -1186,7 +1186,7 @@
1186 1186 ((char *)block + offset);
1187 1187 dup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
1188 1188 dup->length = cpu_to_be16(newoffset - offset);
1189   - *XFS_DIR2_DATA_UNUSED_TAG_P(dup) = cpu_to_be16(
  1189 + *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16(
1190 1190 ((char *)dup - (char *)block));
1191 1191 xfs_dir2_data_log_unused(tp, bp, dup);
1192 1192 (void)xfs_dir2_data_freeinsert((xfs_dir2_data_t *)block,
1193 1193  
1194 1194  
1195 1195  
... ... @@ -1198,22 +1198,22 @@
1198 1198 * Copy a real entry.
1199 1199 */
1200 1200 dep = (xfs_dir2_data_entry_t *)((char *)block + newoffset);
1201   - dep->inumber = cpu_to_be64(XFS_DIR2_SF_GET_INUMBER(sfp,
1202   - XFS_DIR2_SF_INUMBERP(sfep)));
  1201 + dep->inumber = cpu_to_be64(xfs_dir2_sf_get_inumber(sfp,
  1202 + xfs_dir2_sf_inumberp(sfep)));
1203 1203 dep->namelen = sfep->namelen;
1204 1204 memcpy(dep->name, sfep->name, dep->namelen);
1205   - tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
  1205 + tagp = xfs_dir2_data_entry_tag_p(dep);
1206 1206 *tagp = cpu_to_be16((char *)dep - (char *)block);
1207 1207 xfs_dir2_data_log_entry(tp, bp, dep);
1208 1208 blp[2 + i].hashval = cpu_to_be32(xfs_da_hashname(
1209 1209 (char *)sfep->name, sfep->namelen));
1210   - blp[2 + i].address = cpu_to_be32(XFS_DIR2_BYTE_TO_DATAPTR(mp,
  1210 + blp[2 + i].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp,
1211 1211 (char *)dep - (char *)block));
1212 1212 offset = (int)((char *)(tagp + 1) - (char *)block);
1213 1213 if (++i == sfp->hdr.count)
1214 1214 sfep = NULL;
1215 1215 else
1216   - sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep);
  1216 + sfep = xfs_dir2_sf_nextentry(sfp, sfep);
1217 1217 }
1218 1218 /* Done with the temporary buffer */
1219 1219 kmem_free(buf, buf_len);
fs/xfs/xfs_dir2_block.h
... ... @@ -60,7 +60,6 @@
60 60 /*
61 61 * Pointer to the leaf header embedded in a data block (1-block format)
62 62 */
63   -#define XFS_DIR2_BLOCK_TAIL_P(mp,block) xfs_dir2_block_tail_p(mp,block)
64 63 static inline xfs_dir2_block_tail_t *
65 64 xfs_dir2_block_tail_p(struct xfs_mount *mp, xfs_dir2_block_t *block)
66 65 {
... ... @@ -71,7 +70,6 @@
71 70 /*
72 71 * Pointer to the leaf entries embedded in a data block (1-block format)
73 72 */
74   -#define XFS_DIR2_BLOCK_LEAF_P(btp) xfs_dir2_block_leaf_p(btp)
75 73 static inline struct xfs_dir2_leaf_entry *
76 74 xfs_dir2_block_leaf_p(xfs_dir2_block_tail_t *btp)
77 75 {
fs/xfs/xfs_dir2_data.c
... ... @@ -72,8 +72,8 @@
72 72 bf = d->hdr.bestfree;
73 73 p = (char *)d->u;
74 74 if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) {
75   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d);
76   - lep = XFS_DIR2_BLOCK_LEAF_P(btp);
  75 + btp = xfs_dir2_block_tail_p(mp, (xfs_dir2_block_t *)d);
  76 + lep = xfs_dir2_block_leaf_p(btp);
77 77 endp = (char *)lep;
78 78 } else
79 79 endp = (char *)d + mp->m_dirblksize;
... ... @@ -107,7 +107,7 @@
107 107 */
108 108 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
109 109 ASSERT(lastfree == 0);
110   - ASSERT(be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup)) ==
  110 + ASSERT(be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)) ==
111 111 (char *)dup - (char *)d);
112 112 dfp = xfs_dir2_data_freefind(d, dup);
113 113 if (dfp) {
114 114  
... ... @@ -131,12 +131,12 @@
131 131 dep = (xfs_dir2_data_entry_t *)p;
132 132 ASSERT(dep->namelen != 0);
133 133 ASSERT(xfs_dir_ino_validate(mp, be64_to_cpu(dep->inumber)) == 0);
134   - ASSERT(be16_to_cpu(*XFS_DIR2_DATA_ENTRY_TAG_P(dep)) ==
  134 + ASSERT(be16_to_cpu(*xfs_dir2_data_entry_tag_p(dep)) ==
135 135 (char *)dep - (char *)d);
136 136 count++;
137 137 lastfree = 0;
138 138 if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) {
139   - addr = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
  139 + addr = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
140 140 (xfs_dir2_data_aoff_t)
141 141 ((char *)dep - (char *)d));
142 142 hash = xfs_da_hashname((char *)dep->name, dep->namelen);
... ... @@ -147,7 +147,7 @@
147 147 }
148 148 ASSERT(i < be32_to_cpu(btp->count));
149 149 }
150   - p += XFS_DIR2_DATA_ENTSIZE(dep->namelen);
  150 + p += xfs_dir2_data_entsize(dep->namelen);
151 151 }
152 152 /*
153 153 * Need to have seen all the entries and all the bestfree slots.
... ... @@ -346,8 +346,8 @@
346 346 */
347 347 p = (char *)d->u;
348 348 if (be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC) {
349   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d);
350   - endp = (char *)XFS_DIR2_BLOCK_LEAF_P(btp);
  349 + btp = xfs_dir2_block_tail_p(mp, (xfs_dir2_block_t *)d);
  350 + endp = (char *)xfs_dir2_block_leaf_p(btp);
351 351 } else
352 352 endp = (char *)d + mp->m_dirblksize;
353 353 /*
... ... @@ -360,7 +360,7 @@
360 360 */
361 361 if (be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG) {
362 362 ASSERT((char *)dup - (char *)d ==
363   - be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup)));
  363 + be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)));
364 364 xfs_dir2_data_freeinsert(d, dup, loghead);
365 365 p += be16_to_cpu(dup->length);
366 366 }
... ... @@ -370,8 +370,8 @@
370 370 else {
371 371 dep = (xfs_dir2_data_entry_t *)p;
372 372 ASSERT((char *)dep - (char *)d ==
373   - be16_to_cpu(*XFS_DIR2_DATA_ENTRY_TAG_P(dep)));
374   - p += XFS_DIR2_DATA_ENTSIZE(dep->namelen);
  373 + be16_to_cpu(*xfs_dir2_data_entry_tag_p(dep)));
  374 + p += xfs_dir2_data_entsize(dep->namelen);
375 375 }
376 376 }
377 377 }
... ... @@ -402,7 +402,7 @@
402 402 /*
403 403 * Get the buffer set up for the block.
404 404 */
405   - error = xfs_da_get_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, blkno), -1, &bp,
  405 + error = xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(mp, blkno), -1, &bp,
406 406 XFS_DATA_FORK);
407 407 if (error) {
408 408 return error;
... ... @@ -427,7 +427,7 @@
427 427 t=mp->m_dirblksize - (uint)sizeof(d->hdr);
428 428 d->hdr.bestfree[0].length = cpu_to_be16(t);
429 429 dup->length = cpu_to_be16(t);
430   - *XFS_DIR2_DATA_UNUSED_TAG_P(dup) = cpu_to_be16((char *)dup - (char *)d);
  430 + *xfs_dir2_data_unused_tag_p(dup) = cpu_to_be16((char *)dup - (char *)d);
431 431 /*
432 432 * Log it and return it.
433 433 */
... ... @@ -452,7 +452,7 @@
452 452 ASSERT(be32_to_cpu(d->hdr.magic) == XFS_DIR2_DATA_MAGIC ||
453 453 be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC);
454 454 xfs_da_log_buf(tp, bp, (uint)((char *)dep - (char *)d),
455   - (uint)((char *)(XFS_DIR2_DATA_ENTRY_TAG_P(dep) + 1) -
  455 + (uint)((char *)(xfs_dir2_data_entry_tag_p(dep) + 1) -
456 456 (char *)d - 1));
457 457 }
458 458  
... ... @@ -497,8 +497,8 @@
497 497 * Log the end (tag) of the unused entry.
498 498 */
499 499 xfs_da_log_buf(tp, bp,
500   - (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P(dup) - (char *)d),
501   - (uint)((char *)XFS_DIR2_DATA_UNUSED_TAG_P(dup) - (char *)d +
  500 + (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)d),
  501 + (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)d +
502 502 sizeof(xfs_dir2_data_off_t) - 1));
503 503 }
504 504  
... ... @@ -535,8 +535,8 @@
535 535 xfs_dir2_block_tail_t *btp; /* block tail */
536 536  
537 537 ASSERT(be32_to_cpu(d->hdr.magic) == XFS_DIR2_BLOCK_MAGIC);
538   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, (xfs_dir2_block_t *)d);
539   - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp);
  538 + btp = xfs_dir2_block_tail_p(mp, (xfs_dir2_block_t *)d);
  539 + endptr = (char *)xfs_dir2_block_leaf_p(btp);
540 540 }
541 541 /*
542 542 * If this isn't the start of the block, then back up to
... ... @@ -587,7 +587,7 @@
587 587 * Fix up the new big freespace.
588 588 */
589 589 be16_add(&prevdup->length, len + be16_to_cpu(postdup->length));
590   - *XFS_DIR2_DATA_UNUSED_TAG_P(prevdup) =
  590 + *xfs_dir2_data_unused_tag_p(prevdup) =
591 591 cpu_to_be16((char *)prevdup - (char *)d);
592 592 xfs_dir2_data_log_unused(tp, bp, prevdup);
593 593 if (!needscan) {
... ... @@ -621,7 +621,7 @@
621 621 else if (prevdup) {
622 622 dfp = xfs_dir2_data_freefind(d, prevdup);
623 623 be16_add(&prevdup->length, len);
624   - *XFS_DIR2_DATA_UNUSED_TAG_P(prevdup) =
  624 + *xfs_dir2_data_unused_tag_p(prevdup) =
625 625 cpu_to_be16((char *)prevdup - (char *)d);
626 626 xfs_dir2_data_log_unused(tp, bp, prevdup);
627 627 /*
... ... @@ -649,7 +649,7 @@
649 649 newdup = (xfs_dir2_data_unused_t *)((char *)d + offset);
650 650 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
651 651 newdup->length = cpu_to_be16(len + be16_to_cpu(postdup->length));
652   - *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
  652 + *xfs_dir2_data_unused_tag_p(newdup) =
653 653 cpu_to_be16((char *)newdup - (char *)d);
654 654 xfs_dir2_data_log_unused(tp, bp, newdup);
655 655 /*
... ... @@ -676,7 +676,7 @@
676 676 newdup = (xfs_dir2_data_unused_t *)((char *)d + offset);
677 677 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
678 678 newdup->length = cpu_to_be16(len);
679   - *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
  679 + *xfs_dir2_data_unused_tag_p(newdup) =
680 680 cpu_to_be16((char *)newdup - (char *)d);
681 681 xfs_dir2_data_log_unused(tp, bp, newdup);
682 682 (void)xfs_dir2_data_freeinsert(d, newdup, needlogp);
... ... @@ -712,7 +712,7 @@
712 712 ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG);
713 713 ASSERT(offset >= (char *)dup - (char *)d);
714 714 ASSERT(offset + len <= (char *)dup + be16_to_cpu(dup->length) - (char *)d);
715   - ASSERT((char *)dup - (char *)d == be16_to_cpu(*XFS_DIR2_DATA_UNUSED_TAG_P(dup)));
  715 + ASSERT((char *)dup - (char *)d == be16_to_cpu(*xfs_dir2_data_unused_tag_p(dup)));
716 716 /*
717 717 * Look up the entry in the bestfree table.
718 718 */
... ... @@ -745,7 +745,7 @@
745 745 newdup = (xfs_dir2_data_unused_t *)((char *)d + offset + len);
746 746 newdup->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
747 747 newdup->length = cpu_to_be16(oldlen - len);
748   - *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
  748 + *xfs_dir2_data_unused_tag_p(newdup) =
749 749 cpu_to_be16((char *)newdup - (char *)d);
750 750 xfs_dir2_data_log_unused(tp, bp, newdup);
751 751 /*
... ... @@ -772,7 +772,7 @@
772 772 else if (matchback) {
773 773 newdup = dup;
774 774 newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup);
775   - *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
  775 + *xfs_dir2_data_unused_tag_p(newdup) =
776 776 cpu_to_be16((char *)newdup - (char *)d);
777 777 xfs_dir2_data_log_unused(tp, bp, newdup);
778 778 /*
779 779  
... ... @@ -799,13 +799,13 @@
799 799 else {
800 800 newdup = dup;
801 801 newdup->length = cpu_to_be16(((char *)d + offset) - (char *)newdup);
802   - *XFS_DIR2_DATA_UNUSED_TAG_P(newdup) =
  802 + *xfs_dir2_data_unused_tag_p(newdup) =
803 803 cpu_to_be16((char *)newdup - (char *)d);
804 804 xfs_dir2_data_log_unused(tp, bp, newdup);
805 805 newdup2 = (xfs_dir2_data_unused_t *)((char *)d + offset + len);
806 806 newdup2->freetag = cpu_to_be16(XFS_DIR2_DATA_FREE_TAG);
807 807 newdup2->length = cpu_to_be16(oldlen - len - be16_to_cpu(newdup->length));
808   - *XFS_DIR2_DATA_UNUSED_TAG_P(newdup2) =
  808 + *xfs_dir2_data_unused_tag_p(newdup2) =
809 809 cpu_to_be16((char *)newdup2 - (char *)d);
810 810 xfs_dir2_data_log_unused(tp, bp, newdup2);
811 811 /*
fs/xfs/xfs_dir2_data.h
... ... @@ -44,7 +44,7 @@
44 44 #define XFS_DIR2_DATA_SPACE 0
45 45 #define XFS_DIR2_DATA_OFFSET (XFS_DIR2_DATA_SPACE * XFS_DIR2_SPACE_SIZE)
46 46 #define XFS_DIR2_DATA_FIRSTDB(mp) \
47   - XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATA_OFFSET)
  47 + xfs_dir2_byte_to_db(mp, XFS_DIR2_DATA_OFFSET)
48 48  
49 49 /*
50 50 * Offsets of . and .. in data space (always block 0)
51 51  
... ... @@ -52,9 +52,9 @@
52 52 #define XFS_DIR2_DATA_DOT_OFFSET \
53 53 ((xfs_dir2_data_aoff_t)sizeof(xfs_dir2_data_hdr_t))
54 54 #define XFS_DIR2_DATA_DOTDOT_OFFSET \
55   - (XFS_DIR2_DATA_DOT_OFFSET + XFS_DIR2_DATA_ENTSIZE(1))
  55 + (XFS_DIR2_DATA_DOT_OFFSET + xfs_dir2_data_entsize(1))
56 56 #define XFS_DIR2_DATA_FIRST_OFFSET \
57   - (XFS_DIR2_DATA_DOTDOT_OFFSET + XFS_DIR2_DATA_ENTSIZE(2))
  57 + (XFS_DIR2_DATA_DOTDOT_OFFSET + xfs_dir2_data_entsize(2))
58 58  
59 59 /*
60 60 * Structures.
... ... @@ -123,7 +123,6 @@
123 123 /*
124 124 * Size of a data entry.
125 125 */
126   -#define XFS_DIR2_DATA_ENTSIZE(n) xfs_dir2_data_entsize(n)
127 126 static inline int xfs_dir2_data_entsize(int n)
128 127 {
129 128 return (int)roundup(offsetof(xfs_dir2_data_entry_t, name[0]) + (n) + \
130 129  
131 130  
... ... @@ -133,19 +132,16 @@
133 132 /*
134 133 * Pointer to an entry's tag word.
135 134 */
136   -#define XFS_DIR2_DATA_ENTRY_TAG_P(dep) xfs_dir2_data_entry_tag_p(dep)
137 135 static inline __be16 *
138 136 xfs_dir2_data_entry_tag_p(xfs_dir2_data_entry_t *dep)
139 137 {
140 138 return (__be16 *)((char *)dep +
141   - XFS_DIR2_DATA_ENTSIZE(dep->namelen) - sizeof(__be16));
  139 + xfs_dir2_data_entsize(dep->namelen) - sizeof(__be16));
142 140 }
143 141  
144 142 /*
145 143 * Pointer to a freespace's tag word.
146 144 */
147   -#define XFS_DIR2_DATA_UNUSED_TAG_P(dup) \
148   - xfs_dir2_data_unused_tag_p(dup)
149 145 static inline __be16 *
150 146 xfs_dir2_data_unused_tag_p(xfs_dir2_data_unused_t *dup)
151 147 {
fs/xfs/xfs_dir2_leaf.c
... ... @@ -92,7 +92,7 @@
92 92 if ((error = xfs_da_grow_inode(args, &blkno))) {
93 93 return error;
94 94 }
95   - ldb = XFS_DIR2_DA_TO_DB(mp, blkno);
  95 + ldb = xfs_dir2_da_to_db(mp, blkno);
96 96 ASSERT(ldb == XFS_DIR2_LEAF_FIRSTDB(mp));
97 97 /*
98 98 * Initialize the leaf block, get a buffer for it.
... ... @@ -104,8 +104,8 @@
104 104 leaf = lbp->data;
105 105 block = dbp->data;
106 106 xfs_dir2_data_check(dp, dbp);
107   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
108   - blp = XFS_DIR2_BLOCK_LEAF_P(btp);
  107 + btp = xfs_dir2_block_tail_p(mp, block);
  108 + blp = xfs_dir2_block_leaf_p(btp);
109 109 /*
110 110 * Set the counts in the leaf header.
111 111 */
112 112  
... ... @@ -137,9 +137,9 @@
137 137 /*
138 138 * Set up leaf tail and bests table.
139 139 */
140   - ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
  140 + ltp = xfs_dir2_leaf_tail_p(mp, leaf);
141 141 ltp->bestcount = cpu_to_be32(1);
142   - bestsp = XFS_DIR2_LEAF_BESTS_P(ltp);
  142 + bestsp = xfs_dir2_leaf_bests_p(ltp);
143 143 bestsp[0] = block->hdr.bestfree[0].length;
144 144 /*
145 145 * Log the data header and leaf bests table.
... ... @@ -209,9 +209,9 @@
209 209 */
210 210 index = xfs_dir2_leaf_search_hash(args, lbp);
211 211 leaf = lbp->data;
212   - ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
213   - bestsp = XFS_DIR2_LEAF_BESTS_P(ltp);
214   - length = XFS_DIR2_DATA_ENTSIZE(args->namelen);
  212 + ltp = xfs_dir2_leaf_tail_p(mp, leaf);
  213 + bestsp = xfs_dir2_leaf_bests_p(ltp);
  214 + length = xfs_dir2_data_entsize(args->namelen);
215 215 /*
216 216 * See if there are any entries with the same hash value
217 217 * and space in their block for the new entry.
... ... @@ -223,7 +223,7 @@
223 223 index++, lep++) {
224 224 if (be32_to_cpu(lep->address) == XFS_DIR2_NULL_DATAPTR)
225 225 continue;
226   - i = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address));
  226 + i = xfs_dir2_dataptr_to_db(mp, be32_to_cpu(lep->address));
227 227 ASSERT(i < be32_to_cpu(ltp->bestcount));
228 228 ASSERT(be16_to_cpu(bestsp[i]) != NULLDATAOFF);
229 229 if (be16_to_cpu(bestsp[i]) >= length) {
... ... @@ -378,7 +378,7 @@
378 378 */
379 379 else {
380 380 if ((error =
381   - xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, use_block),
  381 + xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, use_block),
382 382 -1, &dbp, XFS_DATA_FORK))) {
383 383 xfs_da_brelse(tp, lbp);
384 384 return error;
... ... @@ -407,7 +407,7 @@
407 407 dep->inumber = cpu_to_be64(args->inumber);
408 408 dep->namelen = args->namelen;
409 409 memcpy(dep->name, args->name, dep->namelen);
410   - tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
  410 + tagp = xfs_dir2_data_entry_tag_p(dep);
411 411 *tagp = cpu_to_be16((char *)dep - (char *)data);
412 412 /*
413 413 * Need to scan fix up the bestfree table.
... ... @@ -529,7 +529,7 @@
529 529 * Fill in the new leaf entry.
530 530 */
531 531 lep->hashval = cpu_to_be32(args->hashval);
532   - lep->address = cpu_to_be32(XFS_DIR2_DB_OFF_TO_DATAPTR(mp, use_block,
  532 + lep->address = cpu_to_be32(xfs_dir2_db_off_to_dataptr(mp, use_block,
533 533 be16_to_cpu(*tagp)));
534 534 /*
535 535 * Log the leaf fields and give up the buffers.
536 536  
... ... @@ -567,13 +567,13 @@
567 567 * Should factor in the size of the bests table as well.
568 568 * We can deduce a value for that from di_size.
569 569 */
570   - ASSERT(be16_to_cpu(leaf->hdr.count) <= XFS_DIR2_MAX_LEAF_ENTS(mp));
571   - ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
  570 + ASSERT(be16_to_cpu(leaf->hdr.count) <= xfs_dir2_max_leaf_ents(mp));
  571 + ltp = xfs_dir2_leaf_tail_p(mp, leaf);
572 572 /*
573 573 * Leaves and bests don't overlap.
574 574 */
575 575 ASSERT((char *)&leaf->ents[be16_to_cpu(leaf->hdr.count)] <=
576   - (char *)XFS_DIR2_LEAF_BESTS_P(ltp));
  576 + (char *)xfs_dir2_leaf_bests_p(ltp));
577 577 /*
578 578 * Check hash value order, count stale entries.
579 579 */
580 580  
... ... @@ -815,12 +815,12 @@
815 815 * Inside the loop we keep the main offset value as a byte offset
816 816 * in the directory file.
817 817 */
818   - curoff = XFS_DIR2_DATAPTR_TO_BYTE(mp, uio->uio_offset);
  818 + curoff = xfs_dir2_dataptr_to_byte(mp, uio->uio_offset);
819 819 /*
820 820 * Force this conversion through db so we truncate the offset
821 821 * down to get the start of the data block.
822 822 */
823   - map_off = XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, curoff));
  823 + map_off = xfs_dir2_db_to_da(mp, xfs_dir2_byte_to_db(mp, curoff));
824 824 /*
825 825 * Loop over directory entries until we reach the end offset.
826 826 * Get more blocks and readahead as necessary.
... ... @@ -870,7 +870,7 @@
870 870 */
871 871 if (1 + ra_want > map_blocks &&
872 872 map_off <
873   - XFS_DIR2_BYTE_TO_DA(mp, XFS_DIR2_LEAF_OFFSET)) {
  873 + xfs_dir2_byte_to_da(mp, XFS_DIR2_LEAF_OFFSET)) {
874 874 /*
875 875 * Get more bmaps, fill in after the ones
876 876 * we already have in the table.
... ... @@ -878,7 +878,7 @@
878 878 nmap = map_size - map_valid;
879 879 error = xfs_bmapi(tp, dp,
880 880 map_off,
881   - XFS_DIR2_BYTE_TO_DA(mp,
  881 + xfs_dir2_byte_to_da(mp,
882 882 XFS_DIR2_LEAF_OFFSET) - map_off,
883 883 XFS_BMAPI_METADATA, NULL, 0,
884 884 &map[map_valid], &nmap, NULL, NULL);
... ... @@ -903,7 +903,7 @@
903 903 map[map_valid + nmap - 1].br_blockcount;
904 904 else
905 905 map_off =
906   - XFS_DIR2_BYTE_TO_DA(mp,
  906 + xfs_dir2_byte_to_da(mp,
907 907 XFS_DIR2_LEAF_OFFSET);
908 908 /*
909 909 * Look for holes in the mapping, and
910 910  
... ... @@ -931,14 +931,14 @@
931 931 * No valid mappings, so no more data blocks.
932 932 */
933 933 if (!map_valid) {
934   - curoff = XFS_DIR2_DA_TO_BYTE(mp, map_off);
  934 + curoff = xfs_dir2_da_to_byte(mp, map_off);
935 935 break;
936 936 }
937 937 /*
938 938 * Read the directory block starting at the first
939 939 * mapping.
940 940 */
941   - curdb = XFS_DIR2_DA_TO_DB(mp, map->br_startoff);
  941 + curdb = xfs_dir2_da_to_db(mp, map->br_startoff);
942 942 error = xfs_da_read_buf(tp, dp, map->br_startoff,
943 943 map->br_blockcount >= mp->m_dirblkfsbs ?
944 944 XFS_FSB_TO_DADDR(mp, map->br_startblock) :
... ... @@ -1014,7 +1014,7 @@
1014 1014 /*
1015 1015 * Having done a read, we need to set a new offset.
1016 1016 */
1017   - newoff = XFS_DIR2_DB_OFF_TO_BYTE(mp, curdb, 0);
  1017 + newoff = xfs_dir2_db_off_to_byte(mp, curdb, 0);
1018 1018 /*
1019 1019 * Start of the current block.
1020 1020 */
... ... @@ -1024,7 +1024,7 @@
1024 1024 * Make sure we're in the right block.
1025 1025 */
1026 1026 else if (curoff > newoff)
1027   - ASSERT(XFS_DIR2_BYTE_TO_DB(mp, curoff) ==
  1027 + ASSERT(xfs_dir2_byte_to_db(mp, curoff) ==
1028 1028 curdb);
1029 1029 data = bp->data;
1030 1030 xfs_dir2_data_check(dp, bp);
... ... @@ -1032,7 +1032,7 @@
1032 1032 * Find our position in the block.
1033 1033 */
1034 1034 ptr = (char *)&data->u;
1035   - byteoff = XFS_DIR2_BYTE_TO_OFF(mp, curoff);
  1035 + byteoff = xfs_dir2_byte_to_off(mp, curoff);
1036 1036 /*
1037 1037 * Skip past the header.
1038 1038 */
1039 1039  
... ... @@ -1054,15 +1054,15 @@
1054 1054 }
1055 1055 dep = (xfs_dir2_data_entry_t *)ptr;
1056 1056 length =
1057   - XFS_DIR2_DATA_ENTSIZE(dep->namelen);
  1057 + xfs_dir2_data_entsize(dep->namelen);
1058 1058 ptr += length;
1059 1059 }
1060 1060 /*
1061 1061 * Now set our real offset.
1062 1062 */
1063 1063 curoff =
1064   - XFS_DIR2_DB_OFF_TO_BYTE(mp,
1065   - XFS_DIR2_BYTE_TO_DB(mp, curoff),
  1064 + xfs_dir2_db_off_to_byte(mp,
  1065 + xfs_dir2_byte_to_db(mp, curoff),
1066 1066 (char *)ptr - (char *)data);
1067 1067 if (ptr >= (char *)data + mp->m_dirblksize) {
1068 1068 continue;
1069 1069  
... ... @@ -1091,9 +1091,9 @@
1091 1091  
1092 1092 p->namelen = dep->namelen;
1093 1093  
1094   - length = XFS_DIR2_DATA_ENTSIZE(p->namelen);
  1094 + length = xfs_dir2_data_entsize(p->namelen);
1095 1095  
1096   - p->cook = XFS_DIR2_BYTE_TO_DATAPTR(mp, curoff + length);
  1096 + p->cook = xfs_dir2_byte_to_dataptr(mp, curoff + length);
1097 1097  
1098 1098 p->ino = be64_to_cpu(dep->inumber);
1099 1099 #if XFS_BIG_INUMS
1100 1100  
... ... @@ -1121,10 +1121,10 @@
1121 1121 * All done. Set output offset value to current offset.
1122 1122 */
1123 1123 *eofp = eof;
1124   - if (curoff > XFS_DIR2_DATAPTR_TO_BYTE(mp, XFS_DIR2_MAX_DATAPTR))
  1124 + if (curoff > xfs_dir2_dataptr_to_byte(mp, XFS_DIR2_MAX_DATAPTR))
1125 1125 uio->uio_offset = XFS_DIR2_MAX_DATAPTR;
1126 1126 else
1127   - uio->uio_offset = XFS_DIR2_BYTE_TO_DATAPTR(mp, curoff);
  1127 + uio->uio_offset = xfs_dir2_byte_to_dataptr(mp, curoff);
1128 1128 kmem_free(map, map_size * sizeof(*map));
1129 1129 kmem_free(p, sizeof(*p));
1130 1130 if (bp)
... ... @@ -1159,7 +1159,7 @@
1159 1159 /*
1160 1160 * Get the buffer for the block.
1161 1161 */
1162   - error = xfs_da_get_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, bno), -1, &bp,
  1162 + error = xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(mp, bno), -1, &bp,
1163 1163 XFS_DATA_FORK);
1164 1164 if (error) {
1165 1165 return error;
... ... @@ -1181,7 +1181,7 @@
1181 1181 * the block.
1182 1182 */
1183 1183 if (magic == XFS_DIR2_LEAF1_MAGIC) {
1184   - ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
  1184 + ltp = xfs_dir2_leaf_tail_p(mp, leaf);
1185 1185 ltp->bestcount = 0;
1186 1186 xfs_dir2_leaf_log_tail(tp, bp);
1187 1187 }
... ... @@ -1206,9 +1206,9 @@
1206 1206  
1207 1207 leaf = bp->data;
1208 1208 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC);
1209   - ltp = XFS_DIR2_LEAF_TAIL_P(tp->t_mountp, leaf);
1210   - firstb = XFS_DIR2_LEAF_BESTS_P(ltp) + first;
1211   - lastb = XFS_DIR2_LEAF_BESTS_P(ltp) + last;
  1209 + ltp = xfs_dir2_leaf_tail_p(tp->t_mountp, leaf);
  1210 + firstb = xfs_dir2_leaf_bests_p(ltp) + first;
  1211 + lastb = xfs_dir2_leaf_bests_p(ltp) + last;
1212 1212 xfs_da_log_buf(tp, bp, (uint)((char *)firstb - (char *)leaf),
1213 1213 (uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1));
1214 1214 }
... ... @@ -1268,7 +1268,7 @@
1268 1268 mp = tp->t_mountp;
1269 1269 leaf = bp->data;
1270 1270 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC);
1271   - ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
  1271 + ltp = xfs_dir2_leaf_tail_p(mp, leaf);
1272 1272 xfs_da_log_buf(tp, bp, (uint)((char *)ltp - (char *)leaf),
1273 1273 (uint)(mp->m_dirblksize - 1));
1274 1274 }
... ... @@ -1312,7 +1312,7 @@
1312 1312 */
1313 1313 dep = (xfs_dir2_data_entry_t *)
1314 1314 ((char *)dbp->data +
1315   - XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, be32_to_cpu(lep->address)));
  1315 + xfs_dir2_dataptr_to_off(dp->i_mount, be32_to_cpu(lep->address)));
1316 1316 /*
1317 1317 * Return the found inode number.
1318 1318 */
... ... @@ -1381,7 +1381,7 @@
1381 1381 /*
1382 1382 * Get the new data block number.
1383 1383 */
1384   - newdb = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address));
  1384 + newdb = xfs_dir2_dataptr_to_db(mp, be32_to_cpu(lep->address));
1385 1385 /*
1386 1386 * If it's not the same as the old data block number,
1387 1387 * need to pitch the old one and read the new one.
... ... @@ -1391,7 +1391,7 @@
1391 1391 xfs_da_brelse(tp, dbp);
1392 1392 if ((error =
1393 1393 xfs_da_read_buf(tp, dp,
1394   - XFS_DIR2_DB_TO_DA(mp, newdb), -1, &dbp,
  1394 + xfs_dir2_db_to_da(mp, newdb), -1, &dbp,
1395 1395 XFS_DATA_FORK))) {
1396 1396 xfs_da_brelse(tp, lbp);
1397 1397 return error;
... ... @@ -1404,7 +1404,7 @@
1404 1404 */
1405 1405 dep = (xfs_dir2_data_entry_t *)
1406 1406 ((char *)dbp->data +
1407   - XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address)));
  1407 + xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
1408 1408 /*
1409 1409 * If it matches then return it.
1410 1410 */
1411 1411  
1412 1412  
1413 1413  
... ... @@ -1469,20 +1469,20 @@
1469 1469 * Point to the leaf entry, use that to point to the data entry.
1470 1470 */
1471 1471 lep = &leaf->ents[index];
1472   - db = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address));
  1472 + db = xfs_dir2_dataptr_to_db(mp, be32_to_cpu(lep->address));
1473 1473 dep = (xfs_dir2_data_entry_t *)
1474   - ((char *)data + XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address)));
  1474 + ((char *)data + xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
1475 1475 needscan = needlog = 0;
1476 1476 oldbest = be16_to_cpu(data->hdr.bestfree[0].length);
1477   - ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
1478   - bestsp = XFS_DIR2_LEAF_BESTS_P(ltp);
  1477 + ltp = xfs_dir2_leaf_tail_p(mp, leaf);
  1478 + bestsp = xfs_dir2_leaf_bests_p(ltp);
1479 1479 ASSERT(be16_to_cpu(bestsp[db]) == oldbest);
1480 1480 /*
1481 1481 * Mark the former data entry unused.
1482 1482 */
1483 1483 xfs_dir2_data_make_free(tp, dbp,
1484 1484 (xfs_dir2_data_aoff_t)((char *)dep - (char *)data),
1485   - XFS_DIR2_DATA_ENTSIZE(dep->namelen), &needlog, &needscan);
  1485 + xfs_dir2_data_entsize(dep->namelen), &needlog, &needscan);
1486 1486 /*
1487 1487 * We just mark the leaf entry stale by putting a null in it.
1488 1488 */
... ... @@ -1602,7 +1602,7 @@
1602 1602 */
1603 1603 dep = (xfs_dir2_data_entry_t *)
1604 1604 ((char *)dbp->data +
1605   - XFS_DIR2_DATAPTR_TO_OFF(dp->i_mount, be32_to_cpu(lep->address)));
  1605 + xfs_dir2_dataptr_to_off(dp->i_mount, be32_to_cpu(lep->address)));
1606 1606 ASSERT(args->inumber != be64_to_cpu(dep->inumber));
1607 1607 /*
1608 1608 * Put the new inode number in, log it.
... ... @@ -1698,7 +1698,7 @@
1698 1698 /*
1699 1699 * Read the offending data block. We need its buffer.
1700 1700 */
1701   - if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, db), -1, &dbp,
  1701 + if ((error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, db), -1, &dbp,
1702 1702 XFS_DATA_FORK))) {
1703 1703 return error;
1704 1704 }
... ... @@ -1712,7 +1712,7 @@
1712 1712 */
1713 1713  
1714 1714 leaf = lbp->data;
1715   - ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
  1715 + ltp = xfs_dir2_leaf_tail_p(mp, leaf);
1716 1716 ASSERT(be16_to_cpu(data->hdr.bestfree[0].length) ==
1717 1717 mp->m_dirblksize - (uint)sizeof(data->hdr));
1718 1718 ASSERT(db == be32_to_cpu(ltp->bestcount) - 1);
... ... @@ -1727,7 +1727,7 @@
1727 1727 /*
1728 1728 * Eliminate the last bests entry from the table.
1729 1729 */
1730   - bestsp = XFS_DIR2_LEAF_BESTS_P(ltp);
  1730 + bestsp = xfs_dir2_leaf_bests_p(ltp);
1731 1731 be32_add(&ltp->bestcount, -1);
1732 1732 memmove(&bestsp[1], &bestsp[0], be32_to_cpu(ltp->bestcount) * sizeof(*bestsp));
1733 1733 xfs_dir2_leaf_log_tail(tp, lbp);
1734 1734  
... ... @@ -1838,12 +1838,12 @@
1838 1838 /*
1839 1839 * Set up the leaf tail from the freespace block.
1840 1840 */
1841   - ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
  1841 + ltp = xfs_dir2_leaf_tail_p(mp, leaf);
1842 1842 ltp->bestcount = free->hdr.nvalid;
1843 1843 /*
1844 1844 * Set up the leaf bests table.
1845 1845 */
1846   - memcpy(XFS_DIR2_LEAF_BESTS_P(ltp), free->bests,
  1846 + memcpy(xfs_dir2_leaf_bests_p(ltp), free->bests,
1847 1847 be32_to_cpu(ltp->bestcount) * sizeof(leaf->bests[0]));
1848 1848 xfs_dir2_leaf_log_bests(tp, lbp, 0, be32_to_cpu(ltp->bestcount) - 1);
1849 1849 xfs_dir2_leaf_log_tail(tp, lbp);
fs/xfs/xfs_dir2_leaf.h
... ... @@ -32,7 +32,7 @@
32 32 #define XFS_DIR2_LEAF_SPACE 1
33 33 #define XFS_DIR2_LEAF_OFFSET (XFS_DIR2_LEAF_SPACE * XFS_DIR2_SPACE_SIZE)
34 34 #define XFS_DIR2_LEAF_FIRSTDB(mp) \
35   - XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_LEAF_OFFSET)
  35 + xfs_dir2_byte_to_db(mp, XFS_DIR2_LEAF_OFFSET)
36 36  
37 37 /*
38 38 * Offset in data space of a data entry.
... ... @@ -82,7 +82,6 @@
82 82 * DB blocks here are logical directory block numbers, not filesystem blocks.
83 83 */
84 84  
85   -#define XFS_DIR2_MAX_LEAF_ENTS(mp) xfs_dir2_max_leaf_ents(mp)
86 85 static inline int xfs_dir2_max_leaf_ents(struct xfs_mount *mp)
87 86 {
88 87 return (int)(((mp)->m_dirblksize - (uint)sizeof(xfs_dir2_leaf_hdr_t)) /
... ... @@ -92,7 +91,6 @@
92 91 /*
93 92 * Get address of the bestcount field in the single-leaf block.
94 93 */
95   -#define XFS_DIR2_LEAF_TAIL_P(mp,lp) xfs_dir2_leaf_tail_p(mp, lp)
96 94 static inline xfs_dir2_leaf_tail_t *
97 95 xfs_dir2_leaf_tail_p(struct xfs_mount *mp, xfs_dir2_leaf_t *lp)
98 96 {
... ... @@ -104,7 +102,6 @@
104 102 /*
105 103 * Get address of the bests array in the single-leaf block.
106 104 */
107   -#define XFS_DIR2_LEAF_BESTS_P(ltp) xfs_dir2_leaf_bests_p(ltp)
108 105 static inline __be16 *
109 106 xfs_dir2_leaf_bests_p(xfs_dir2_leaf_tail_t *ltp)
110 107 {
... ... @@ -114,7 +111,6 @@
114 111 /*
115 112 * Convert dataptr to byte in file space
116 113 */
117   -#define XFS_DIR2_DATAPTR_TO_BYTE(mp,dp) xfs_dir2_dataptr_to_byte(mp, dp)
118 114 static inline xfs_dir2_off_t
119 115 xfs_dir2_dataptr_to_byte(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
120 116 {
... ... @@ -124,7 +120,6 @@
124 120 /*
125 121 * Convert byte in file space to dataptr. It had better be aligned.
126 122 */
127   -#define XFS_DIR2_BYTE_TO_DATAPTR(mp,by) xfs_dir2_byte_to_dataptr(mp,by)
128 123 static inline xfs_dir2_dataptr_t
129 124 xfs_dir2_byte_to_dataptr(struct xfs_mount *mp, xfs_dir2_off_t by)
130 125 {
... ... @@ -134,7 +129,6 @@
134 129 /*
135 130 * Convert byte in space to (DB) block
136 131 */
137   -#define XFS_DIR2_BYTE_TO_DB(mp,by) xfs_dir2_byte_to_db(mp, by)
138 132 static inline xfs_dir2_db_t
139 133 xfs_dir2_byte_to_db(struct xfs_mount *mp, xfs_dir2_off_t by)
140 134 {
141 135  
142 136  
... ... @@ -145,17 +139,15 @@
145 139 /*
146 140 * Convert dataptr to a block number
147 141 */
148   -#define XFS_DIR2_DATAPTR_TO_DB(mp,dp) xfs_dir2_dataptr_to_db(mp, dp)
149 142 static inline xfs_dir2_db_t
150 143 xfs_dir2_dataptr_to_db(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
151 144 {
152   - return XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp));
  145 + return xfs_dir2_byte_to_db(mp, xfs_dir2_dataptr_to_byte(mp, dp));
153 146 }
154 147  
155 148 /*
156 149 * Convert byte in space to offset in a block
157 150 */
158   -#define XFS_DIR2_BYTE_TO_OFF(mp,by) xfs_dir2_byte_to_off(mp, by)
159 151 static inline xfs_dir2_data_aoff_t
160 152 xfs_dir2_byte_to_off(struct xfs_mount *mp, xfs_dir2_off_t by)
161 153 {
162 154  
163 155  
... ... @@ -166,18 +158,15 @@
166 158 /*
167 159 * Convert dataptr to a byte offset in a block
168 160 */
169   -#define XFS_DIR2_DATAPTR_TO_OFF(mp,dp) xfs_dir2_dataptr_to_off(mp, dp)
170 161 static inline xfs_dir2_data_aoff_t
171 162 xfs_dir2_dataptr_to_off(struct xfs_mount *mp, xfs_dir2_dataptr_t dp)
172 163 {
173   - return XFS_DIR2_BYTE_TO_OFF(mp, XFS_DIR2_DATAPTR_TO_BYTE(mp, dp));
  164 + return xfs_dir2_byte_to_off(mp, xfs_dir2_dataptr_to_byte(mp, dp));
174 165 }
175 166  
176 167 /*
177 168 * Convert block and offset to byte in space
178 169 */
179   -#define XFS_DIR2_DB_OFF_TO_BYTE(mp,db,o) \
180   - xfs_dir2_db_off_to_byte(mp, db, o)
181 170 static inline xfs_dir2_off_t
182 171 xfs_dir2_db_off_to_byte(struct xfs_mount *mp, xfs_dir2_db_t db,
183 172 xfs_dir2_data_aoff_t o)
... ... @@ -189,7 +178,6 @@
189 178 /*
190 179 * Convert block (DB) to block (dablk)
191 180 */
192   -#define XFS_DIR2_DB_TO_DA(mp,db) xfs_dir2_db_to_da(mp, db)
193 181 static inline xfs_dablk_t
194 182 xfs_dir2_db_to_da(struct xfs_mount *mp, xfs_dir2_db_t db)
195 183 {
196 184  
197 185  
198 186  
199 187  
... ... @@ -199,29 +187,25 @@
199 187 /*
200 188 * Convert byte in space to (DA) block
201 189 */
202   -#define XFS_DIR2_BYTE_TO_DA(mp,by) xfs_dir2_byte_to_da(mp, by)
203 190 static inline xfs_dablk_t
204 191 xfs_dir2_byte_to_da(struct xfs_mount *mp, xfs_dir2_off_t by)
205 192 {
206   - return XFS_DIR2_DB_TO_DA(mp, XFS_DIR2_BYTE_TO_DB(mp, by));
  193 + return xfs_dir2_db_to_da(mp, xfs_dir2_byte_to_db(mp, by));
207 194 }
208 195  
209 196 /*
210 197 * Convert block and offset to dataptr
211 198 */
212   -#define XFS_DIR2_DB_OFF_TO_DATAPTR(mp,db,o) \
213   - xfs_dir2_db_off_to_dataptr(mp, db, o)
214 199 static inline xfs_dir2_dataptr_t
215 200 xfs_dir2_db_off_to_dataptr(struct xfs_mount *mp, xfs_dir2_db_t db,
216 201 xfs_dir2_data_aoff_t o)
217 202 {
218   - return XFS_DIR2_BYTE_TO_DATAPTR(mp, XFS_DIR2_DB_OFF_TO_BYTE(mp, db, o));
  203 + return xfs_dir2_byte_to_dataptr(mp, xfs_dir2_db_off_to_byte(mp, db, o));
219 204 }
220 205  
221 206 /*
222 207 * Convert block (dablk) to block (DB)
223 208 */
224   -#define XFS_DIR2_DA_TO_DB(mp,da) xfs_dir2_da_to_db(mp, da)
225 209 static inline xfs_dir2_db_t
226 210 xfs_dir2_da_to_db(struct xfs_mount *mp, xfs_dablk_t da)
227 211 {
228 212  
... ... @@ -231,11 +215,10 @@
231 215 /*
232 216 * Convert block (dablk) to byte offset in space
233 217 */
234   -#define XFS_DIR2_DA_TO_BYTE(mp,da) xfs_dir2_da_to_byte(mp, da)
235 218 static inline xfs_dir2_off_t
236 219 xfs_dir2_da_to_byte(struct xfs_mount *mp, xfs_dablk_t da)
237 220 {
238   - return XFS_DIR2_DB_OFF_TO_BYTE(mp, XFS_DIR2_DA_TO_DB(mp, da), 0);
  221 + return xfs_dir2_db_off_to_byte(mp, xfs_dir2_da_to_db(mp, da), 0);
239 222 }
240 223  
241 224 /*
fs/xfs/xfs_dir2_node.c
... ... @@ -136,14 +136,14 @@
136 136 /*
137 137 * Get the buffer for the new freespace block.
138 138 */
139   - if ((error = xfs_da_get_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fdb), -1, &fbp,
  139 + if ((error = xfs_da_get_buf(tp, dp, xfs_dir2_db_to_da(mp, fdb), -1, &fbp,
140 140 XFS_DATA_FORK))) {
141 141 return error;
142 142 }
143 143 ASSERT(fbp != NULL);
144 144 free = fbp->data;
145 145 leaf = lbp->data;
146   - ltp = XFS_DIR2_LEAF_TAIL_P(mp, leaf);
  146 + ltp = xfs_dir2_leaf_tail_p(mp, leaf);
147 147 /*
148 148 * Initialize the freespace block header.
149 149 */
... ... @@ -155,7 +155,7 @@
155 155 * Copy freespace entries from the leaf block to the new block.
156 156 * Count active entries.
157 157 */
158   - for (i = n = 0, from = XFS_DIR2_LEAF_BESTS_P(ltp), to = free->bests;
  158 + for (i = n = 0, from = xfs_dir2_leaf_bests_p(ltp), to = free->bests;
159 159 i < be32_to_cpu(ltp->bestcount); i++, from++, to++) {
160 160 if ((off = be16_to_cpu(*from)) != NULLDATAOFF)
161 161 n++;
... ... @@ -215,7 +215,7 @@
215 215 * a compact.
216 216 */
217 217  
218   - if (be16_to_cpu(leaf->hdr.count) == XFS_DIR2_MAX_LEAF_ENTS(mp)) {
  218 + if (be16_to_cpu(leaf->hdr.count) == xfs_dir2_max_leaf_ents(mp)) {
219 219 if (!leaf->hdr.stale)
220 220 return XFS_ERROR(ENOSPC);
221 221 compact = be16_to_cpu(leaf->hdr.stale) > 1;
... ... @@ -327,7 +327,7 @@
327 327 * Insert the new entry, log everything.
328 328 */
329 329 lep->hashval = cpu_to_be32(args->hashval);
330   - lep->address = cpu_to_be32(XFS_DIR2_DB_OFF_TO_DATAPTR(mp,
  330 + lep->address = cpu_to_be32(xfs_dir2_db_off_to_dataptr(mp,
331 331 args->blkno, args->index));
332 332 xfs_dir2_leaf_log_header(tp, bp);
333 333 xfs_dir2_leaf_log_ents(tp, bp, lfloglow, lfloghigh);
... ... @@ -352,7 +352,7 @@
352 352 leaf = bp->data;
353 353 mp = dp->i_mount;
354 354 ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
355   - ASSERT(be16_to_cpu(leaf->hdr.count) <= XFS_DIR2_MAX_LEAF_ENTS(mp));
  355 + ASSERT(be16_to_cpu(leaf->hdr.count) <= xfs_dir2_max_leaf_ents(mp));
356 356 for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) {
357 357 if (i + 1 < be16_to_cpu(leaf->hdr.count)) {
358 358 ASSERT(be32_to_cpu(leaf->ents[i].hashval) <=
... ... @@ -440,7 +440,7 @@
440 440 if (args->addname) {
441 441 curfdb = curbp ? state->extrablk.blkno : -1;
442 442 curdb = -1;
443   - length = XFS_DIR2_DATA_ENTSIZE(args->namelen);
  443 + length = xfs_dir2_data_entsize(args->namelen);
444 444 if ((free = (curbp ? curbp->data : NULL)))
445 445 ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC);
446 446 }
... ... @@ -465,7 +465,7 @@
465 465 /*
466 466 * Pull the data block number from the entry.
467 467 */
468   - newdb = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address));
  468 + newdb = xfs_dir2_dataptr_to_db(mp, be32_to_cpu(lep->address));
469 469 /*
470 470 * For addname, we're looking for a place to put the new entry.
471 471 * We want to use a data block with an entry of equal
... ... @@ -482,7 +482,7 @@
482 482 * Convert the data block to the free block
483 483 * holding its freespace information.
484 484 */
485   - newfdb = XFS_DIR2_DB_TO_FDB(mp, newdb);
  485 + newfdb = xfs_dir2_db_to_fdb(mp, newdb);
486 486 /*
487 487 * If it's not the one we have in hand,
488 488 * read it in.
... ... @@ -497,7 +497,7 @@
497 497 * Read the free block.
498 498 */
499 499 if ((error = xfs_da_read_buf(tp, dp,
500   - XFS_DIR2_DB_TO_DA(mp,
  500 + xfs_dir2_db_to_da(mp,
501 501 newfdb),
502 502 -1, &curbp,
503 503 XFS_DATA_FORK))) {
... ... @@ -517,7 +517,7 @@
517 517 /*
518 518 * Get the index for our entry.
519 519 */
520   - fi = XFS_DIR2_DB_TO_FDINDEX(mp, curdb);
  520 + fi = xfs_dir2_db_to_fdindex(mp, curdb);
521 521 /*
522 522 * If it has room, return it.
523 523 */
... ... @@ -561,7 +561,7 @@
561 561 */
562 562 if ((error =
563 563 xfs_da_read_buf(tp, dp,
564   - XFS_DIR2_DB_TO_DA(mp, newdb), -1,
  564 + xfs_dir2_db_to_da(mp, newdb), -1,
565 565 &curbp, XFS_DATA_FORK))) {
566 566 return error;
567 567 }
... ... @@ -573,7 +573,7 @@
573 573 */
574 574 dep = (xfs_dir2_data_entry_t *)
575 575 ((char *)curbp->data +
576   - XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address)));
  576 + xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
577 577 /*
578 578 * Compare the entry, return it if it matches.
579 579 */
580 580  
... ... @@ -876,9 +876,9 @@
876 876 /*
877 877 * Extract the data block and offset from the entry.
878 878 */
879   - db = XFS_DIR2_DATAPTR_TO_DB(mp, be32_to_cpu(lep->address));
  879 + db = xfs_dir2_dataptr_to_db(mp, be32_to_cpu(lep->address));
880 880 ASSERT(dblk->blkno == db);
881   - off = XFS_DIR2_DATAPTR_TO_OFF(mp, be32_to_cpu(lep->address));
  881 + off = xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address));
882 882 ASSERT(dblk->index == off);
883 883 /*
884 884 * Kill the leaf entry by marking it stale.
... ... @@ -898,7 +898,7 @@
898 898 longest = be16_to_cpu(data->hdr.bestfree[0].length);
899 899 needlog = needscan = 0;
900 900 xfs_dir2_data_make_free(tp, dbp, off,
901   - XFS_DIR2_DATA_ENTSIZE(dep->namelen), &needlog, &needscan);
  901 + xfs_dir2_data_entsize(dep->namelen), &needlog, &needscan);
902 902 /*
903 903 * Rescan the data block freespaces for bestfree.
904 904 * Log the data block header if needed.
... ... @@ -924,8 +924,8 @@
924 924 * Convert the data block number to a free block,
925 925 * read in the free block.
926 926 */
927   - fdb = XFS_DIR2_DB_TO_FDB(mp, db);
928   - if ((error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, fdb),
  927 + fdb = xfs_dir2_db_to_fdb(mp, db);
  928 + if ((error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, fdb),
929 929 -1, &fbp, XFS_DATA_FORK))) {
930 930 return error;
931 931 }
... ... @@ -937,7 +937,7 @@
937 937 /*
938 938 * Calculate which entry we need to fix.
939 939 */
940   - findex = XFS_DIR2_DB_TO_FDINDEX(mp, db);
  940 + findex = xfs_dir2_db_to_fdindex(mp, db);
941 941 longest = be16_to_cpu(data->hdr.bestfree[0].length);
942 942 /*
943 943 * If the data block is now empty we can get rid of it
... ... @@ -1073,7 +1073,7 @@
1073 1073 /*
1074 1074 * Initialize the new leaf block.
1075 1075 */
1076   - error = xfs_dir2_leaf_init(args, XFS_DIR2_DA_TO_DB(mp, blkno),
  1076 + error = xfs_dir2_leaf_init(args, xfs_dir2_da_to_db(mp, blkno),
1077 1077 &newblk->bp, XFS_DIR2_LEAFN_MAGIC);
1078 1078 if (error) {
1079 1079 return error;
... ... @@ -1385,7 +1385,7 @@
1385 1385 dp = args->dp;
1386 1386 mp = dp->i_mount;
1387 1387 tp = args->trans;
1388   - length = XFS_DIR2_DATA_ENTSIZE(args->namelen);
  1388 + length = xfs_dir2_data_entsize(args->namelen);
1389 1389 /*
1390 1390 * If we came in with a freespace block that means that lookup
1391 1391 * found an entry with our hash value. This is the freespace
... ... @@ -1438,7 +1438,7 @@
1438 1438  
1439 1439 if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK)))
1440 1440 return error;
1441   - lastfbno = XFS_DIR2_DA_TO_DB(mp, (xfs_dablk_t)fo);
  1441 + lastfbno = xfs_dir2_da_to_db(mp, (xfs_dablk_t)fo);
1442 1442 fbno = ifbno;
1443 1443 }
1444 1444 /*
... ... @@ -1474,7 +1474,7 @@
1474 1474 * to avoid it.
1475 1475 */
1476 1476 if ((error = xfs_da_read_buf(tp, dp,
1477   - XFS_DIR2_DB_TO_DA(mp, fbno), -2, &fbp,
  1477 + xfs_dir2_db_to_da(mp, fbno), -2, &fbp,
1478 1478 XFS_DATA_FORK))) {
1479 1479 return error;
1480 1480 }
1481 1481  
... ... @@ -1550,9 +1550,9 @@
1550 1550 * Get the freespace block corresponding to the data block
1551 1551 * that was just allocated.
1552 1552 */
1553   - fbno = XFS_DIR2_DB_TO_FDB(mp, dbno);
  1553 + fbno = xfs_dir2_db_to_fdb(mp, dbno);
1554 1554 if (unlikely(error = xfs_da_read_buf(tp, dp,
1555   - XFS_DIR2_DB_TO_DA(mp, fbno), -2, &fbp,
  1555 + xfs_dir2_db_to_da(mp, fbno), -2, &fbp,
1556 1556 XFS_DATA_FORK))) {
1557 1557 xfs_da_buf_done(dbp);
1558 1558 return error;
1559 1559  
... ... @@ -1567,14 +1567,14 @@
1567 1567 return error;
1568 1568 }
1569 1569  
1570   - if (unlikely(XFS_DIR2_DB_TO_FDB(mp, dbno) != fbno)) {
  1570 + if (unlikely(xfs_dir2_db_to_fdb(mp, dbno) != fbno)) {
1571 1571 cmn_err(CE_ALERT,
1572 1572 "xfs_dir2_node_addname_int: dir ino "
1573 1573 "%llu needed freesp block %lld for\n"
1574 1574 " data block %lld, got %lld\n"
1575 1575 " ifbno %llu lastfbno %d\n",
1576 1576 (unsigned long long)dp->i_ino,
1577   - (long long)XFS_DIR2_DB_TO_FDB(mp, dbno),
  1577 + (long long)xfs_dir2_db_to_fdb(mp, dbno),
1578 1578 (long long)dbno, (long long)fbno,
1579 1579 (unsigned long long)ifbno, lastfbno);
1580 1580 if (fblk) {
... ... @@ -1598,7 +1598,7 @@
1598 1598 * Get a buffer for the new block.
1599 1599 */
1600 1600 if ((error = xfs_da_get_buf(tp, dp,
1601   - XFS_DIR2_DB_TO_DA(mp, fbno),
  1601 + xfs_dir2_db_to_da(mp, fbno),
1602 1602 -1, &fbp, XFS_DATA_FORK))) {
1603 1603 return error;
1604 1604 }
... ... @@ -1623,7 +1623,7 @@
1623 1623 /*
1624 1624 * Set the freespace block index from the data block number.
1625 1625 */
1626   - findex = XFS_DIR2_DB_TO_FDINDEX(mp, dbno);
  1626 + findex = xfs_dir2_db_to_fdindex(mp, dbno);
1627 1627 /*
1628 1628 * If it's after the end of the current entries in the
1629 1629 * freespace block, extend that table.
... ... @@ -1669,7 +1669,7 @@
1669 1669 * Read the data block in.
1670 1670 */
1671 1671 if (unlikely(
1672   - error = xfs_da_read_buf(tp, dp, XFS_DIR2_DB_TO_DA(mp, dbno),
  1672 + error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, dbno),
1673 1673 -1, &dbp, XFS_DATA_FORK))) {
1674 1674 if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL)
1675 1675 xfs_da_buf_done(fbp);
... ... @@ -1698,7 +1698,7 @@
1698 1698 dep->inumber = cpu_to_be64(args->inumber);
1699 1699 dep->namelen = args->namelen;
1700 1700 memcpy(dep->name, args->name, dep->namelen);
1701   - tagp = XFS_DIR2_DATA_ENTRY_TAG_P(dep);
  1701 + tagp = xfs_dir2_data_entry_tag_p(dep);
1702 1702 *tagp = cpu_to_be16((char *)dep - (char *)data);
1703 1703 xfs_dir2_data_log_entry(tp, dbp, dep);
1704 1704 /*
... ... @@ -1904,7 +1904,7 @@
1904 1904 ASSERT(be32_to_cpu(data->hdr.magic) == XFS_DIR2_DATA_MAGIC);
1905 1905 dep = (xfs_dir2_data_entry_t *)
1906 1906 ((char *)data +
1907   - XFS_DIR2_DATAPTR_TO_OFF(state->mp, be32_to_cpu(lep->address)));
  1907 + xfs_dir2_dataptr_to_off(state->mp, be32_to_cpu(lep->address)));
1908 1908 ASSERT(inum != be64_to_cpu(dep->inumber));
1909 1909 /*
1910 1910 * Fill in the new inode number and log the entry.
... ... @@ -1980,7 +1980,7 @@
1980 1980 * Blow the block away.
1981 1981 */
1982 1982 if ((error =
1983   - xfs_dir2_shrink_inode(args, XFS_DIR2_DA_TO_DB(mp, (xfs_dablk_t)fo),
  1983 + xfs_dir2_shrink_inode(args, xfs_dir2_da_to_db(mp, (xfs_dablk_t)fo),
1984 1984 bp))) {
1985 1985 /*
1986 1986 * Can't fail with ENOSPC since that only happens with no
fs/xfs/xfs_dir2_node.h
... ... @@ -36,7 +36,7 @@
36 36 #define XFS_DIR2_FREE_SPACE 2
37 37 #define XFS_DIR2_FREE_OFFSET (XFS_DIR2_FREE_SPACE * XFS_DIR2_SPACE_SIZE)
38 38 #define XFS_DIR2_FREE_FIRSTDB(mp) \
39   - XFS_DIR2_BYTE_TO_DB(mp, XFS_DIR2_FREE_OFFSET)
  39 + xfs_dir2_byte_to_db(mp, XFS_DIR2_FREE_OFFSET)
40 40  
41 41 #define XFS_DIR2_FREE_MAGIC 0x58443246 /* XD2F */
42 42  
... ... @@ -60,7 +60,6 @@
60 60 /*
61 61 * Convert data space db to the corresponding free db.
62 62 */
63   -#define XFS_DIR2_DB_TO_FDB(mp,db) xfs_dir2_db_to_fdb(mp, db)
64 63 static inline xfs_dir2_db_t
65 64 xfs_dir2_db_to_fdb(struct xfs_mount *mp, xfs_dir2_db_t db)
66 65 {
... ... @@ -70,7 +69,6 @@
70 69 /*
71 70 * Convert data space db to the corresponding index in a free db.
72 71 */
73   -#define XFS_DIR2_DB_TO_FDINDEX(mp,db) xfs_dir2_db_to_fdindex(mp, db)
74 72 static inline int
75 73 xfs_dir2_db_to_fdindex(struct xfs_mount *mp, xfs_dir2_db_t db)
76 74 {
fs/xfs/xfs_dir2_sf.c
... ... @@ -89,8 +89,8 @@
89 89 mp = dp->i_mount;
90 90  
91 91 count = i8count = namelen = 0;
92   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
93   - blp = XFS_DIR2_BLOCK_LEAF_P(btp);
  92 + btp = xfs_dir2_block_tail_p(mp, block);
  93 + blp = xfs_dir2_block_leaf_p(btp);
94 94  
95 95 /*
96 96 * Iterate over the block's data entries by using the leaf pointers.
... ... @@ -102,7 +102,7 @@
102 102 * Calculate the pointer to the entry at hand.
103 103 */
104 104 dep = (xfs_dir2_data_entry_t *)
105   - ((char *)block + XFS_DIR2_DATAPTR_TO_OFF(mp, addr));
  105 + ((char *)block + xfs_dir2_dataptr_to_off(mp, addr));
106 106 /*
107 107 * Detect . and .., so we can special-case them.
108 108 * . is not included in sf directories.
... ... @@ -124,7 +124,7 @@
124 124 /*
125 125 * Calculate the new size, see if we should give up yet.
126 126 */
127   - size = XFS_DIR2_SF_HDR_SIZE(i8count) + /* header */
  127 + size = xfs_dir2_sf_hdr_size(i8count) + /* header */
128 128 count + /* namelen */
129 129 count * (uint)sizeof(xfs_dir2_sf_off_t) + /* offset */
130 130 namelen + /* name */
... ... @@ -139,7 +139,7 @@
139 139 */
140 140 sfhp->count = count;
141 141 sfhp->i8count = i8count;
142   - XFS_DIR2_SF_PUT_INUMBER((xfs_dir2_sf_t *)sfhp, &parent, &sfhp->parent);
  142 + xfs_dir2_sf_put_inumber((xfs_dir2_sf_t *)sfhp, &parent, &sfhp->parent);
143 143 return size;
144 144 }
145 145  
146 146  
147 147  
... ... @@ -199,15 +199,15 @@
199 199 * Copy the header into the newly allocate local space.
200 200 */
201 201 sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
202   - memcpy(sfp, sfhp, XFS_DIR2_SF_HDR_SIZE(sfhp->i8count));
  202 + memcpy(sfp, sfhp, xfs_dir2_sf_hdr_size(sfhp->i8count));
203 203 dp->i_d.di_size = size;
204 204 /*
205 205 * Set up to loop over the block's entries.
206 206 */
207   - btp = XFS_DIR2_BLOCK_TAIL_P(mp, block);
  207 + btp = xfs_dir2_block_tail_p(mp, block);
208 208 ptr = (char *)block->u;
209   - endptr = (char *)XFS_DIR2_BLOCK_LEAF_P(btp);
210   - sfep = XFS_DIR2_SF_FIRSTENTRY(sfp);
  209 + endptr = (char *)xfs_dir2_block_leaf_p(btp);
  210 + sfep = xfs_dir2_sf_firstentry(sfp);
211 211 /*
212 212 * Loop over the active and unused entries.
213 213 * Stop when we reach the leaf/tail portion of the block.
214 214  
215 215  
216 216  
... ... @@ -233,22 +233,22 @@
233 233 else if (dep->namelen == 2 &&
234 234 dep->name[0] == '.' && dep->name[1] == '.')
235 235 ASSERT(be64_to_cpu(dep->inumber) ==
236   - XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent));
  236 + xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent));
237 237 /*
238 238 * Normal entry, copy it into shortform.
239 239 */
240 240 else {
241 241 sfep->namelen = dep->namelen;
242   - XFS_DIR2_SF_PUT_OFFSET(sfep,
  242 + xfs_dir2_sf_put_offset(sfep,
243 243 (xfs_dir2_data_aoff_t)
244 244 ((char *)dep - (char *)block));
245 245 memcpy(sfep->name, dep->name, dep->namelen);
246 246 temp = be64_to_cpu(dep->inumber);
247   - XFS_DIR2_SF_PUT_INUMBER(sfp, &temp,
248   - XFS_DIR2_SF_INUMBERP(sfep));
249   - sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep);
  247 + xfs_dir2_sf_put_inumber(sfp, &temp,
  248 + xfs_dir2_sf_inumberp(sfep));
  249 + sfep = xfs_dir2_sf_nextentry(sfp, sfep);
250 250 }
251   - ptr += XFS_DIR2_DATA_ENTSIZE(dep->namelen);
  251 + ptr += xfs_dir2_data_entsize(dep->namelen);
252 252 }
253 253 ASSERT((char *)sfep - (char *)sfp == size);
254 254 xfs_dir2_sf_check(args);
255 255  
... ... @@ -294,11 +294,11 @@
294 294 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size);
295 295 ASSERT(dp->i_df.if_u1.if_data != NULL);
296 296 sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
297   - ASSERT(dp->i_d.di_size >= XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count));
  297 + ASSERT(dp->i_d.di_size >= xfs_dir2_sf_hdr_size(sfp->hdr.i8count));
298 298 /*
299 299 * Compute entry (and change in) size.
300 300 */
301   - add_entsize = XFS_DIR2_SF_ENTSIZE_BYNAME(sfp, args->namelen);
  301 + add_entsize = xfs_dir2_sf_entsize_byname(sfp, args->namelen);
302 302 incr_isize = add_entsize;
303 303 objchange = 0;
304 304 #if XFS_BIG_INUMS
... ... @@ -392,7 +392,7 @@
392 392 /*
393 393 * Grow the in-inode space.
394 394 */
395   - xfs_idata_realloc(dp, XFS_DIR2_SF_ENTSIZE_BYNAME(sfp, args->namelen),
  395 + xfs_idata_realloc(dp, xfs_dir2_sf_entsize_byname(sfp, args->namelen),
396 396 XFS_DATA_FORK);
397 397 /*
398 398 * Need to set up again due to realloc of the inode data.
399 399  
... ... @@ -403,10 +403,10 @@
403 403 * Fill in the new entry.
404 404 */
405 405 sfep->namelen = args->namelen;
406   - XFS_DIR2_SF_PUT_OFFSET(sfep, offset);
  406 + xfs_dir2_sf_put_offset(sfep, offset);
407 407 memcpy(sfep->name, args->name, sfep->namelen);
408   - XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber,
409   - XFS_DIR2_SF_INUMBERP(sfep));
  408 + xfs_dir2_sf_put_inumber(sfp, &args->inumber,
  409 + xfs_dir2_sf_inumberp(sfep));
410 410 /*
411 411 * Update the header and inode.
412 412 */
413 413  
414 414  
... ... @@ -463,14 +463,14 @@
463 463 * If it's going to end up at the end then oldsfep will point there.
464 464 */
465 465 for (offset = XFS_DIR2_DATA_FIRST_OFFSET,
466   - oldsfep = XFS_DIR2_SF_FIRSTENTRY(oldsfp),
467   - add_datasize = XFS_DIR2_DATA_ENTSIZE(args->namelen),
  466 + oldsfep = xfs_dir2_sf_firstentry(oldsfp),
  467 + add_datasize = xfs_dir2_data_entsize(args->namelen),
468 468 eof = (char *)oldsfep == &buf[old_isize];
469 469 !eof;
470   - offset = new_offset + XFS_DIR2_DATA_ENTSIZE(oldsfep->namelen),
471   - oldsfep = XFS_DIR2_SF_NEXTENTRY(oldsfp, oldsfep),
  470 + offset = new_offset + xfs_dir2_data_entsize(oldsfep->namelen),
  471 + oldsfep = xfs_dir2_sf_nextentry(oldsfp, oldsfep),
472 472 eof = (char *)oldsfep == &buf[old_isize]) {
473   - new_offset = XFS_DIR2_SF_GET_OFFSET(oldsfep);
  473 + new_offset = xfs_dir2_sf_get_offset(oldsfep);
474 474 if (offset + add_datasize <= new_offset)
475 475 break;
476 476 }
477 477  
... ... @@ -495,10 +495,10 @@
495 495 * Fill in the new entry, and update the header counts.
496 496 */
497 497 sfep->namelen = args->namelen;
498   - XFS_DIR2_SF_PUT_OFFSET(sfep, offset);
  498 + xfs_dir2_sf_put_offset(sfep, offset);
499 499 memcpy(sfep->name, args->name, sfep->namelen);
500   - XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber,
501   - XFS_DIR2_SF_INUMBERP(sfep));
  500 + xfs_dir2_sf_put_inumber(sfp, &args->inumber,
  501 + xfs_dir2_sf_inumberp(sfep));
502 502 sfp->hdr.count++;
503 503 #if XFS_BIG_INUMS
504 504 if (args->inumber > XFS_DIR2_MAX_SHORT_INUM && !objchange)
... ... @@ -508,7 +508,7 @@
508 508 * If there's more left to copy, do that.
509 509 */
510 510 if (!eof) {
511   - sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep);
  511 + sfep = xfs_dir2_sf_nextentry(sfp, sfep);
512 512 memcpy(sfep, oldsfep, old_isize - nbytes);
513 513 }
514 514 kmem_free(buf, old_isize);
515 515  
... ... @@ -544,9 +544,9 @@
544 544 mp = dp->i_mount;
545 545  
546 546 sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
547   - size = XFS_DIR2_DATA_ENTSIZE(args->namelen);
  547 + size = xfs_dir2_data_entsize(args->namelen);
548 548 offset = XFS_DIR2_DATA_FIRST_OFFSET;
549   - sfep = XFS_DIR2_SF_FIRSTENTRY(sfp);
  549 + sfep = xfs_dir2_sf_firstentry(sfp);
550 550 holefit = 0;
551 551 /*
552 552 * Loop over sf entries.
... ... @@ -555,10 +555,10 @@
555 555 */
556 556 for (i = 0; i < sfp->hdr.count; i++) {
557 557 if (!holefit)
558   - holefit = offset + size <= XFS_DIR2_SF_GET_OFFSET(sfep);
559   - offset = XFS_DIR2_SF_GET_OFFSET(sfep) +
560   - XFS_DIR2_DATA_ENTSIZE(sfep->namelen);
561   - sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep);
  558 + holefit = offset + size <= xfs_dir2_sf_get_offset(sfep);
  559 + offset = xfs_dir2_sf_get_offset(sfep) +
  560 + xfs_dir2_data_entsize(sfep->namelen);
  561 + sfep = xfs_dir2_sf_nextentry(sfp, sfep);
562 562 }
563 563 /*
564 564 * Calculate data bytes used excluding the new entry, if this
565 565  
566 566  
567 567  
... ... @@ -617,18 +617,18 @@
617 617  
618 618 sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
619 619 offset = XFS_DIR2_DATA_FIRST_OFFSET;
620   - ino = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent);
  620 + ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
621 621 i8count = ino > XFS_DIR2_MAX_SHORT_INUM;
622 622  
623   - for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp);
  623 + for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp);
624 624 i < sfp->hdr.count;
625   - i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) {
626   - ASSERT(XFS_DIR2_SF_GET_OFFSET(sfep) >= offset);
627   - ino = XFS_DIR2_SF_GET_INUMBER(sfp, XFS_DIR2_SF_INUMBERP(sfep));
  625 + i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
  626 + ASSERT(xfs_dir2_sf_get_offset(sfep) >= offset);
  627 + ino = xfs_dir2_sf_get_inumber(sfp, xfs_dir2_sf_inumberp(sfep));
628 628 i8count += ino > XFS_DIR2_MAX_SHORT_INUM;
629 629 offset =
630   - XFS_DIR2_SF_GET_OFFSET(sfep) +
631   - XFS_DIR2_DATA_ENTSIZE(sfep->namelen);
  630 + xfs_dir2_sf_get_offset(sfep) +
  631 + xfs_dir2_data_entsize(sfep->namelen);
632 632 }
633 633 ASSERT(i8count == sfp->hdr.i8count);
634 634 ASSERT(XFS_BIG_INUMS || i8count == 0);
... ... @@ -671,7 +671,7 @@
671 671 ASSERT(dp->i_df.if_flags & XFS_IFINLINE);
672 672 ASSERT(dp->i_df.if_bytes == 0);
673 673 i8count = pino > XFS_DIR2_MAX_SHORT_INUM;
674   - size = XFS_DIR2_SF_HDR_SIZE(i8count);
  674 + size = xfs_dir2_sf_hdr_size(i8count);
675 675 /*
676 676 * Make a buffer for the data.
677 677 */
... ... @@ -684,7 +684,7 @@
684 684 /*
685 685 * Now can put in the inode number, since i8count is set.
686 686 */
687   - XFS_DIR2_SF_PUT_INUMBER(sfp, &pino, &sfp->hdr.parent);
  687 + xfs_dir2_sf_put_inumber(sfp, &pino, &sfp->hdr.parent);
688 688 sfp->hdr.count = 0;
689 689 dp->i_d.di_size = size;
690 690 xfs_dir2_sf_check(args);
691 691  
... ... @@ -727,12 +727,12 @@
727 727  
728 728 sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
729 729  
730   - ASSERT(dp->i_d.di_size >= XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count));
  730 + ASSERT(dp->i_d.di_size >= xfs_dir2_sf_hdr_size(sfp->hdr.i8count));
731 731  
732 732 /*
733 733 * If the block number in the offset is out of range, we're done.
734 734 */
735   - if (XFS_DIR2_DATAPTR_TO_DB(mp, dir_offset) > mp->m_dirdatablk) {
  735 + if (xfs_dir2_dataptr_to_db(mp, dir_offset) > mp->m_dirdatablk) {
736 736 *eofp = 1;
737 737 return 0;
738 738 }
739 739  
... ... @@ -747,9 +747,9 @@
747 747 * Put . entry unless we're starting past it.
748 748 */
749 749 if (dir_offset <=
750   - XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
  750 + xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
751 751 XFS_DIR2_DATA_DOT_OFFSET)) {
752   - p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, 0,
  752 + p.cook = xfs_dir2_db_off_to_dataptr(mp, 0,
753 753 XFS_DIR2_DATA_DOTDOT_OFFSET);
754 754 p.ino = dp->i_ino;
755 755 #if XFS_BIG_INUMS
... ... @@ -762,7 +762,7 @@
762 762  
763 763 if (!p.done) {
764 764 uio->uio_offset =
765   - XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
  765 + xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
766 766 XFS_DIR2_DATA_DOT_OFFSET);
767 767 return error;
768 768 }
769 769  
770 770  
... ... @@ -772,11 +772,11 @@
772 772 * Put .. entry unless we're starting past it.
773 773 */
774 774 if (dir_offset <=
775   - XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
  775 + xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
776 776 XFS_DIR2_DATA_DOTDOT_OFFSET)) {
777   - p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
  777 + p.cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
778 778 XFS_DIR2_DATA_FIRST_OFFSET);
779   - p.ino = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent);
  779 + p.ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
780 780 #if XFS_BIG_INUMS
781 781 p.ino += mp->m_inoadd;
782 782 #endif
... ... @@ -787,7 +787,7 @@
787 787  
788 788 if (!p.done) {
789 789 uio->uio_offset =
790   - XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
  790 + xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
791 791 XFS_DIR2_DATA_DOTDOT_OFFSET);
792 792 return error;
793 793 }
794 794  
795 795  
796 796  
797 797  
... ... @@ -796,23 +796,23 @@
796 796 /*
797 797 * Loop while there are more entries and put'ing works.
798 798 */
799   - for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp);
  799 + for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp);
800 800 i < sfp->hdr.count;
801   - i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) {
  801 + i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
802 802  
803   - off = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
804   - XFS_DIR2_SF_GET_OFFSET(sfep));
  803 + off = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
  804 + xfs_dir2_sf_get_offset(sfep));
805 805  
806 806 if (dir_offset > off)
807 807 continue;
808 808  
809 809 p.namelen = sfep->namelen;
810 810  
811   - p.cook = XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk,
812   - XFS_DIR2_SF_GET_OFFSET(sfep) +
813   - XFS_DIR2_DATA_ENTSIZE(p.namelen));
  811 + p.cook = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk,
  812 + xfs_dir2_sf_get_offset(sfep) +
  813 + xfs_dir2_data_entsize(p.namelen));
814 814  
815   - p.ino = XFS_DIR2_SF_GET_INUMBER(sfp, XFS_DIR2_SF_INUMBERP(sfep));
  815 + p.ino = xfs_dir2_sf_get_inumber(sfp, xfs_dir2_sf_inumberp(sfep));
816 816 #if XFS_BIG_INUMS
817 817 p.ino += mp->m_inoadd;
818 818 #endif
... ... @@ -832,7 +832,7 @@
832 832 *eofp = 1;
833 833  
834 834 uio->uio_offset =
835   - XFS_DIR2_DB_OFF_TO_DATAPTR(mp, mp->m_dirdatablk + 1, 0);
  835 + xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0);
836 836  
837 837 return 0;
838 838 }
... ... @@ -865,7 +865,7 @@
865 865 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size);
866 866 ASSERT(dp->i_df.if_u1.if_data != NULL);
867 867 sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
868   - ASSERT(dp->i_d.di_size >= XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count));
  868 + ASSERT(dp->i_d.di_size >= xfs_dir2_sf_hdr_size(sfp->hdr.i8count));
869 869 /*
870 870 * Special case for .
871 871 */
872 872  
873 873  
874 874  
... ... @@ -878,21 +878,21 @@
878 878 */
879 879 if (args->namelen == 2 &&
880 880 args->name[0] == '.' && args->name[1] == '.') {
881   - args->inumber = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent);
  881 + args->inumber = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
882 882 return XFS_ERROR(EEXIST);
883 883 }
884 884 /*
885 885 * Loop over all the entries trying to match ours.
886 886 */
887   - for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp);
  887 + for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp);
888 888 i < sfp->hdr.count;
889   - i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) {
  889 + i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
890 890 if (sfep->namelen == args->namelen &&
891 891 sfep->name[0] == args->name[0] &&
892 892 memcmp(args->name, sfep->name, args->namelen) == 0) {
893 893 args->inumber =
894   - XFS_DIR2_SF_GET_INUMBER(sfp,
895   - XFS_DIR2_SF_INUMBERP(sfep));
  894 + xfs_dir2_sf_get_inumber(sfp,
  895 + xfs_dir2_sf_inumberp(sfep));
896 896 return XFS_ERROR(EEXIST);
897 897 }
898 898 }
899 899  
900 900  
901 901  
... ... @@ -934,19 +934,19 @@
934 934 ASSERT(dp->i_df.if_bytes == oldsize);
935 935 ASSERT(dp->i_df.if_u1.if_data != NULL);
936 936 sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
937   - ASSERT(oldsize >= XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count));
  937 + ASSERT(oldsize >= xfs_dir2_sf_hdr_size(sfp->hdr.i8count));
938 938 /*
939 939 * Loop over the old directory entries.
940 940 * Find the one we're deleting.
941 941 */
942   - for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp);
  942 + for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp);
943 943 i < sfp->hdr.count;
944   - i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) {
  944 + i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
945 945 if (sfep->namelen == args->namelen &&
946 946 sfep->name[0] == args->name[0] &&
947 947 memcmp(sfep->name, args->name, args->namelen) == 0) {
948   - ASSERT(XFS_DIR2_SF_GET_INUMBER(sfp,
949   - XFS_DIR2_SF_INUMBERP(sfep)) ==
  948 + ASSERT(xfs_dir2_sf_get_inumber(sfp,
  949 + xfs_dir2_sf_inumberp(sfep)) ==
950 950 args->inumber);
951 951 break;
952 952 }
... ... @@ -961,7 +961,7 @@
961 961 * Calculate sizes.
962 962 */
963 963 byteoff = (int)((char *)sfep - (char *)sfp);
964   - entsize = XFS_DIR2_SF_ENTSIZE_BYNAME(sfp, args->namelen);
  964 + entsize = xfs_dir2_sf_entsize_byname(sfp, args->namelen);
965 965 newsize = oldsize - entsize;
966 966 /*
967 967 * Copy the part if any after the removed entry, sliding it down.
... ... @@ -1027,7 +1027,7 @@
1027 1027 ASSERT(dp->i_df.if_bytes == dp->i_d.di_size);
1028 1028 ASSERT(dp->i_df.if_u1.if_data != NULL);
1029 1029 sfp = (xfs_dir2_sf_t *)dp->i_df.if_u1.if_data;
1030   - ASSERT(dp->i_d.di_size >= XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count));
  1030 + ASSERT(dp->i_d.di_size >= xfs_dir2_sf_hdr_size(sfp->hdr.i8count));
1031 1031 #if XFS_BIG_INUMS
1032 1032 /*
1033 1033 * New inode number is large, and need to convert to 8-byte inodes.
1034 1034  
1035 1035  
1036 1036  
1037 1037  
1038 1038  
... ... @@ -1067,28 +1067,28 @@
1067 1067 if (args->namelen == 2 &&
1068 1068 args->name[0] == '.' && args->name[1] == '.') {
1069 1069 #if XFS_BIG_INUMS || defined(DEBUG)
1070   - ino = XFS_DIR2_SF_GET_INUMBER(sfp, &sfp->hdr.parent);
  1070 + ino = xfs_dir2_sf_get_inumber(sfp, &sfp->hdr.parent);
1071 1071 ASSERT(args->inumber != ino);
1072 1072 #endif
1073   - XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber, &sfp->hdr.parent);
  1073 + xfs_dir2_sf_put_inumber(sfp, &args->inumber, &sfp->hdr.parent);
1074 1074 }
1075 1075 /*
1076 1076 * Normal entry, look for the name.
1077 1077 */
1078 1078 else {
1079   - for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp);
  1079 + for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp);
1080 1080 i < sfp->hdr.count;
1081   - i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep)) {
  1081 + i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep)) {
1082 1082 if (sfep->namelen == args->namelen &&
1083 1083 sfep->name[0] == args->name[0] &&
1084 1084 memcmp(args->name, sfep->name, args->namelen) == 0) {
1085 1085 #if XFS_BIG_INUMS || defined(DEBUG)
1086   - ino = XFS_DIR2_SF_GET_INUMBER(sfp,
1087   - XFS_DIR2_SF_INUMBERP(sfep));
  1086 + ino = xfs_dir2_sf_get_inumber(sfp,
  1087 + xfs_dir2_sf_inumberp(sfep));
1088 1088 ASSERT(args->inumber != ino);
1089 1089 #endif
1090   - XFS_DIR2_SF_PUT_INUMBER(sfp, &args->inumber,
1091   - XFS_DIR2_SF_INUMBERP(sfep));
  1090 + xfs_dir2_sf_put_inumber(sfp, &args->inumber,
  1091 + xfs_dir2_sf_inumberp(sfep));
1092 1092 break;
1093 1093 }
1094 1094 }
1095 1095  
1096 1096  
1097 1097  
... ... @@ -1189,22 +1189,22 @@
1189 1189 */
1190 1190 sfp->hdr.count = oldsfp->hdr.count;
1191 1191 sfp->hdr.i8count = 0;
1192   - ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, &oldsfp->hdr.parent);
1193   - XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, &sfp->hdr.parent);
  1192 + ino = xfs_dir2_sf_get_inumber(oldsfp, &oldsfp->hdr.parent);
  1193 + xfs_dir2_sf_put_inumber(sfp, &ino, &sfp->hdr.parent);
1194 1194 /*
1195 1195 * Copy the entries field by field.
1196 1196 */
1197   - for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp),
1198   - oldsfep = XFS_DIR2_SF_FIRSTENTRY(oldsfp);
  1197 + for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp),
  1198 + oldsfep = xfs_dir2_sf_firstentry(oldsfp);
1199 1199 i < sfp->hdr.count;
1200   - i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep),
1201   - oldsfep = XFS_DIR2_SF_NEXTENTRY(oldsfp, oldsfep)) {
  1200 + i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep),
  1201 + oldsfep = xfs_dir2_sf_nextentry(oldsfp, oldsfep)) {
1202 1202 sfep->namelen = oldsfep->namelen;
1203 1203 sfep->offset = oldsfep->offset;
1204 1204 memcpy(sfep->name, oldsfep->name, sfep->namelen);
1205   - ino = XFS_DIR2_SF_GET_INUMBER(oldsfp,
1206   - XFS_DIR2_SF_INUMBERP(oldsfep));
1207   - XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep));
  1205 + ino = xfs_dir2_sf_get_inumber(oldsfp,
  1206 + xfs_dir2_sf_inumberp(oldsfep));
  1207 + xfs_dir2_sf_put_inumber(sfp, &ino, xfs_dir2_sf_inumberp(sfep));
1208 1208 }
1209 1209 /*
1210 1210 * Clean up the inode.
1211 1211  
1212 1212  
1213 1213  
... ... @@ -1266,22 +1266,22 @@
1266 1266 */
1267 1267 sfp->hdr.count = oldsfp->hdr.count;
1268 1268 sfp->hdr.i8count = 1;
1269   - ino = XFS_DIR2_SF_GET_INUMBER(oldsfp, &oldsfp->hdr.parent);
1270   - XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, &sfp->hdr.parent);
  1269 + ino = xfs_dir2_sf_get_inumber(oldsfp, &oldsfp->hdr.parent);
  1270 + xfs_dir2_sf_put_inumber(sfp, &ino, &sfp->hdr.parent);
1271 1271 /*
1272 1272 * Copy the entries field by field.
1273 1273 */
1274   - for (i = 0, sfep = XFS_DIR2_SF_FIRSTENTRY(sfp),
1275   - oldsfep = XFS_DIR2_SF_FIRSTENTRY(oldsfp);
  1274 + for (i = 0, sfep = xfs_dir2_sf_firstentry(sfp),
  1275 + oldsfep = xfs_dir2_sf_firstentry(oldsfp);
1276 1276 i < sfp->hdr.count;
1277   - i++, sfep = XFS_DIR2_SF_NEXTENTRY(sfp, sfep),
1278   - oldsfep = XFS_DIR2_SF_NEXTENTRY(oldsfp, oldsfep)) {
  1277 + i++, sfep = xfs_dir2_sf_nextentry(sfp, sfep),
  1278 + oldsfep = xfs_dir2_sf_nextentry(oldsfp, oldsfep)) {
1279 1279 sfep->namelen = oldsfep->namelen;
1280 1280 sfep->offset = oldsfep->offset;
1281 1281 memcpy(sfep->name, oldsfep->name, sfep->namelen);
1282   - ino = XFS_DIR2_SF_GET_INUMBER(oldsfp,
1283   - XFS_DIR2_SF_INUMBERP(oldsfep));
1284   - XFS_DIR2_SF_PUT_INUMBER(sfp, &ino, XFS_DIR2_SF_INUMBERP(sfep));
  1282 + ino = xfs_dir2_sf_get_inumber(oldsfp,
  1283 + xfs_dir2_sf_inumberp(oldsfep));
  1284 + xfs_dir2_sf_put_inumber(sfp, &ino, xfs_dir2_sf_inumberp(sfep));
1285 1285 }
1286 1286 /*
1287 1287 * Clean up the inode.
fs/xfs/xfs_dir2_sf.h
... ... @@ -90,7 +90,6 @@
90 90 xfs_dir2_sf_entry_t list[1]; /* shortform entries */
91 91 } xfs_dir2_sf_t;
92 92  
93   -#define XFS_DIR2_SF_HDR_SIZE(i8count) xfs_dir2_sf_hdr_size(i8count)
94 93 static inline int xfs_dir2_sf_hdr_size(int i8count)
95 94 {
96 95 return ((uint)sizeof(xfs_dir2_sf_hdr_t) - \
97 96  
... ... @@ -98,14 +97,11 @@
98 97 ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t)));
99 98 }
100 99  
101   -#define XFS_DIR2_SF_INUMBERP(sfep) xfs_dir2_sf_inumberp(sfep)
102 100 static inline xfs_dir2_inou_t *xfs_dir2_sf_inumberp(xfs_dir2_sf_entry_t *sfep)
103 101 {
104 102 return (xfs_dir2_inou_t *)&(sfep)->name[(sfep)->namelen];
105 103 }
106 104  
107   -#define XFS_DIR2_SF_GET_INUMBER(sfp, from) \
108   - xfs_dir2_sf_get_inumber(sfp, from)
109 105 static inline xfs_intino_t
110 106 xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp, xfs_dir2_inou_t *from)
111 107 {
... ... @@ -114,8 +110,6 @@
114 110 (xfs_intino_t)XFS_GET_DIR_INO8((from)->i8));
115 111 }
116 112  
117   -#define XFS_DIR2_SF_PUT_INUMBER(sfp,from,to) \
118   - xfs_dir2_sf_put_inumber(sfp,from,to)
119 113 static inline void xfs_dir2_sf_put_inumber(xfs_dir2_sf_t *sfp, xfs_ino_t *from,
120 114 xfs_dir2_inou_t *to)
121 115 {
122 116  
123 117  
... ... @@ -125,24 +119,18 @@
125 119 XFS_PUT_DIR_INO8(*(from), (to)->i8);
126 120 }
127 121  
128   -#define XFS_DIR2_SF_GET_OFFSET(sfep) \
129   - xfs_dir2_sf_get_offset(sfep)
130 122 static inline xfs_dir2_data_aoff_t
131 123 xfs_dir2_sf_get_offset(xfs_dir2_sf_entry_t *sfep)
132 124 {
133 125 return INT_GET_UNALIGNED_16_BE(&(sfep)->offset.i);
134 126 }
135 127  
136   -#define XFS_DIR2_SF_PUT_OFFSET(sfep,off) \
137   - xfs_dir2_sf_put_offset(sfep,off)
138 128 static inline void
139 129 xfs_dir2_sf_put_offset(xfs_dir2_sf_entry_t *sfep, xfs_dir2_data_aoff_t off)
140 130 {
141 131 INT_SET_UNALIGNED_16_BE(&(sfep)->offset.i, off);
142 132 }
143 133  
144   -#define XFS_DIR2_SF_ENTSIZE_BYNAME(sfp,len) \
145   - xfs_dir2_sf_entsize_byname(sfp,len)
146 134 static inline int xfs_dir2_sf_entsize_byname(xfs_dir2_sf_t *sfp, int len)
147 135 {
148 136 return ((uint)sizeof(xfs_dir2_sf_entry_t) - 1 + (len) - \
... ... @@ -150,8 +138,6 @@
150 138 ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t)));
151 139 }
152 140  
153   -#define XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep) \
154   - xfs_dir2_sf_entsize_byentry(sfp,sfep)
155 141 static inline int
156 142 xfs_dir2_sf_entsize_byentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep)
157 143 {
158 144  
159 145  
160 146  
... ... @@ -160,19 +146,17 @@
160 146 ((uint)sizeof(xfs_dir2_ino8_t) - (uint)sizeof(xfs_dir2_ino4_t)));
161 147 }
162 148  
163   -#define XFS_DIR2_SF_FIRSTENTRY(sfp) xfs_dir2_sf_firstentry(sfp)
164 149 static inline xfs_dir2_sf_entry_t *xfs_dir2_sf_firstentry(xfs_dir2_sf_t *sfp)
165 150 {
166 151 return ((xfs_dir2_sf_entry_t *) \
167   - ((char *)(sfp) + XFS_DIR2_SF_HDR_SIZE(sfp->hdr.i8count)));
  152 + ((char *)(sfp) + xfs_dir2_sf_hdr_size(sfp->hdr.i8count)));
168 153 }
169 154  
170   -#define XFS_DIR2_SF_NEXTENTRY(sfp,sfep) xfs_dir2_sf_nextentry(sfp,sfep)
171 155 static inline xfs_dir2_sf_entry_t *
172 156 xfs_dir2_sf_nextentry(xfs_dir2_sf_t *sfp, xfs_dir2_sf_entry_t *sfep)
173 157 {
174 158 return ((xfs_dir2_sf_entry_t *) \
175   - ((char *)(sfep) + XFS_DIR2_SF_ENTSIZE_BYENTRY(sfp,sfep)));
  159 + ((char *)(sfep) + xfs_dir2_sf_entsize_byentry(sfp,sfep)));
176 160 }
177 161  
178 162 /*