diff options
Diffstat (limited to 'fs/xfs/xfs_dir2_node.c')
-rw-r--r-- | fs/xfs/xfs_dir2_node.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c index d083c3819934..91c61d9632c8 100644 --- a/fs/xfs/xfs_dir2_node.c +++ b/fs/xfs/xfs_dir2_node.c | |||
@@ -136,14 +136,14 @@ xfs_dir2_leaf_to_node( | |||
136 | /* | 136 | /* |
137 | * Get the buffer for the new freespace block. | 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 | XFS_DATA_FORK))) { | 140 | XFS_DATA_FORK))) { |
141 | return error; | 141 | return error; |
142 | } | 142 | } |
143 | ASSERT(fbp != NULL); | 143 | ASSERT(fbp != NULL); |
144 | free = fbp->data; | 144 | free = fbp->data; |
145 | leaf = lbp->data; | 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 | * Initialize the freespace block header. | 148 | * Initialize the freespace block header. |
149 | */ | 149 | */ |
@@ -155,7 +155,7 @@ xfs_dir2_leaf_to_node( | |||
155 | * Copy freespace entries from the leaf block to the new block. | 155 | * Copy freespace entries from the leaf block to the new block. |
156 | * Count active entries. | 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 | i < be32_to_cpu(ltp->bestcount); i++, from++, to++) { | 159 | i < be32_to_cpu(ltp->bestcount); i++, from++, to++) { |
160 | if ((off = be16_to_cpu(*from)) != NULLDATAOFF) | 160 | if ((off = be16_to_cpu(*from)) != NULLDATAOFF) |
161 | n++; | 161 | n++; |
@@ -215,7 +215,7 @@ xfs_dir2_leafn_add( | |||
215 | * a compact. | 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 | if (!leaf->hdr.stale) | 219 | if (!leaf->hdr.stale) |
220 | return XFS_ERROR(ENOSPC); | 220 | return XFS_ERROR(ENOSPC); |
221 | compact = be16_to_cpu(leaf->hdr.stale) > 1; | 221 | compact = be16_to_cpu(leaf->hdr.stale) > 1; |
@@ -327,7 +327,7 @@ xfs_dir2_leafn_add( | |||
327 | * Insert the new entry, log everything. | 327 | * Insert the new entry, log everything. |
328 | */ | 328 | */ |
329 | lep->hashval = cpu_to_be32(args->hashval); | 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 | args->blkno, args->index)); | 331 | args->blkno, args->index)); |
332 | xfs_dir2_leaf_log_header(tp, bp); | 332 | xfs_dir2_leaf_log_header(tp, bp); |
333 | xfs_dir2_leaf_log_ents(tp, bp, lfloglow, lfloghigh); | 333 | xfs_dir2_leaf_log_ents(tp, bp, lfloglow, lfloghigh); |
@@ -352,7 +352,7 @@ xfs_dir2_leafn_check( | |||
352 | leaf = bp->data; | 352 | leaf = bp->data; |
353 | mp = dp->i_mount; | 353 | mp = dp->i_mount; |
354 | ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); | 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 | for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) { | 356 | for (i = stale = 0; i < be16_to_cpu(leaf->hdr.count); i++) { |
357 | if (i + 1 < be16_to_cpu(leaf->hdr.count)) { | 357 | if (i + 1 < be16_to_cpu(leaf->hdr.count)) { |
358 | ASSERT(be32_to_cpu(leaf->ents[i].hashval) <= | 358 | ASSERT(be32_to_cpu(leaf->ents[i].hashval) <= |
@@ -440,7 +440,7 @@ xfs_dir2_leafn_lookup_int( | |||
440 | if (args->addname) { | 440 | if (args->addname) { |
441 | curfdb = curbp ? state->extrablk.blkno : -1; | 441 | curfdb = curbp ? state->extrablk.blkno : -1; |
442 | curdb = -1; | 442 | curdb = -1; |
443 | length = XFS_DIR2_DATA_ENTSIZE(args->namelen); | 443 | length = xfs_dir2_data_entsize(args->namelen); |
444 | if ((free = (curbp ? curbp->data : NULL))) | 444 | if ((free = (curbp ? curbp->data : NULL))) |
445 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); | 445 | ASSERT(be32_to_cpu(free->hdr.magic) == XFS_DIR2_FREE_MAGIC); |
446 | } | 446 | } |
@@ -465,7 +465,7 @@ xfs_dir2_leafn_lookup_int( | |||
465 | /* | 465 | /* |
466 | * Pull the data block number from the entry. | 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 | * For addname, we're looking for a place to put the new entry. | 470 | * For addname, we're looking for a place to put the new entry. |
471 | * We want to use a data block with an entry of equal | 471 | * We want to use a data block with an entry of equal |
@@ -482,7 +482,7 @@ xfs_dir2_leafn_lookup_int( | |||
482 | * Convert the data block to the free block | 482 | * Convert the data block to the free block |
483 | * holding its freespace information. | 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 | * If it's not the one we have in hand, | 487 | * If it's not the one we have in hand, |
488 | * read it in. | 488 | * read it in. |
@@ -497,7 +497,7 @@ xfs_dir2_leafn_lookup_int( | |||
497 | * Read the free block. | 497 | * Read the free block. |
498 | */ | 498 | */ |
499 | if ((error = xfs_da_read_buf(tp, dp, | 499 | if ((error = xfs_da_read_buf(tp, dp, |
500 | XFS_DIR2_DB_TO_DA(mp, | 500 | xfs_dir2_db_to_da(mp, |
501 | newfdb), | 501 | newfdb), |
502 | -1, &curbp, | 502 | -1, &curbp, |
503 | XFS_DATA_FORK))) { | 503 | XFS_DATA_FORK))) { |
@@ -517,7 +517,7 @@ xfs_dir2_leafn_lookup_int( | |||
517 | /* | 517 | /* |
518 | * Get the index for our entry. | 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 | * If it has room, return it. | 522 | * If it has room, return it. |
523 | */ | 523 | */ |
@@ -561,7 +561,7 @@ xfs_dir2_leafn_lookup_int( | |||
561 | */ | 561 | */ |
562 | if ((error = | 562 | if ((error = |
563 | xfs_da_read_buf(tp, dp, | 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 | &curbp, XFS_DATA_FORK))) { | 565 | &curbp, XFS_DATA_FORK))) { |
566 | return error; | 566 | return error; |
567 | } | 567 | } |
@@ -573,7 +573,7 @@ xfs_dir2_leafn_lookup_int( | |||
573 | */ | 573 | */ |
574 | dep = (xfs_dir2_data_entry_t *) | 574 | dep = (xfs_dir2_data_entry_t *) |
575 | ((char *)curbp->data + | 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 | * Compare the entry, return it if it matches. | 578 | * Compare the entry, return it if it matches. |
579 | */ | 579 | */ |
@@ -876,9 +876,9 @@ xfs_dir2_leafn_remove( | |||
876 | /* | 876 | /* |
877 | * Extract the data block and offset from the entry. | 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 | ASSERT(dblk->blkno == db); | 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 | ASSERT(dblk->index == off); | 882 | ASSERT(dblk->index == off); |
883 | /* | 883 | /* |
884 | * Kill the leaf entry by marking it stale. | 884 | * Kill the leaf entry by marking it stale. |
@@ -898,7 +898,7 @@ xfs_dir2_leafn_remove( | |||
898 | longest = be16_to_cpu(data->hdr.bestfree[0].length); | 898 | longest = be16_to_cpu(data->hdr.bestfree[0].length); |
899 | needlog = needscan = 0; | 899 | needlog = needscan = 0; |
900 | xfs_dir2_data_make_free(tp, dbp, off, | 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 | * Rescan the data block freespaces for bestfree. | 903 | * Rescan the data block freespaces for bestfree. |
904 | * Log the data block header if needed. | 904 | * Log the data block header if needed. |
@@ -924,8 +924,8 @@ xfs_dir2_leafn_remove( | |||
924 | * Convert the data block number to a free block, | 924 | * Convert the data block number to a free block, |
925 | * read in the free block. | 925 | * read in the free block. |
926 | */ | 926 | */ |
927 | fdb = XFS_DIR2_DB_TO_FDB(mp, db); | 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), | 928 | if ((error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, fdb), |
929 | -1, &fbp, XFS_DATA_FORK))) { | 929 | -1, &fbp, XFS_DATA_FORK))) { |
930 | return error; | 930 | return error; |
931 | } | 931 | } |
@@ -937,7 +937,7 @@ xfs_dir2_leafn_remove( | |||
937 | /* | 937 | /* |
938 | * Calculate which entry we need to fix. | 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 | longest = be16_to_cpu(data->hdr.bestfree[0].length); | 941 | longest = be16_to_cpu(data->hdr.bestfree[0].length); |
942 | /* | 942 | /* |
943 | * If the data block is now empty we can get rid of it | 943 | * If the data block is now empty we can get rid of it |
@@ -1073,7 +1073,7 @@ xfs_dir2_leafn_split( | |||
1073 | /* | 1073 | /* |
1074 | * Initialize the new leaf block. | 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 | &newblk->bp, XFS_DIR2_LEAFN_MAGIC); | 1077 | &newblk->bp, XFS_DIR2_LEAFN_MAGIC); |
1078 | if (error) { | 1078 | if (error) { |
1079 | return error; | 1079 | return error; |
@@ -1385,7 +1385,7 @@ xfs_dir2_node_addname_int( | |||
1385 | dp = args->dp; | 1385 | dp = args->dp; |
1386 | mp = dp->i_mount; | 1386 | mp = dp->i_mount; |
1387 | tp = args->trans; | 1387 | tp = args->trans; |
1388 | length = XFS_DIR2_DATA_ENTSIZE(args->namelen); | 1388 | length = xfs_dir2_data_entsize(args->namelen); |
1389 | /* | 1389 | /* |
1390 | * If we came in with a freespace block that means that lookup | 1390 | * If we came in with a freespace block that means that lookup |
1391 | * found an entry with our hash value. This is the freespace | 1391 | * found an entry with our hash value. This is the freespace |
@@ -1438,7 +1438,7 @@ xfs_dir2_node_addname_int( | |||
1438 | 1438 | ||
1439 | if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK))) | 1439 | if ((error = xfs_bmap_last_offset(tp, dp, &fo, XFS_DATA_FORK))) |
1440 | return error; | 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 | fbno = ifbno; | 1442 | fbno = ifbno; |
1443 | } | 1443 | } |
1444 | /* | 1444 | /* |
@@ -1474,7 +1474,7 @@ xfs_dir2_node_addname_int( | |||
1474 | * to avoid it. | 1474 | * to avoid it. |
1475 | */ | 1475 | */ |
1476 | if ((error = xfs_da_read_buf(tp, dp, | 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 | XFS_DATA_FORK))) { | 1478 | XFS_DATA_FORK))) { |
1479 | return error; | 1479 | return error; |
1480 | } | 1480 | } |
@@ -1550,9 +1550,9 @@ xfs_dir2_node_addname_int( | |||
1550 | * Get the freespace block corresponding to the data block | 1550 | * Get the freespace block corresponding to the data block |
1551 | * that was just allocated. | 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 | if (unlikely(error = xfs_da_read_buf(tp, dp, | 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 | XFS_DATA_FORK))) { | 1556 | XFS_DATA_FORK))) { |
1557 | xfs_da_buf_done(dbp); | 1557 | xfs_da_buf_done(dbp); |
1558 | return error; | 1558 | return error; |
@@ -1567,14 +1567,14 @@ xfs_dir2_node_addname_int( | |||
1567 | return error; | 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 | cmn_err(CE_ALERT, | 1571 | cmn_err(CE_ALERT, |
1572 | "xfs_dir2_node_addname_int: dir ino " | 1572 | "xfs_dir2_node_addname_int: dir ino " |
1573 | "%llu needed freesp block %lld for\n" | 1573 | "%llu needed freesp block %lld for\n" |
1574 | " data block %lld, got %lld\n" | 1574 | " data block %lld, got %lld\n" |
1575 | " ifbno %llu lastfbno %d\n", | 1575 | " ifbno %llu lastfbno %d\n", |
1576 | (unsigned long long)dp->i_ino, | 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 | (long long)dbno, (long long)fbno, | 1578 | (long long)dbno, (long long)fbno, |
1579 | (unsigned long long)ifbno, lastfbno); | 1579 | (unsigned long long)ifbno, lastfbno); |
1580 | if (fblk) { | 1580 | if (fblk) { |
@@ -1598,7 +1598,7 @@ xfs_dir2_node_addname_int( | |||
1598 | * Get a buffer for the new block. | 1598 | * Get a buffer for the new block. |
1599 | */ | 1599 | */ |
1600 | if ((error = xfs_da_get_buf(tp, dp, | 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 | -1, &fbp, XFS_DATA_FORK))) { | 1602 | -1, &fbp, XFS_DATA_FORK))) { |
1603 | return error; | 1603 | return error; |
1604 | } | 1604 | } |
@@ -1623,7 +1623,7 @@ xfs_dir2_node_addname_int( | |||
1623 | /* | 1623 | /* |
1624 | * Set the freespace block index from the data block number. | 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 | * If it's after the end of the current entries in the | 1628 | * If it's after the end of the current entries in the |
1629 | * freespace block, extend that table. | 1629 | * freespace block, extend that table. |
@@ -1669,7 +1669,7 @@ xfs_dir2_node_addname_int( | |||
1669 | * Read the data block in. | 1669 | * Read the data block in. |
1670 | */ | 1670 | */ |
1671 | if (unlikely( | 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 | -1, &dbp, XFS_DATA_FORK))) { | 1673 | -1, &dbp, XFS_DATA_FORK))) { |
1674 | if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL) | 1674 | if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL) |
1675 | xfs_da_buf_done(fbp); | 1675 | xfs_da_buf_done(fbp); |
@@ -1698,7 +1698,7 @@ xfs_dir2_node_addname_int( | |||
1698 | dep->inumber = cpu_to_be64(args->inumber); | 1698 | dep->inumber = cpu_to_be64(args->inumber); |
1699 | dep->namelen = args->namelen; | 1699 | dep->namelen = args->namelen; |
1700 | memcpy(dep->name, args->name, dep->namelen); | 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 | *tagp = cpu_to_be16((char *)dep - (char *)data); | 1702 | *tagp = cpu_to_be16((char *)dep - (char *)data); |
1703 | xfs_dir2_data_log_entry(tp, dbp, dep); | 1703 | xfs_dir2_data_log_entry(tp, dbp, dep); |
1704 | /* | 1704 | /* |
@@ -1904,7 +1904,7 @@ xfs_dir2_node_replace( | |||
1904 | ASSERT(be32_to_cpu(data->hdr.magic) == XFS_DIR2_DATA_MAGIC); | 1904 | ASSERT(be32_to_cpu(data->hdr.magic) == XFS_DIR2_DATA_MAGIC); |
1905 | dep = (xfs_dir2_data_entry_t *) | 1905 | dep = (xfs_dir2_data_entry_t *) |
1906 | ((char *)data + | 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 | ASSERT(inum != be64_to_cpu(dep->inumber)); | 1908 | ASSERT(inum != be64_to_cpu(dep->inumber)); |
1909 | /* | 1909 | /* |
1910 | * Fill in the new inode number and log the entry. | 1910 | * Fill in the new inode number and log the entry. |
@@ -1980,7 +1980,7 @@ xfs_dir2_node_trim_free( | |||
1980 | * Blow the block away. | 1980 | * Blow the block away. |
1981 | */ | 1981 | */ |
1982 | if ((error = | 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 | bp))) { | 1984 | bp))) { |
1985 | /* | 1985 | /* |
1986 | * Can't fail with ENOSPC since that only happens with no | 1986 | * Can't fail with ENOSPC since that only happens with no |