Commit 1d9025e56143c0c4aebebdb62e46618d3d284218

Authored by Dave Chinner
Committed by Ben Myers
1 parent 3605431fb9

xfs: remove struct xfs_dabuf and infrastructure

The struct xfs_dabuf now only tracks a single xfs_buf and all the
information it holds can be gained directly from the xfs_buf. Hence
we can remove the struct dabuf and pass the xfs_buf around
everywhere.

Kill the struct dabuf and the associated infrastructure.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Myers <bpm@sgi.com>

Showing 13 changed files with 602 additions and 779 deletions Side-by-side Diff

... ... @@ -893,7 +893,7 @@
893 893 xfs_attr_leaf_addname(xfs_da_args_t *args)
894 894 {
895 895 xfs_inode_t *dp;
896   - xfs_dabuf_t *bp;
  896 + struct xfs_buf *bp;
897 897 int retval, error, committed, forkoff;
898 898  
899 899 trace_xfs_attr_leaf_addname(args);
900 900  
... ... @@ -915,11 +915,11 @@
915 915 */
916 916 retval = xfs_attr_leaf_lookup_int(bp, args);
917 917 if ((args->flags & ATTR_REPLACE) && (retval == ENOATTR)) {
918   - xfs_da_brelse(args->trans, bp);
  918 + xfs_trans_brelse(args->trans, bp);
919 919 return(retval);
920 920 } else if (retval == EEXIST) {
921 921 if (args->flags & ATTR_CREATE) { /* pure create op */
922   - xfs_da_brelse(args->trans, bp);
  922 + xfs_trans_brelse(args->trans, bp);
923 923 return(retval);
924 924 }
925 925  
... ... @@ -937,7 +937,6 @@
937 937 * if required.
938 938 */
939 939 retval = xfs_attr_leaf_add(bp, args);
940   - xfs_da_buf_done(bp);
941 940 if (retval == ENOSPC) {
942 941 /*
943 942 * Promote the attribute list to the Btree format, then
... ... @@ -1065,8 +1064,7 @@
1065 1064 */
1066 1065 if (committed)
1067 1066 xfs_trans_ijoin(args->trans, dp, 0);
1068   - } else
1069   - xfs_da_buf_done(bp);
  1067 + }
1070 1068  
1071 1069 /*
1072 1070 * Commit the remove and start the next trans in series.
... ... @@ -1092,7 +1090,7 @@
1092 1090 xfs_attr_leaf_removename(xfs_da_args_t *args)
1093 1091 {
1094 1092 xfs_inode_t *dp;
1095   - xfs_dabuf_t *bp;
  1093 + struct xfs_buf *bp;
1096 1094 int error, committed, forkoff;
1097 1095  
1098 1096 trace_xfs_attr_leaf_removename(args);
... ... @@ -1111,7 +1109,7 @@
1111 1109 ASSERT(bp != NULL);
1112 1110 error = xfs_attr_leaf_lookup_int(bp, args);
1113 1111 if (error == ENOATTR) {
1114   - xfs_da_brelse(args->trans, bp);
  1112 + xfs_trans_brelse(args->trans, bp);
1115 1113 return(error);
1116 1114 }
1117 1115  
... ... @@ -1141,8 +1139,7 @@
1141 1139 */
1142 1140 if (committed)
1143 1141 xfs_trans_ijoin(args->trans, dp, 0);
1144   - } else
1145   - xfs_da_buf_done(bp);
  1142 + }
1146 1143 return(0);
1147 1144 }
1148 1145  
... ... @@ -1155,7 +1152,7 @@
1155 1152 STATIC int
1156 1153 xfs_attr_leaf_get(xfs_da_args_t *args)
1157 1154 {
1158   - xfs_dabuf_t *bp;
  1155 + struct xfs_buf *bp;
1159 1156 int error;
1160 1157  
1161 1158 args->blkno = 0;
1162 1159  
... ... @@ -1167,11 +1164,11 @@
1167 1164  
1168 1165 error = xfs_attr_leaf_lookup_int(bp, args);
1169 1166 if (error != EEXIST) {
1170   - xfs_da_brelse(args->trans, bp);
  1167 + xfs_trans_brelse(args->trans, bp);
1171 1168 return(error);
1172 1169 }
1173 1170 error = xfs_attr_leaf_getvalue(bp, args);
1174   - xfs_da_brelse(args->trans, bp);
  1171 + xfs_trans_brelse(args->trans, bp);
1175 1172 if (!error && (args->rmtblkno > 0) && !(args->flags & ATTR_KERNOVAL)) {
1176 1173 error = xfs_attr_rmtval_get(args);
1177 1174 }
1178 1175  
1179 1176  
1180 1177  
... ... @@ -1186,23 +1183,23 @@
1186 1183 {
1187 1184 xfs_attr_leafblock_t *leaf;
1188 1185 int error;
1189   - xfs_dabuf_t *bp;
  1186 + struct xfs_buf *bp;
1190 1187  
1191 1188 context->cursor->blkno = 0;
1192 1189 error = xfs_da_read_buf(NULL, context->dp, 0, -1, &bp, XFS_ATTR_FORK);
1193 1190 if (error)
1194 1191 return XFS_ERROR(error);
1195 1192 ASSERT(bp != NULL);
1196   - leaf = bp->data;
  1193 + leaf = bp->b_addr;
1197 1194 if (unlikely(leaf->hdr.info.magic != cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) {
1198 1195 XFS_CORRUPTION_ERROR("xfs_attr_leaf_list", XFS_ERRLEVEL_LOW,
1199 1196 context->dp->i_mount, leaf);
1200   - xfs_da_brelse(NULL, bp);
  1197 + xfs_trans_brelse(NULL, bp);
1201 1198 return XFS_ERROR(EFSCORRUPTED);
1202 1199 }
1203 1200  
1204 1201 error = xfs_attr_leaf_list_int(bp, context);
1205   - xfs_da_brelse(NULL, bp);
  1202 + xfs_trans_brelse(NULL, bp);
1206 1203 return XFS_ERROR(error);
1207 1204 }
1208 1205  
... ... @@ -1489,7 +1486,7 @@
1489 1486 xfs_da_state_t *state;
1490 1487 xfs_da_state_blk_t *blk;
1491 1488 xfs_inode_t *dp;
1492   - xfs_dabuf_t *bp;
  1489 + struct xfs_buf *bp;
1493 1490 int retval, error, committed, forkoff;
1494 1491  
1495 1492 trace_xfs_attr_node_removename(args);
1496 1493  
... ... @@ -1601,14 +1598,13 @@
1601 1598 */
1602 1599 ASSERT(state->path.active == 1);
1603 1600 ASSERT(state->path.blk[0].bp);
1604   - xfs_da_buf_done(state->path.blk[0].bp);
1605 1601 state->path.blk[0].bp = NULL;
1606 1602  
1607 1603 error = xfs_da_read_buf(args->trans, args->dp, 0, -1, &bp,
1608 1604 XFS_ATTR_FORK);
1609 1605 if (error)
1610 1606 goto out;
1611   - ASSERT((((xfs_attr_leafblock_t *)bp->data)->hdr.info.magic) ==
  1607 + ASSERT((((xfs_attr_leafblock_t *)bp->b_addr)->hdr.info.magic) ==
1612 1608 cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1613 1609  
1614 1610 if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
... ... @@ -1635,7 +1631,7 @@
1635 1631 if (committed)
1636 1632 xfs_trans_ijoin(args->trans, dp, 0);
1637 1633 } else
1638   - xfs_da_brelse(args->trans, bp);
  1634 + xfs_trans_brelse(args->trans, bp);
1639 1635 }
1640 1636 error = 0;
1641 1637  
... ... @@ -1665,8 +1661,7 @@
1665 1661 ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH));
1666 1662 for (blk = path->blk, level = 0; level < path->active; blk++, level++) {
1667 1663 if (blk->bp) {
1668   - blk->disk_blkno = xfs_da_blkno(blk->bp);
1669   - xfs_da_buf_done(blk->bp);
  1664 + blk->disk_blkno = XFS_BUF_ADDR(blk->bp);
1670 1665 blk->bp = NULL;
1671 1666 } else {
1672 1667 blk->disk_blkno = 0;
... ... @@ -1681,8 +1676,7 @@
1681 1676 ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH));
1682 1677 for (blk = path->blk, level = 0; level < path->active; blk++, level++) {
1683 1678 if (blk->bp) {
1684   - blk->disk_blkno = xfs_da_blkno(blk->bp);
1685   - xfs_da_buf_done(blk->bp);
  1679 + blk->disk_blkno = XFS_BUF_ADDR(blk->bp);
1686 1680 blk->bp = NULL;
1687 1681 } else {
1688 1682 blk->disk_blkno = 0;
... ... @@ -1792,7 +1786,7 @@
1792 1786 * If not in a transaction, we have to release all the buffers.
1793 1787 */
1794 1788 for (i = 0; i < state->path.active; i++) {
1795   - xfs_da_brelse(args->trans, state->path.blk[i].bp);
  1789 + xfs_trans_brelse(args->trans, state->path.blk[i].bp);
1796 1790 state->path.blk[i].bp = NULL;
1797 1791 }
1798 1792  
... ... @@ -1808,7 +1802,7 @@
1808 1802 xfs_da_intnode_t *node;
1809 1803 xfs_da_node_entry_t *btree;
1810 1804 int error, i;
1811   - xfs_dabuf_t *bp;
  1805 + struct xfs_buf *bp;
1812 1806  
1813 1807 cursor = context->cursor;
1814 1808 cursor->initted = 1;
1815 1809  
1816 1810  
1817 1811  
1818 1812  
1819 1813  
... ... @@ -1825,30 +1819,30 @@
1825 1819 if ((error != 0) && (error != EFSCORRUPTED))
1826 1820 return(error);
1827 1821 if (bp) {
1828   - node = bp->data;
  1822 + node = bp->b_addr;
1829 1823 switch (be16_to_cpu(node->hdr.info.magic)) {
1830 1824 case XFS_DA_NODE_MAGIC:
1831 1825 trace_xfs_attr_list_wrong_blk(context);
1832   - xfs_da_brelse(NULL, bp);
  1826 + xfs_trans_brelse(NULL, bp);
1833 1827 bp = NULL;
1834 1828 break;
1835 1829 case XFS_ATTR_LEAF_MAGIC:
1836   - leaf = bp->data;
  1830 + leaf = bp->b_addr;
1837 1831 if (cursor->hashval > be32_to_cpu(leaf->entries[
1838 1832 be16_to_cpu(leaf->hdr.count)-1].hashval)) {
1839 1833 trace_xfs_attr_list_wrong_blk(context);
1840   - xfs_da_brelse(NULL, bp);
  1834 + xfs_trans_brelse(NULL, bp);
1841 1835 bp = NULL;
1842 1836 } else if (cursor->hashval <=
1843 1837 be32_to_cpu(leaf->entries[0].hashval)) {
1844 1838 trace_xfs_attr_list_wrong_blk(context);
1845   - xfs_da_brelse(NULL, bp);
  1839 + xfs_trans_brelse(NULL, bp);
1846 1840 bp = NULL;
1847 1841 }
1848 1842 break;
1849 1843 default:
1850 1844 trace_xfs_attr_list_wrong_blk(context);
1851   - xfs_da_brelse(NULL, bp);
  1845 + xfs_trans_brelse(NULL, bp);
1852 1846 bp = NULL;
1853 1847 }
1854 1848 }
... ... @@ -1873,7 +1867,7 @@
1873 1867 context->dp->i_mount);
1874 1868 return(XFS_ERROR(EFSCORRUPTED));
1875 1869 }
1876   - node = bp->data;
  1870 + node = bp->b_addr;
1877 1871 if (node->hdr.info.magic ==
1878 1872 cpu_to_be16(XFS_ATTR_LEAF_MAGIC))
1879 1873 break;
... ... @@ -1883,7 +1877,7 @@
1883 1877 XFS_ERRLEVEL_LOW,
1884 1878 context->dp->i_mount,
1885 1879 node);
1886   - xfs_da_brelse(NULL, bp);
  1880 + xfs_trans_brelse(NULL, bp);
1887 1881 return(XFS_ERROR(EFSCORRUPTED));
1888 1882 }
1889 1883 btree = node->btree;
1890 1884  
... ... @@ -1898,10 +1892,10 @@
1898 1892 }
1899 1893 }
1900 1894 if (i == be16_to_cpu(node->hdr.count)) {
1901   - xfs_da_brelse(NULL, bp);
  1895 + xfs_trans_brelse(NULL, bp);
1902 1896 return(0);
1903 1897 }
1904   - xfs_da_brelse(NULL, bp);
  1898 + xfs_trans_brelse(NULL, bp);
1905 1899 }
1906 1900 }
1907 1901 ASSERT(bp != NULL);
1908 1902  
1909 1903  
1910 1904  
... ... @@ -1912,24 +1906,24 @@
1912 1906 * adding the information.
1913 1907 */
1914 1908 for (;;) {
1915   - leaf = bp->data;
  1909 + leaf = bp->b_addr;
1916 1910 if (unlikely(leaf->hdr.info.magic !=
1917 1911 cpu_to_be16(XFS_ATTR_LEAF_MAGIC))) {
1918 1912 XFS_CORRUPTION_ERROR("xfs_attr_node_list(4)",
1919 1913 XFS_ERRLEVEL_LOW,
1920 1914 context->dp->i_mount, leaf);
1921   - xfs_da_brelse(NULL, bp);
  1915 + xfs_trans_brelse(NULL, bp);
1922 1916 return(XFS_ERROR(EFSCORRUPTED));
1923 1917 }
1924 1918 error = xfs_attr_leaf_list_int(bp, context);
1925 1919 if (error) {
1926   - xfs_da_brelse(NULL, bp);
  1920 + xfs_trans_brelse(NULL, bp);
1927 1921 return error;
1928 1922 }
1929 1923 if (context->seen_enough || leaf->hdr.info.forw == 0)
1930 1924 break;
1931 1925 cursor->blkno = be32_to_cpu(leaf->hdr.info.forw);
1932   - xfs_da_brelse(NULL, bp);
  1926 + xfs_trans_brelse(NULL, bp);
1933 1927 error = xfs_da_read_buf(NULL, context->dp, cursor->blkno, -1,
1934 1928 &bp, XFS_ATTR_FORK);
1935 1929 if (error)
... ... @@ -1941,7 +1935,7 @@
1941 1935 return(XFS_ERROR(EFSCORRUPTED));
1942 1936 }
1943 1937 }
1944   - xfs_da_brelse(NULL, bp);
  1938 + xfs_trans_brelse(NULL, bp);
1945 1939 return(0);
1946 1940 }
1947 1941  
fs/xfs/xfs_attr_leaf.c
... ... @@ -54,10 +54,10 @@
54 54 * Routines used for growing the Btree.
55 55 */
56 56 STATIC int xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t which_block,
57   - xfs_dabuf_t **bpp);
58   -STATIC int xfs_attr_leaf_add_work(xfs_dabuf_t *leaf_buffer, xfs_da_args_t *args,
59   - int freemap_index);
60   -STATIC void xfs_attr_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *leaf_buffer);
  57 + struct xfs_buf **bpp);
  58 +STATIC int xfs_attr_leaf_add_work(struct xfs_buf *leaf_buffer,
  59 + xfs_da_args_t *args, int freemap_index);
  60 +STATIC void xfs_attr_leaf_compact(xfs_trans_t *tp, struct xfs_buf *leaf_buffer);
61 61 STATIC void xfs_attr_leaf_rebalance(xfs_da_state_t *state,
62 62 xfs_da_state_blk_t *blk1,
63 63 xfs_da_state_blk_t *blk2);
64 64  
... ... @@ -71,9 +71,9 @@
71 71 * Routines used for shrinking the Btree.
72 72 */
73 73 STATIC int xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp,
74   - xfs_dabuf_t *bp, int level);
  74 + struct xfs_buf *bp, int level);
75 75 STATIC int xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp,
76   - xfs_dabuf_t *bp);
  76 + struct xfs_buf *bp);
77 77 STATIC int xfs_attr_leaf_freextent(xfs_trans_t **trans, xfs_inode_t *dp,
78 78 xfs_dablk_t blkno, int blkcnt);
79 79  
... ... @@ -480,7 +480,7 @@
480 480 char *tmpbuffer;
481 481 int error, i, size;
482 482 xfs_dablk_t blkno;
483   - xfs_dabuf_t *bp;
  483 + struct xfs_buf *bp;
484 484 xfs_ifork_t *ifp;
485 485  
486 486 trace_xfs_attr_sf_to_leaf(args);
... ... @@ -550,8 +550,6 @@
550 550 error = 0;
551 551  
552 552 out:
553   - if(bp)
554   - xfs_da_buf_done(bp);
555 553 kmem_free(tmpbuffer);
556 554 return(error);
557 555 }
558 556  
... ... @@ -737,14 +735,16 @@
737 735 * a shortform attribute list.
738 736 */
739 737 int
740   -xfs_attr_shortform_allfit(xfs_dabuf_t *bp, xfs_inode_t *dp)
  738 +xfs_attr_shortform_allfit(
  739 + struct xfs_buf *bp,
  740 + struct xfs_inode *dp)
741 741 {
742 742 xfs_attr_leafblock_t *leaf;
743 743 xfs_attr_leaf_entry_t *entry;
744 744 xfs_attr_leaf_name_local_t *name_loc;
745 745 int bytes, i;
746 746  
747   - leaf = bp->data;
  747 + leaf = bp->b_addr;
748 748 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
749 749  
750 750 entry = &leaf->entries[0];
... ... @@ -774,7 +774,10 @@
774 774 * Convert a leaf attribute list to shortform attribute list
775 775 */
776 776 int
777   -xfs_attr_leaf_to_shortform(xfs_dabuf_t *bp, xfs_da_args_t *args, int forkoff)
  777 +xfs_attr_leaf_to_shortform(
  778 + struct xfs_buf *bp,
  779 + xfs_da_args_t *args,
  780 + int forkoff)
778 781 {
779 782 xfs_attr_leafblock_t *leaf;
780 783 xfs_attr_leaf_entry_t *entry;
781 784  
... ... @@ -791,10 +794,10 @@
791 794 ASSERT(tmpbuffer != NULL);
792 795  
793 796 ASSERT(bp != NULL);
794   - memcpy(tmpbuffer, bp->data, XFS_LBSIZE(dp->i_mount));
  797 + memcpy(tmpbuffer, bp->b_addr, XFS_LBSIZE(dp->i_mount));
795 798 leaf = (xfs_attr_leafblock_t *)tmpbuffer;
796 799 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
797   - memset(bp->data, 0, XFS_LBSIZE(dp->i_mount));
  800 + memset(bp->b_addr, 0, XFS_LBSIZE(dp->i_mount));
798 801  
799 802 /*
800 803 * Clean out the prior contents of the attribute list.
... ... @@ -855,7 +858,7 @@
855 858 xfs_attr_leafblock_t *leaf;
856 859 xfs_da_intnode_t *node;
857 860 xfs_inode_t *dp;
858   - xfs_dabuf_t *bp1, *bp2;
  861 + struct xfs_buf *bp1, *bp2;
859 862 xfs_dablk_t blkno;
860 863 int error;
861 864  
862 865  
... ... @@ -877,10 +880,9 @@
877 880 if (error)
878 881 goto out;
879 882 ASSERT(bp2 != NULL);
880   - memcpy(bp2->data, bp1->data, XFS_LBSIZE(dp->i_mount));
881   - xfs_da_buf_done(bp1);
  883 + memcpy(bp2->b_addr, bp1->b_addr, XFS_LBSIZE(dp->i_mount));
882 884 bp1 = NULL;
883   - xfs_da_log_buf(args->trans, bp2, 0, XFS_LBSIZE(dp->i_mount) - 1);
  885 + xfs_trans_log_buf(args->trans, bp2, 0, XFS_LBSIZE(dp->i_mount) - 1);
884 886  
885 887 /*
886 888 * Set up the new root node.
887 889  
888 890  
... ... @@ -888,21 +890,17 @@
888 890 error = xfs_da_node_create(args, 0, 1, &bp1, XFS_ATTR_FORK);
889 891 if (error)
890 892 goto out;
891   - node = bp1->data;
892   - leaf = bp2->data;
  893 + node = bp1->b_addr;
  894 + leaf = bp2->b_addr;
893 895 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
894 896 /* both on-disk, don't endian-flip twice */
895 897 node->btree[0].hashval =
896 898 leaf->entries[be16_to_cpu(leaf->hdr.count)-1 ].hashval;
897 899 node->btree[0].before = cpu_to_be32(blkno);
898 900 node->hdr.count = cpu_to_be16(1);
899   - xfs_da_log_buf(args->trans, bp1, 0, XFS_LBSIZE(dp->i_mount) - 1);
  901 + xfs_trans_log_buf(args->trans, bp1, 0, XFS_LBSIZE(dp->i_mount) - 1);
900 902 error = 0;
901 903 out:
902   - if (bp1)
903   - xfs_da_buf_done(bp1);
904   - if (bp2)
905   - xfs_da_buf_done(bp2);
906 904 return(error);
907 905 }
908 906  
909 907  
... ... @@ -916,12 +914,15 @@
916 914 * or a leaf in a node attribute list.
917 915 */
918 916 STATIC int
919   -xfs_attr_leaf_create(xfs_da_args_t *args, xfs_dablk_t blkno, xfs_dabuf_t **bpp)
  917 +xfs_attr_leaf_create(
  918 + xfs_da_args_t *args,
  919 + xfs_dablk_t blkno,
  920 + struct xfs_buf **bpp)
920 921 {
921 922 xfs_attr_leafblock_t *leaf;
922 923 xfs_attr_leaf_hdr_t *hdr;
923 924 xfs_inode_t *dp;
924   - xfs_dabuf_t *bp;
  925 + struct xfs_buf *bp;
925 926 int error;
926 927  
927 928 trace_xfs_attr_leaf_create(args);
... ... @@ -933,7 +934,7 @@
933 934 if (error)
934 935 return(error);
935 936 ASSERT(bp != NULL);
936   - leaf = bp->data;
  937 + leaf = bp->b_addr;
937 938 memset((char *)leaf, 0, XFS_LBSIZE(dp->i_mount));
938 939 hdr = &leaf->hdr;
939 940 hdr->info.magic = cpu_to_be16(XFS_ATTR_LEAF_MAGIC);
... ... @@ -947,7 +948,7 @@
947 948 hdr->freemap[0].size = cpu_to_be16(be16_to_cpu(hdr->firstused) -
948 949 sizeof(xfs_attr_leaf_hdr_t));
949 950  
950   - xfs_da_log_buf(args->trans, bp, 0, XFS_LBSIZE(dp->i_mount) - 1);
  951 + xfs_trans_log_buf(args->trans, bp, 0, XFS_LBSIZE(dp->i_mount) - 1);
951 952  
952 953 *bpp = bp;
953 954 return(0);
... ... @@ -1014,7 +1015,9 @@
1014 1015 * Add a name to the leaf attribute list structure.
1015 1016 */
1016 1017 int
1017   -xfs_attr_leaf_add(xfs_dabuf_t *bp, xfs_da_args_t *args)
  1018 +xfs_attr_leaf_add(
  1019 + struct xfs_buf *bp,
  1020 + struct xfs_da_args *args)
1018 1021 {
1019 1022 xfs_attr_leafblock_t *leaf;
1020 1023 xfs_attr_leaf_hdr_t *hdr;
... ... @@ -1023,7 +1026,7 @@
1023 1026  
1024 1027 trace_xfs_attr_leaf_add(args);
1025 1028  
1026   - leaf = bp->data;
  1029 + leaf = bp->b_addr;
1027 1030 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1028 1031 ASSERT((args->index >= 0)
1029 1032 && (args->index <= be16_to_cpu(leaf->hdr.count)));
... ... @@ -1085,7 +1088,10 @@
1085 1088 * Add a name to a leaf attribute list structure.
1086 1089 */
1087 1090 STATIC int
1088   -xfs_attr_leaf_add_work(xfs_dabuf_t *bp, xfs_da_args_t *args, int mapindex)
  1091 +xfs_attr_leaf_add_work(
  1092 + struct xfs_buf *bp,
  1093 + xfs_da_args_t *args,
  1094 + int mapindex)
1089 1095 {
1090 1096 xfs_attr_leafblock_t *leaf;
1091 1097 xfs_attr_leaf_hdr_t *hdr;
... ... @@ -1096,7 +1102,7 @@
1096 1102 xfs_mount_t *mp;
1097 1103 int tmp, i;
1098 1104  
1099   - leaf = bp->data;
  1105 + leaf = bp->b_addr;
1100 1106 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1101 1107 hdr = &leaf->hdr;
1102 1108 ASSERT((mapindex >= 0) && (mapindex < XFS_ATTR_LEAF_MAPSIZE));
... ... @@ -1110,7 +1116,7 @@
1110 1116 tmp = be16_to_cpu(hdr->count) - args->index;
1111 1117 tmp *= sizeof(xfs_attr_leaf_entry_t);
1112 1118 memmove((char *)(entry+1), (char *)entry, tmp);
1113   - xfs_da_log_buf(args->trans, bp,
  1119 + xfs_trans_log_buf(args->trans, bp,
1114 1120 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry)));
1115 1121 }
1116 1122 be16_add_cpu(&hdr->count, 1);
... ... @@ -1142,7 +1148,7 @@
1142 1148 args->index2++;
1143 1149 }
1144 1150 }
1145   - xfs_da_log_buf(args->trans, bp,
  1151 + xfs_trans_log_buf(args->trans, bp,
1146 1152 XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry)));
1147 1153 ASSERT((args->index == 0) ||
1148 1154 (be32_to_cpu(entry->hashval) >= be32_to_cpu((entry-1)->hashval)));
... ... @@ -1174,7 +1180,7 @@
1174 1180 args->rmtblkno = 1;
1175 1181 args->rmtblkcnt = XFS_B_TO_FSB(mp, args->valuelen);
1176 1182 }
1177   - xfs_da_log_buf(args->trans, bp,
  1183 + xfs_trans_log_buf(args->trans, bp,
1178 1184 XFS_DA_LOGRANGE(leaf, xfs_attr_leaf_name(leaf, args->index),
1179 1185 xfs_attr_leaf_entsize(leaf, args->index)));
1180 1186  
... ... @@ -1198,7 +1204,7 @@
1198 1204 }
1199 1205 }
1200 1206 be16_add_cpu(&hdr->usedbytes, xfs_attr_leaf_entsize(leaf, args->index));
1201   - xfs_da_log_buf(args->trans, bp,
  1207 + xfs_trans_log_buf(args->trans, bp,
1202 1208 XFS_DA_LOGRANGE(leaf, hdr, sizeof(*hdr)));
1203 1209 return(0);
1204 1210 }
... ... @@ -1207,7 +1213,9 @@
1207 1213 * Garbage collect a leaf attribute list block by copying it to a new buffer.
1208 1214 */
1209 1215 STATIC void
1210   -xfs_attr_leaf_compact(xfs_trans_t *trans, xfs_dabuf_t *bp)
  1216 +xfs_attr_leaf_compact(
  1217 + struct xfs_trans *trans,
  1218 + struct xfs_buf *bp)
1211 1219 {
1212 1220 xfs_attr_leafblock_t *leaf_s, *leaf_d;
1213 1221 xfs_attr_leaf_hdr_t *hdr_s, *hdr_d;
1214 1222  
... ... @@ -1217,14 +1225,14 @@
1217 1225 mp = trans->t_mountp;
1218 1226 tmpbuffer = kmem_alloc(XFS_LBSIZE(mp), KM_SLEEP);
1219 1227 ASSERT(tmpbuffer != NULL);
1220   - memcpy(tmpbuffer, bp->data, XFS_LBSIZE(mp));
1221   - memset(bp->data, 0, XFS_LBSIZE(mp));
  1228 + memcpy(tmpbuffer, bp->b_addr, XFS_LBSIZE(mp));
  1229 + memset(bp->b_addr, 0, XFS_LBSIZE(mp));
1222 1230  
1223 1231 /*
1224 1232 * Copy basic information
1225 1233 */
1226 1234 leaf_s = (xfs_attr_leafblock_t *)tmpbuffer;
1227   - leaf_d = bp->data;
  1235 + leaf_d = bp->b_addr;
1228 1236 hdr_s = &leaf_s->hdr;
1229 1237 hdr_d = &leaf_d->hdr;
1230 1238 hdr_d->info = hdr_s->info; /* struct copy */
... ... @@ -1247,7 +1255,7 @@
1247 1255 */
1248 1256 xfs_attr_leaf_moveents(leaf_s, 0, leaf_d, 0,
1249 1257 be16_to_cpu(hdr_s->count), mp);
1250   - xfs_da_log_buf(trans, bp, 0, XFS_LBSIZE(mp) - 1);
  1258 + xfs_trans_log_buf(trans, bp, 0, XFS_LBSIZE(mp) - 1);
1251 1259  
1252 1260 kmem_free(tmpbuffer);
1253 1261 }
... ... @@ -1279,8 +1287,8 @@
1279 1287 */
1280 1288 ASSERT(blk1->magic == XFS_ATTR_LEAF_MAGIC);
1281 1289 ASSERT(blk2->magic == XFS_ATTR_LEAF_MAGIC);
1282   - leaf1 = blk1->bp->data;
1283   - leaf2 = blk2->bp->data;
  1290 + leaf1 = blk1->bp->b_addr;
  1291 + leaf2 = blk2->bp->b_addr;
1284 1292 ASSERT(leaf1->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1285 1293 ASSERT(leaf2->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1286 1294 args = state->args;
... ... @@ -1298,8 +1306,8 @@
1298 1306 tmp_blk = blk1;
1299 1307 blk1 = blk2;
1300 1308 blk2 = tmp_blk;
1301   - leaf1 = blk1->bp->data;
1302   - leaf2 = blk2->bp->data;
  1309 + leaf1 = blk1->bp->b_addr;
  1310 + leaf2 = blk2->bp->b_addr;
1303 1311 swap = 1;
1304 1312 }
1305 1313 hdr1 = &leaf1->hdr;
... ... @@ -1346,8 +1354,8 @@
1346 1354 xfs_attr_leaf_moveents(leaf1, be16_to_cpu(hdr1->count) - count,
1347 1355 leaf2, 0, count, state->mp);
1348 1356  
1349   - xfs_da_log_buf(args->trans, blk1->bp, 0, state->blocksize-1);
1350   - xfs_da_log_buf(args->trans, blk2->bp, 0, state->blocksize-1);
  1357 + xfs_trans_log_buf(args->trans, blk1->bp, 0, state->blocksize-1);
  1358 + xfs_trans_log_buf(args->trans, blk2->bp, 0, state->blocksize-1);
1351 1359 } else if (count > be16_to_cpu(hdr1->count)) {
1352 1360 /*
1353 1361 * I assert that since all callers pass in an empty
... ... @@ -1378,8 +1386,8 @@
1378 1386 xfs_attr_leaf_moveents(leaf2, 0, leaf1,
1379 1387 be16_to_cpu(hdr1->count), count, state->mp);
1380 1388  
1381   - xfs_da_log_buf(args->trans, blk1->bp, 0, state->blocksize-1);
1382   - xfs_da_log_buf(args->trans, blk2->bp, 0, state->blocksize-1);
  1389 + xfs_trans_log_buf(args->trans, blk1->bp, 0, state->blocksize-1);
  1390 + xfs_trans_log_buf(args->trans, blk2->bp, 0, state->blocksize-1);
1383 1391 }
1384 1392  
1385 1393 /*
... ... @@ -1448,8 +1456,8 @@
1448 1456 /*
1449 1457 * Set up environment.
1450 1458 */
1451   - leaf1 = blk1->bp->data;
1452   - leaf2 = blk2->bp->data;
  1459 + leaf1 = blk1->bp->b_addr;
  1460 + leaf2 = blk2->bp->b_addr;
1453 1461 hdr1 = &leaf1->hdr;
1454 1462 hdr2 = &leaf2->hdr;
1455 1463 foundit = 0;
... ... @@ -1551,7 +1559,7 @@
1551 1559 xfs_da_blkinfo_t *info;
1552 1560 int count, bytes, forward, error, retval, i;
1553 1561 xfs_dablk_t blkno;
1554   - xfs_dabuf_t *bp;
  1562 + struct xfs_buf *bp;
1555 1563  
1556 1564 /*
1557 1565 * Check for the degenerate case of the block being over 50% full.
... ... @@ -1559,7 +1567,7 @@
1559 1567 * to coalesce with a sibling.
1560 1568 */
1561 1569 blk = &state->path.blk[ state->path.active-1 ];
1562   - info = blk->bp->data;
  1570 + info = blk->bp->b_addr;
1563 1571 ASSERT(info->magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1564 1572 leaf = (xfs_attr_leafblock_t *)info;
1565 1573 count = be16_to_cpu(leaf->hdr.count);
1566 1574  
... ... @@ -1622,13 +1630,13 @@
1622 1630 count = be16_to_cpu(leaf->hdr.count);
1623 1631 bytes = state->blocksize - (state->blocksize>>2);
1624 1632 bytes -= be16_to_cpu(leaf->hdr.usedbytes);
1625   - leaf = bp->data;
  1633 + leaf = bp->b_addr;
1626 1634 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1627 1635 count += be16_to_cpu(leaf->hdr.count);
1628 1636 bytes -= be16_to_cpu(leaf->hdr.usedbytes);
1629 1637 bytes -= count * sizeof(xfs_attr_leaf_entry_t);
1630 1638 bytes -= sizeof(xfs_attr_leaf_hdr_t);
1631   - xfs_da_brelse(state->args->trans, bp);
  1639 + xfs_trans_brelse(state->args->trans, bp);
1632 1640 if (bytes >= 0)
1633 1641 break; /* fits with at least 25% to spare */
1634 1642 }
... ... @@ -1666,7 +1674,9 @@
1666 1674 * If two leaves are 37% full, when combined they will leave 25% free.
1667 1675 */
1668 1676 int
1669   -xfs_attr_leaf_remove(xfs_dabuf_t *bp, xfs_da_args_t *args)
  1677 +xfs_attr_leaf_remove(
  1678 + struct xfs_buf *bp,
  1679 + xfs_da_args_t *args)
1670 1680 {
1671 1681 xfs_attr_leafblock_t *leaf;
1672 1682 xfs_attr_leaf_hdr_t *hdr;
... ... @@ -1676,7 +1686,7 @@
1676 1686 int tablesize, tmp, i;
1677 1687 xfs_mount_t *mp;
1678 1688  
1679   - leaf = bp->data;
  1689 + leaf = bp->b_addr;
1680 1690 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1681 1691 hdr = &leaf->hdr;
1682 1692 mp = args->trans->t_mountp;
... ... @@ -1769,7 +1779,7 @@
1769 1779 */
1770 1780 memset(xfs_attr_leaf_name(leaf, args->index), 0, entsize);
1771 1781 be16_add_cpu(&hdr->usedbytes, -entsize);
1772   - xfs_da_log_buf(args->trans, bp,
  1782 + xfs_trans_log_buf(args->trans, bp,
1773 1783 XFS_DA_LOGRANGE(leaf, xfs_attr_leaf_name(leaf, args->index),
1774 1784 entsize));
1775 1785  
... ... @@ -1777,7 +1787,7 @@
1777 1787 * sizeof(xfs_attr_leaf_entry_t);
1778 1788 memmove((char *)entry, (char *)(entry+1), tmp);
1779 1789 be16_add_cpu(&hdr->count, -1);
1780   - xfs_da_log_buf(args->trans, bp,
  1790 + xfs_trans_log_buf(args->trans, bp,
1781 1791 XFS_DA_LOGRANGE(leaf, entry, tmp + sizeof(*entry)));
1782 1792 entry = &leaf->entries[be16_to_cpu(hdr->count)];
1783 1793 memset((char *)entry, 0, sizeof(xfs_attr_leaf_entry_t));
... ... @@ -1807,7 +1817,7 @@
1807 1817 } else {
1808 1818 hdr->holes = 1; /* mark as needing compaction */
1809 1819 }
1810   - xfs_da_log_buf(args->trans, bp,
  1820 + xfs_trans_log_buf(args->trans, bp,
1811 1821 XFS_DA_LOGRANGE(leaf, hdr, sizeof(*hdr)));
1812 1822  
1813 1823 /*
... ... @@ -1840,8 +1850,8 @@
1840 1850 mp = state->mp;
1841 1851 ASSERT(drop_blk->magic == XFS_ATTR_LEAF_MAGIC);
1842 1852 ASSERT(save_blk->magic == XFS_ATTR_LEAF_MAGIC);
1843   - drop_leaf = drop_blk->bp->data;
1844   - save_leaf = save_blk->bp->data;
  1853 + drop_leaf = drop_blk->bp->b_addr;
  1854 + save_leaf = save_blk->bp->b_addr;
1845 1855 ASSERT(drop_leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1846 1856 ASSERT(save_leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1847 1857 drop_hdr = &drop_leaf->hdr;
... ... @@ -1906,7 +1916,7 @@
1906 1916 kmem_free(tmpbuffer);
1907 1917 }
1908 1918  
1909   - xfs_da_log_buf(state->args->trans, save_blk->bp, 0,
  1919 + xfs_trans_log_buf(state->args->trans, save_blk->bp, 0,
1910 1920 state->blocksize - 1);
1911 1921  
1912 1922 /*
... ... @@ -1934,7 +1944,9 @@
1934 1944 * Don't change the args->value unless we find the attribute.
1935 1945 */
1936 1946 int
1937   -xfs_attr_leaf_lookup_int(xfs_dabuf_t *bp, xfs_da_args_t *args)
  1947 +xfs_attr_leaf_lookup_int(
  1948 + struct xfs_buf *bp,
  1949 + xfs_da_args_t *args)
1938 1950 {
1939 1951 xfs_attr_leafblock_t *leaf;
1940 1952 xfs_attr_leaf_entry_t *entry;
... ... @@ -1945,7 +1957,7 @@
1945 1957  
1946 1958 trace_xfs_attr_leaf_lookup(args);
1947 1959  
1948   - leaf = bp->data;
  1960 + leaf = bp->b_addr;
1949 1961 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1950 1962 ASSERT(be16_to_cpu(leaf->hdr.count)
1951 1963 < (XFS_LBSIZE(args->dp->i_mount)/8));
... ... @@ -2041,7 +2053,9 @@
2041 2053 * list structure.
2042 2054 */
2043 2055 int
2044   -xfs_attr_leaf_getvalue(xfs_dabuf_t *bp, xfs_da_args_t *args)
  2056 +xfs_attr_leaf_getvalue(
  2057 + struct xfs_buf *bp,
  2058 + xfs_da_args_t *args)
2045 2059 {
2046 2060 int valuelen;
2047 2061 xfs_attr_leafblock_t *leaf;
... ... @@ -2049,7 +2063,7 @@
2049 2063 xfs_attr_leaf_name_local_t *name_loc;
2050 2064 xfs_attr_leaf_name_remote_t *name_rmt;
2051 2065  
2052   - leaf = bp->data;
  2066 + leaf = bp->b_addr;
2053 2067 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
2054 2068 ASSERT(be16_to_cpu(leaf->hdr.count)
2055 2069 < (XFS_LBSIZE(args->dp->i_mount)/8));
2056 2070  
... ... @@ -2247,12 +2261,14 @@
2247 2261 * Return 0 unless leaf2 should go before leaf1.
2248 2262 */
2249 2263 int
2250   -xfs_attr_leaf_order(xfs_dabuf_t *leaf1_bp, xfs_dabuf_t *leaf2_bp)
  2264 +xfs_attr_leaf_order(
  2265 + struct xfs_buf *leaf1_bp,
  2266 + struct xfs_buf *leaf2_bp)
2251 2267 {
2252 2268 xfs_attr_leafblock_t *leaf1, *leaf2;
2253 2269  
2254   - leaf1 = leaf1_bp->data;
2255   - leaf2 = leaf2_bp->data;
  2270 + leaf1 = leaf1_bp->b_addr;
  2271 + leaf2 = leaf2_bp->b_addr;
2256 2272 ASSERT((leaf1->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)) &&
2257 2273 (leaf2->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)));
2258 2274 if ((be16_to_cpu(leaf1->hdr.count) > 0) &&
2259 2275  
... ... @@ -2272,11 +2288,13 @@
2272 2288 * Pick up the last hashvalue from a leaf block.
2273 2289 */
2274 2290 xfs_dahash_t
2275   -xfs_attr_leaf_lasthash(xfs_dabuf_t *bp, int *count)
  2291 +xfs_attr_leaf_lasthash(
  2292 + struct xfs_buf *bp,
  2293 + int *count)
2276 2294 {
2277 2295 xfs_attr_leafblock_t *leaf;
2278 2296  
2279   - leaf = bp->data;
  2297 + leaf = bp->b_addr;
2280 2298 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
2281 2299 if (count)
2282 2300 *count = be16_to_cpu(leaf->hdr.count);
... ... @@ -2337,7 +2355,9 @@
2337 2355 * Copy out attribute list entries for attr_list(), for leaf attribute lists.
2338 2356 */
2339 2357 int
2340   -xfs_attr_leaf_list_int(xfs_dabuf_t *bp, xfs_attr_list_context_t *context)
  2358 +xfs_attr_leaf_list_int(
  2359 + struct xfs_buf *bp,
  2360 + xfs_attr_list_context_t *context)
2341 2361 {
2342 2362 attrlist_cursor_kern_t *cursor;
2343 2363 xfs_attr_leafblock_t *leaf;
... ... @@ -2345,7 +2365,7 @@
2345 2365 int retval, i;
2346 2366  
2347 2367 ASSERT(bp != NULL);
2348   - leaf = bp->data;
  2368 + leaf = bp->b_addr;
2349 2369 cursor = context->cursor;
2350 2370 cursor->initted = 1;
2351 2371  
... ... @@ -2463,7 +2483,7 @@
2463 2483 xfs_attr_leafblock_t *leaf;
2464 2484 xfs_attr_leaf_entry_t *entry;
2465 2485 xfs_attr_leaf_name_remote_t *name_rmt;
2466   - xfs_dabuf_t *bp;
  2486 + struct xfs_buf *bp;
2467 2487 int error;
2468 2488 #ifdef DEBUG
2469 2489 xfs_attr_leaf_name_local_t *name_loc;
... ... @@ -2482,7 +2502,7 @@
2482 2502 }
2483 2503 ASSERT(bp != NULL);
2484 2504  
2485   - leaf = bp->data;
  2505 + leaf = bp->b_addr;
2486 2506 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
2487 2507 ASSERT(args->index < be16_to_cpu(leaf->hdr.count));
2488 2508 ASSERT(args->index >= 0);
... ... @@ -2505,7 +2525,7 @@
2505 2525 #endif /* DEBUG */
2506 2526  
2507 2527 entry->flags &= ~XFS_ATTR_INCOMPLETE;
2508   - xfs_da_log_buf(args->trans, bp,
  2528 + xfs_trans_log_buf(args->trans, bp,
2509 2529 XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry)));
2510 2530  
2511 2531 if (args->rmtblkno) {
2512 2532  
... ... @@ -2513,10 +2533,9 @@
2513 2533 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
2514 2534 name_rmt->valueblk = cpu_to_be32(args->rmtblkno);
2515 2535 name_rmt->valuelen = cpu_to_be32(args->valuelen);
2516   - xfs_da_log_buf(args->trans, bp,
  2536 + xfs_trans_log_buf(args->trans, bp,
2517 2537 XFS_DA_LOGRANGE(leaf, name_rmt, sizeof(*name_rmt)));
2518 2538 }
2519   - xfs_da_buf_done(bp);
2520 2539  
2521 2540 /*
2522 2541 * Commit the flag value change and start the next trans in series.
... ... @@ -2533,7 +2552,7 @@
2533 2552 xfs_attr_leafblock_t *leaf;
2534 2553 xfs_attr_leaf_entry_t *entry;
2535 2554 xfs_attr_leaf_name_remote_t *name_rmt;
2536   - xfs_dabuf_t *bp;
  2555 + struct xfs_buf *bp;
2537 2556 int error;
2538 2557  
2539 2558 trace_xfs_attr_leaf_setflag(args);
... ... @@ -2548,7 +2567,7 @@
2548 2567 }
2549 2568 ASSERT(bp != NULL);
2550 2569  
2551   - leaf = bp->data;
  2570 + leaf = bp->b_addr;
2552 2571 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
2553 2572 ASSERT(args->index < be16_to_cpu(leaf->hdr.count));
2554 2573 ASSERT(args->index >= 0);
2555 2574  
2556 2575  
... ... @@ -2556,16 +2575,15 @@
2556 2575  
2557 2576 ASSERT((entry->flags & XFS_ATTR_INCOMPLETE) == 0);
2558 2577 entry->flags |= XFS_ATTR_INCOMPLETE;
2559   - xfs_da_log_buf(args->trans, bp,
  2578 + xfs_trans_log_buf(args->trans, bp,
2560 2579 XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry)));
2561 2580 if ((entry->flags & XFS_ATTR_LOCAL) == 0) {
2562 2581 name_rmt = xfs_attr_leaf_name_remote(leaf, args->index);
2563 2582 name_rmt->valueblk = 0;
2564 2583 name_rmt->valuelen = 0;
2565   - xfs_da_log_buf(args->trans, bp,
  2584 + xfs_trans_log_buf(args->trans, bp,
2566 2585 XFS_DA_LOGRANGE(leaf, name_rmt, sizeof(*name_rmt)));
2567 2586 }
2568   - xfs_da_buf_done(bp);
2569 2587  
2570 2588 /*
2571 2589 * Commit the flag value change and start the next trans in series.
... ... @@ -2586,7 +2604,7 @@
2586 2604 xfs_attr_leafblock_t *leaf1, *leaf2;
2587 2605 xfs_attr_leaf_entry_t *entry1, *entry2;
2588 2606 xfs_attr_leaf_name_remote_t *name_rmt;
2589   - xfs_dabuf_t *bp1, *bp2;
  2607 + struct xfs_buf *bp1, *bp2;
2590 2608 int error;
2591 2609 #ifdef DEBUG
2592 2610 xfs_attr_leaf_name_local_t *name_loc;
2593 2611  
... ... @@ -2620,13 +2638,13 @@
2620 2638 bp2 = bp1;
2621 2639 }
2622 2640  
2623   - leaf1 = bp1->data;
  2641 + leaf1 = bp1->b_addr;
2624 2642 ASSERT(leaf1->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
2625 2643 ASSERT(args->index < be16_to_cpu(leaf1->hdr.count));
2626 2644 ASSERT(args->index >= 0);
2627 2645 entry1 = &leaf1->entries[ args->index ];
2628 2646  
2629   - leaf2 = bp2->data;
  2647 + leaf2 = bp2->b_addr;
2630 2648 ASSERT(leaf2->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
2631 2649 ASSERT(args->index2 < be16_to_cpu(leaf2->hdr.count));
2632 2650 ASSERT(args->index2 >= 0);
2633 2651  
2634 2652  
2635 2653  
2636 2654  
... ... @@ -2660,30 +2678,27 @@
2660 2678 ASSERT((entry2->flags & XFS_ATTR_INCOMPLETE) == 0);
2661 2679  
2662 2680 entry1->flags &= ~XFS_ATTR_INCOMPLETE;
2663   - xfs_da_log_buf(args->trans, bp1,
  2681 + xfs_trans_log_buf(args->trans, bp1,
2664 2682 XFS_DA_LOGRANGE(leaf1, entry1, sizeof(*entry1)));
2665 2683 if (args->rmtblkno) {
2666 2684 ASSERT((entry1->flags & XFS_ATTR_LOCAL) == 0);
2667 2685 name_rmt = xfs_attr_leaf_name_remote(leaf1, args->index);
2668 2686 name_rmt->valueblk = cpu_to_be32(args->rmtblkno);
2669 2687 name_rmt->valuelen = cpu_to_be32(args->valuelen);
2670   - xfs_da_log_buf(args->trans, bp1,
  2688 + xfs_trans_log_buf(args->trans, bp1,
2671 2689 XFS_DA_LOGRANGE(leaf1, name_rmt, sizeof(*name_rmt)));
2672 2690 }
2673 2691  
2674 2692 entry2->flags |= XFS_ATTR_INCOMPLETE;
2675   - xfs_da_log_buf(args->trans, bp2,
  2693 + xfs_trans_log_buf(args->trans, bp2,
2676 2694 XFS_DA_LOGRANGE(leaf2, entry2, sizeof(*entry2)));
2677 2695 if ((entry2->flags & XFS_ATTR_LOCAL) == 0) {
2678 2696 name_rmt = xfs_attr_leaf_name_remote(leaf2, args->index2);
2679 2697 name_rmt->valueblk = 0;
2680 2698 name_rmt->valuelen = 0;
2681   - xfs_da_log_buf(args->trans, bp2,
  2699 + xfs_trans_log_buf(args->trans, bp2,
2682 2700 XFS_DA_LOGRANGE(leaf2, name_rmt, sizeof(*name_rmt)));
2683 2701 }
2684   - xfs_da_buf_done(bp1);
2685   - if (bp1 != bp2)
2686   - xfs_da_buf_done(bp2);
2687 2702  
2688 2703 /*
2689 2704 * Commit the flag value change and start the next trans in series.
... ... @@ -2706,7 +2721,7 @@
2706 2721 {
2707 2722 xfs_da_blkinfo_t *info;
2708 2723 xfs_daddr_t blkno;
2709   - xfs_dabuf_t *bp;
  2724 + struct xfs_buf *bp;
2710 2725 int error;
2711 2726  
2712 2727 /*
2713 2728  
2714 2729  
... ... @@ -2718,20 +2733,20 @@
2718 2733 error = xfs_da_read_buf(*trans, dp, 0, -1, &bp, XFS_ATTR_FORK);
2719 2734 if (error)
2720 2735 return(error);
2721   - blkno = xfs_da_blkno(bp);
  2736 + blkno = XFS_BUF_ADDR(bp);
2722 2737  
2723 2738 /*
2724 2739 * Invalidate the tree, even if the "tree" is only a single leaf block.
2725 2740 * This is a depth-first traversal!
2726 2741 */
2727   - info = bp->data;
  2742 + info = bp->b_addr;
2728 2743 if (info->magic == cpu_to_be16(XFS_DA_NODE_MAGIC)) {
2729 2744 error = xfs_attr_node_inactive(trans, dp, bp, 1);
2730 2745 } else if (info->magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC)) {
2731 2746 error = xfs_attr_leaf_inactive(trans, dp, bp);
2732 2747 } else {
2733 2748 error = XFS_ERROR(EIO);
2734   - xfs_da_brelse(*trans, bp);
  2749 + xfs_trans_brelse(*trans, bp);
2735 2750 }
2736 2751 if (error)
2737 2752 return(error);
... ... @@ -2742,7 +2757,7 @@
2742 2757 error = xfs_da_get_buf(*trans, dp, 0, blkno, &bp, XFS_ATTR_FORK);
2743 2758 if (error)
2744 2759 return(error);
2745   - xfs_da_binval(*trans, bp); /* remove from cache */
  2760 + xfs_trans_binval(*trans, bp); /* remove from cache */
2746 2761 /*
2747 2762 * Commit the invalidate and start the next transaction.
2748 2763 */
2749 2764  
2750 2765  
2751 2766  
2752 2767  
2753 2768  
2754 2769  
... ... @@ -2756,34 +2771,37 @@
2756 2771 * We're doing a depth-first traversal in order to invalidate everything.
2757 2772 */
2758 2773 STATIC int
2759   -xfs_attr_node_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp,
2760   - int level)
  2774 +xfs_attr_node_inactive(
  2775 + struct xfs_trans **trans,
  2776 + struct xfs_inode *dp,
  2777 + struct xfs_buf *bp,
  2778 + int level)
2761 2779 {
2762 2780 xfs_da_blkinfo_t *info;
2763 2781 xfs_da_intnode_t *node;
2764 2782 xfs_dablk_t child_fsb;
2765 2783 xfs_daddr_t parent_blkno, child_blkno;
2766 2784 int error, count, i;
2767   - xfs_dabuf_t *child_bp;
  2785 + struct xfs_buf *child_bp;
2768 2786  
2769 2787 /*
2770 2788 * Since this code is recursive (gasp!) we must protect ourselves.
2771 2789 */
2772 2790 if (level > XFS_DA_NODE_MAXDEPTH) {
2773   - xfs_da_brelse(*trans, bp); /* no locks for later trans */
  2791 + xfs_trans_brelse(*trans, bp); /* no locks for later trans */
2774 2792 return(XFS_ERROR(EIO));
2775 2793 }
2776 2794  
2777   - node = bp->data;
  2795 + node = bp->b_addr;
2778 2796 ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
2779   - parent_blkno = xfs_da_blkno(bp); /* save for re-read later */
  2797 + parent_blkno = XFS_BUF_ADDR(bp); /* save for re-read later */
2780 2798 count = be16_to_cpu(node->hdr.count);
2781 2799 if (!count) {
2782   - xfs_da_brelse(*trans, bp);
  2800 + xfs_trans_brelse(*trans, bp);
2783 2801 return(0);
2784 2802 }
2785 2803 child_fsb = be32_to_cpu(node->btree[0].before);
2786   - xfs_da_brelse(*trans, bp); /* no locks for later trans */
  2804 + xfs_trans_brelse(*trans, bp); /* no locks for later trans */
2787 2805  
2788 2806 /*
2789 2807 * If this is the node level just above the leaves, simply loop
2790 2808  
... ... @@ -2803,12 +2821,12 @@
2803 2821 return(error);
2804 2822 if (child_bp) {
2805 2823 /* save for re-read later */
2806   - child_blkno = xfs_da_blkno(child_bp);
  2824 + child_blkno = XFS_BUF_ADDR(child_bp);
2807 2825  
2808 2826 /*
2809 2827 * Invalidate the subtree, however we have to.
2810 2828 */
2811   - info = child_bp->data;
  2829 + info = child_bp->b_addr;
2812 2830 if (info->magic == cpu_to_be16(XFS_DA_NODE_MAGIC)) {
2813 2831 error = xfs_attr_node_inactive(trans, dp,
2814 2832 child_bp, level+1);
... ... @@ -2817,7 +2835,7 @@
2817 2835 child_bp);
2818 2836 } else {
2819 2837 error = XFS_ERROR(EIO);
2820   - xfs_da_brelse(*trans, child_bp);
  2838 + xfs_trans_brelse(*trans, child_bp);
2821 2839 }
2822 2840 if (error)
2823 2841 return(error);
... ... @@ -2830,7 +2848,7 @@
2830 2848 &child_bp, XFS_ATTR_FORK);
2831 2849 if (error)
2832 2850 return(error);
2833   - xfs_da_binval(*trans, child_bp);
  2851 + xfs_trans_binval(*trans, child_bp);
2834 2852 }
2835 2853  
2836 2854 /*
... ... @@ -2843,7 +2861,7 @@
2843 2861 if (error)
2844 2862 return(error);
2845 2863 child_fsb = be32_to_cpu(node->btree[i+1].before);
2846   - xfs_da_brelse(*trans, bp);
  2864 + xfs_trans_brelse(*trans, bp);
2847 2865 }
2848 2866 /*
2849 2867 * Atomically commit the whole invalidate stuff.
... ... @@ -2863,7 +2881,10 @@
2863 2881 * caught holding something that the logging code wants to flush to disk.
2864 2882 */
2865 2883 STATIC int
2866   -xfs_attr_leaf_inactive(xfs_trans_t **trans, xfs_inode_t *dp, xfs_dabuf_t *bp)
  2884 +xfs_attr_leaf_inactive(
  2885 + struct xfs_trans **trans,
  2886 + struct xfs_inode *dp,
  2887 + struct xfs_buf *bp)
2867 2888 {
2868 2889 xfs_attr_leafblock_t *leaf;
2869 2890 xfs_attr_leaf_entry_t *entry;
... ... @@ -2871,7 +2892,7 @@
2871 2892 xfs_attr_inactive_list_t *list, *lp;
2872 2893 int error, count, size, tmp, i;
2873 2894  
2874   - leaf = bp->data;
  2895 + leaf = bp->b_addr;
2875 2896 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
2876 2897  
2877 2898 /*
... ... @@ -2892,7 +2913,7 @@
2892 2913 * If there are no "remote" values, we're done.
2893 2914 */
2894 2915 if (count == 0) {
2895   - xfs_da_brelse(*trans, bp);
  2916 + xfs_trans_brelse(*trans, bp);
2896 2917 return(0);
2897 2918 }
2898 2919  
... ... @@ -2919,7 +2940,7 @@
2919 2940 }
2920 2941 }
2921 2942 }
2922   - xfs_da_brelse(*trans, bp); /* unlock for trans. in freextent() */
  2943 + xfs_trans_brelse(*trans, bp); /* unlock for trans. in freextent() */
2923 2944  
2924 2945 /*
2925 2946 * Invalidate each of the "remote" value extents.
fs/xfs/xfs_attr_leaf.h
... ... @@ -31,7 +31,6 @@
31 31 struct attrlist;
32 32 struct attrlist_cursor_kern;
33 33 struct xfs_attr_list_context;
34   -struct xfs_dabuf;
35 34 struct xfs_da_args;
36 35 struct xfs_da_state;
37 36 struct xfs_da_state_blk;
... ... @@ -215,7 +214,7 @@
215 214 int xfs_attr_shortform_to_leaf(struct xfs_da_args *args);
216 215 int xfs_attr_shortform_remove(struct xfs_da_args *args);
217 216 int xfs_attr_shortform_list(struct xfs_attr_list_context *context);
218   -int xfs_attr_shortform_allfit(struct xfs_dabuf *bp, struct xfs_inode *dp);
  217 +int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp);
219 218 int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes);
220 219  
221 220  
... ... @@ -223,7 +222,7 @@
223 222 * Internal routines when attribute fork size == XFS_LBSIZE(mp).
224 223 */
225 224 int xfs_attr_leaf_to_node(struct xfs_da_args *args);
226   -int xfs_attr_leaf_to_shortform(struct xfs_dabuf *bp,
  225 +int xfs_attr_leaf_to_shortform(struct xfs_buf *bp,
227 226 struct xfs_da_args *args, int forkoff);
228 227 int xfs_attr_leaf_clearflag(struct xfs_da_args *args);
229 228 int xfs_attr_leaf_setflag(struct xfs_da_args *args);
230 229  
231 230  
232 231  
... ... @@ -235,14 +234,14 @@
235 234 int xfs_attr_leaf_split(struct xfs_da_state *state,
236 235 struct xfs_da_state_blk *oldblk,
237 236 struct xfs_da_state_blk *newblk);
238   -int xfs_attr_leaf_lookup_int(struct xfs_dabuf *leaf,
  237 +int xfs_attr_leaf_lookup_int(struct xfs_buf *leaf,
239 238 struct xfs_da_args *args);
240   -int xfs_attr_leaf_getvalue(struct xfs_dabuf *bp, struct xfs_da_args *args);
241   -int xfs_attr_leaf_add(struct xfs_dabuf *leaf_buffer,
  239 +int xfs_attr_leaf_getvalue(struct xfs_buf *bp, struct xfs_da_args *args);
  240 +int xfs_attr_leaf_add(struct xfs_buf *leaf_buffer,
242 241 struct xfs_da_args *args);
243   -int xfs_attr_leaf_remove(struct xfs_dabuf *leaf_buffer,
  242 +int xfs_attr_leaf_remove(struct xfs_buf *leaf_buffer,
244 243 struct xfs_da_args *args);
245   -int xfs_attr_leaf_list_int(struct xfs_dabuf *bp,
  244 +int xfs_attr_leaf_list_int(struct xfs_buf *bp,
246 245 struct xfs_attr_list_context *context);
247 246  
248 247 /*
... ... @@ -257,9 +256,9 @@
257 256 /*
258 257 * Utility routines.
259 258 */
260   -xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_dabuf *bp, int *count);
261   -int xfs_attr_leaf_order(struct xfs_dabuf *leaf1_bp,
262   - struct xfs_dabuf *leaf2_bp);
  259 +xfs_dahash_t xfs_attr_leaf_lasthash(struct xfs_buf *bp, int *count);
  260 +int xfs_attr_leaf_order(struct xfs_buf *leaf1_bp,
  261 + struct xfs_buf *leaf2_bp);
263 262 int xfs_attr_leaf_newentsize(int namelen, int valuelen, int blocksize,
264 263 int *local);
265 264 #endif /* __XFS_ATTR_LEAF_H__ */
fs/xfs/xfs_da_btree.c
... ... @@ -83,9 +83,9 @@
83 83 /*
84 84 * Utility routines.
85 85 */
86   -STATIC uint xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count);
87   -STATIC int xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp);
88   -STATIC xfs_dabuf_t *xfs_da_buf_make(xfs_buf_t *bp);
  86 +STATIC uint xfs_da_node_lasthash(struct xfs_buf *bp, int *count);
  87 +STATIC int xfs_da_node_order(struct xfs_buf *node1_bp,
  88 + struct xfs_buf *node2_bp);
89 89 STATIC int xfs_da_blk_unlink(xfs_da_state_t *state,
90 90 xfs_da_state_blk_t *drop_blk,
91 91 xfs_da_state_blk_t *save_blk);
92 92  
... ... @@ -100,10 +100,10 @@
100 100 */
101 101 int
102 102 xfs_da_node_create(xfs_da_args_t *args, xfs_dablk_t blkno, int level,
103   - xfs_dabuf_t **bpp, int whichfork)
  103 + struct xfs_buf **bpp, int whichfork)
104 104 {
105 105 xfs_da_intnode_t *node;
106   - xfs_dabuf_t *bp;
  106 + struct xfs_buf *bp;
107 107 int error;
108 108 xfs_trans_t *tp;
109 109  
... ... @@ -114,7 +114,7 @@
114 114 if (error)
115 115 return(error);
116 116 ASSERT(bp != NULL);
117   - node = bp->data;
  117 + node = bp->b_addr;
118 118 node->hdr.info.forw = 0;
119 119 node->hdr.info.back = 0;
120 120 node->hdr.info.magic = cpu_to_be16(XFS_DA_NODE_MAGIC);
... ... @@ -122,7 +122,7 @@
122 122 node->hdr.count = 0;
123 123 node->hdr.level = cpu_to_be16(level);
124 124  
125   - xfs_da_log_buf(tp, bp,
  125 + xfs_trans_log_buf(tp, bp,
126 126 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr)));
127 127  
128 128 *bpp = bp;
... ... @@ -138,7 +138,7 @@
138 138 {
139 139 xfs_da_state_blk_t *oldblk, *newblk, *addblk;
140 140 xfs_da_intnode_t *node;
141   - xfs_dabuf_t *bp;
  141 + struct xfs_buf *bp;
142 142 int max, action, error, i;
143 143  
144 144 trace_xfs_da_split(state->args);
... ... @@ -203,7 +203,6 @@
203 203 case XFS_DA_NODE_MAGIC:
204 204 error = xfs_da_node_split(state, oldblk, newblk, addblk,
205 205 max - i, &action);
206   - xfs_da_buf_done(addblk->bp);
207 206 addblk->bp = NULL;
208 207 if (error)
209 208 return(error); /* GROT: dir is inconsistent */
... ... @@ -221,13 +220,6 @@
221 220 * Update the btree to show the new hashval for this child.
222 221 */
223 222 xfs_da_fixhashpath(state, &state->path);
224   - /*
225   - * If we won't need this block again, it's getting dropped
226   - * from the active path by the loop control, so we need
227   - * to mark it done now.
228   - */
229   - if (i > 0 || !addblk)
230   - xfs_da_buf_done(oldblk->bp);
231 223 }
232 224 if (!addblk)
233 225 return(0);
... ... @@ -239,8 +231,6 @@
239 231 oldblk = &state->path.blk[0];
240 232 error = xfs_da_root_split(state, oldblk, addblk);
241 233 if (error) {
242   - xfs_da_buf_done(oldblk->bp);
243   - xfs_da_buf_done(addblk->bp);
244 234 addblk->bp = NULL;
245 235 return(error); /* GROT: dir is inconsistent */
246 236 }
... ... @@ -252,7 +242,7 @@
252 242 * and the original block 0 could be at any position in the list.
253 243 */
254 244  
255   - node = oldblk->bp->data;
  245 + node = oldblk->bp->b_addr;
256 246 if (node->hdr.info.forw) {
257 247 if (be32_to_cpu(node->hdr.info.forw) == addblk->blkno) {
258 248 bp = addblk->bp;
259 249  
260 250  
... ... @@ -260,13 +250,13 @@
260 250 ASSERT(state->extravalid);
261 251 bp = state->extrablk.bp;
262 252 }
263   - node = bp->data;
  253 + node = bp->b_addr;
264 254 node->hdr.info.back = cpu_to_be32(oldblk->blkno);
265   - xfs_da_log_buf(state->args->trans, bp,
  255 + xfs_trans_log_buf(state->args->trans, bp,
266 256 XFS_DA_LOGRANGE(node, &node->hdr.info,
267 257 sizeof(node->hdr.info)));
268 258 }
269   - node = oldblk->bp->data;
  259 + node = oldblk->bp->b_addr;
270 260 if (node->hdr.info.back) {
271 261 if (be32_to_cpu(node->hdr.info.back) == addblk->blkno) {
272 262 bp = addblk->bp;
273 263  
274 264  
... ... @@ -274,14 +264,12 @@
274 264 ASSERT(state->extravalid);
275 265 bp = state->extrablk.bp;
276 266 }
277   - node = bp->data;
  267 + node = bp->b_addr;
278 268 node->hdr.info.forw = cpu_to_be32(oldblk->blkno);
279   - xfs_da_log_buf(state->args->trans, bp,
  269 + xfs_trans_log_buf(state->args->trans, bp,
280 270 XFS_DA_LOGRANGE(node, &node->hdr.info,
281 271 sizeof(node->hdr.info)));
282 272 }
283   - xfs_da_buf_done(oldblk->bp);
284   - xfs_da_buf_done(addblk->bp);
285 273 addblk->bp = NULL;
286 274 return(0);
287 275 }
... ... @@ -298,7 +286,7 @@
298 286 xfs_da_intnode_t *node, *oldroot;
299 287 xfs_da_args_t *args;
300 288 xfs_dablk_t blkno;
301   - xfs_dabuf_t *bp;
  289 + struct xfs_buf *bp;
302 290 int error, size;
303 291 xfs_inode_t *dp;
304 292 xfs_trans_t *tp;
... ... @@ -323,8 +311,8 @@
323 311 if (error)
324 312 return(error);
325 313 ASSERT(bp != NULL);
326   - node = bp->data;
327   - oldroot = blk1->bp->data;
  314 + node = bp->b_addr;
  315 + oldroot = blk1->bp->b_addr;
328 316 if (oldroot->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC)) {
329 317 size = (int)((char *)&oldroot->btree[be16_to_cpu(oldroot->hdr.count)] -
330 318 (char *)oldroot);
... ... @@ -335,8 +323,7 @@
335 323 (char *)leaf);
336 324 }
337 325 memcpy(node, oldroot, size);
338   - xfs_da_log_buf(tp, bp, 0, size - 1);
339   - xfs_da_buf_done(blk1->bp);
  326 + xfs_trans_log_buf(tp, bp, 0, size - 1);
340 327 blk1->bp = bp;
341 328 blk1->blkno = blkno;
342 329  
... ... @@ -348,7 +335,7 @@
348 335 be16_to_cpu(node->hdr.level) + 1, &bp, args->whichfork);
349 336 if (error)
350 337 return(error);
351   - node = bp->data;
  338 + node = bp->b_addr;
352 339 node->btree[0].hashval = cpu_to_be32(blk1->hashval);
353 340 node->btree[0].before = cpu_to_be32(blk1->blkno);
354 341 node->btree[1].hashval = cpu_to_be32(blk2->hashval);
355 342  
... ... @@ -365,10 +352,9 @@
365 352 #endif
366 353  
367 354 /* Header is already logged by xfs_da_node_create */
368   - xfs_da_log_buf(tp, bp,
  355 + xfs_trans_log_buf(tp, bp,
369 356 XFS_DA_LOGRANGE(node, node->btree,
370 357 sizeof(xfs_da_node_entry_t) * 2));
371   - xfs_da_buf_done(bp);
372 358  
373 359 return(0);
374 360 }
... ... @@ -389,7 +375,7 @@
389 375  
390 376 trace_xfs_da_node_split(state->args);
391 377  
392   - node = oldblk->bp->data;
  378 + node = oldblk->bp->b_addr;
393 379 ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
394 380  
395 381 /*
... ... @@ -436,7 +422,7 @@
436 422 *
437 423 * If we had double-split op below us, then add the extra block too.
438 424 */
439   - node = oldblk->bp->data;
  425 + node = oldblk->bp->b_addr;
440 426 if (oldblk->index <= be16_to_cpu(node->hdr.count)) {
441 427 oldblk->index++;
442 428 xfs_da_node_add(state, oldblk, addblk);
... ... @@ -477,8 +463,8 @@
477 463  
478 464 trace_xfs_da_node_rebalance(state->args);
479 465  
480   - node1 = blk1->bp->data;
481   - node2 = blk2->bp->data;
  466 + node1 = blk1->bp->b_addr;
  467 + node2 = blk2->bp->b_addr;
482 468 /*
483 469 * Figure out how many entries need to move, and in which direction.
484 470 * Swap the nodes around if that makes it simpler.
... ... @@ -532,7 +518,7 @@
532 518 btree_d = &node1->btree[be16_to_cpu(node1->hdr.count)];
533 519 memcpy(btree_d, btree_s, tmp);
534 520 be16_add_cpu(&node1->hdr.count, count);
535   - xfs_da_log_buf(tp, blk1->bp,
  521 + xfs_trans_log_buf(tp, blk1->bp,
536 522 XFS_DA_LOGRANGE(node1, btree_d, tmp));
537 523  
538 524 /*
539 525  
... ... @@ -549,9 +535,9 @@
549 535 /*
550 536 * Log header of node 1 and all current bits of node 2.
551 537 */
552   - xfs_da_log_buf(tp, blk1->bp,
  538 + xfs_trans_log_buf(tp, blk1->bp,
553 539 XFS_DA_LOGRANGE(node1, &node1->hdr, sizeof(node1->hdr)));
554   - xfs_da_log_buf(tp, blk2->bp,
  540 + xfs_trans_log_buf(tp, blk2->bp,
555 541 XFS_DA_LOGRANGE(node2, &node2->hdr,
556 542 sizeof(node2->hdr) +
557 543 sizeof(node2->btree[0]) * be16_to_cpu(node2->hdr.count)));
... ... @@ -560,8 +546,8 @@
560 546 * Record the last hashval from each block for upward propagation.
561 547 * (note: don't use the swapped node pointers)
562 548 */
563   - node1 = blk1->bp->data;
564   - node2 = blk2->bp->data;
  549 + node1 = blk1->bp->b_addr;
  550 + node2 = blk2->bp->b_addr;
565 551 blk1->hashval = be32_to_cpu(node1->btree[be16_to_cpu(node1->hdr.count)-1].hashval);
566 552 blk2->hashval = be32_to_cpu(node2->btree[be16_to_cpu(node2->hdr.count)-1].hashval);
567 553  
... ... @@ -587,7 +573,7 @@
587 573  
588 574 trace_xfs_da_node_add(state->args);
589 575  
590   - node = oldblk->bp->data;
  576 + node = oldblk->bp->b_addr;
591 577 ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
592 578 ASSERT((oldblk->index >= 0) && (oldblk->index <= be16_to_cpu(node->hdr.count)));
593 579 ASSERT(newblk->blkno != 0);
594 580  
... ... @@ -606,10 +592,10 @@
606 592 }
607 593 btree->hashval = cpu_to_be32(newblk->hashval);
608 594 btree->before = cpu_to_be32(newblk->blkno);
609   - xfs_da_log_buf(state->args->trans, oldblk->bp,
  595 + xfs_trans_log_buf(state->args->trans, oldblk->bp,
610 596 XFS_DA_LOGRANGE(node, btree, tmp + sizeof(*btree)));
611 597 be16_add_cpu(&node->hdr.count, 1);
612   - xfs_da_log_buf(state->args->trans, oldblk->bp,
  598 + xfs_trans_log_buf(state->args->trans, oldblk->bp,
613 599 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr)));
614 600  
615 601 /*
... ... @@ -735,7 +721,7 @@
735 721 xfs_da_intnode_t *oldroot;
736 722 xfs_da_args_t *args;
737 723 xfs_dablk_t child;
738   - xfs_dabuf_t *bp;
  724 + struct xfs_buf *bp;
739 725 int error;
740 726  
741 727 trace_xfs_da_root_join(state->args);
... ... @@ -743,7 +729,7 @@
743 729 args = state->args;
744 730 ASSERT(args != NULL);
745 731 ASSERT(root_blk->magic == XFS_DA_NODE_MAGIC);
746   - oldroot = root_blk->bp->data;
  732 + oldroot = root_blk->bp->b_addr;
747 733 ASSERT(oldroot->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
748 734 ASSERT(!oldroot->hdr.info.forw);
749 735 ASSERT(!oldroot->hdr.info.back);
750 736  
... ... @@ -765,11 +751,11 @@
765 751 if (error)
766 752 return(error);
767 753 ASSERT(bp != NULL);
768   - xfs_da_blkinfo_onlychild_validate(bp->data,
  754 + xfs_da_blkinfo_onlychild_validate(bp->b_addr,
769 755 be16_to_cpu(oldroot->hdr.level));
770 756  
771   - memcpy(root_blk->bp->data, bp->data, state->blocksize);
772   - xfs_da_log_buf(args->trans, root_blk->bp, 0, state->blocksize - 1);
  757 + memcpy(root_blk->bp->b_addr, bp->b_addr, state->blocksize);
  758 + xfs_trans_log_buf(args->trans, root_blk->bp, 0, state->blocksize - 1);
773 759 error = xfs_da_shrink_inode(args, child, bp);
774 760 return(error);
775 761 }
... ... @@ -791,7 +777,7 @@
791 777 xfs_da_blkinfo_t *info;
792 778 int count, forward, error, retval, i;
793 779 xfs_dablk_t blkno;
794   - xfs_dabuf_t *bp;
  780 + struct xfs_buf *bp;
795 781  
796 782 /*
797 783 * Check for the degenerate case of the block being over 50% full.
... ... @@ -799,7 +785,7 @@
799 785 * to coalesce with a sibling.
800 786 */
801 787 blk = &state->path.blk[ state->path.active-1 ];
802   - info = blk->bp->data;
  788 + info = blk->bp->b_addr;
803 789 ASSERT(info->magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
804 790 node = (xfs_da_intnode_t *)info;
805 791 count = be16_to_cpu(node->hdr.count);
806 792  
... ... @@ -859,10 +845,10 @@
859 845 count = state->node_ents;
860 846 count -= state->node_ents >> 2;
861 847 count -= be16_to_cpu(node->hdr.count);
862   - node = bp->data;
  848 + node = bp->b_addr;
863 849 ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
864 850 count -= be16_to_cpu(node->hdr.count);
865   - xfs_da_brelse(state->args->trans, bp);
  851 + xfs_trans_brelse(state->args->trans, bp);
866 852 if (count >= 0)
867 853 break; /* fits with at least 25% to spare */
868 854 }
869 855  
... ... @@ -934,14 +920,14 @@
934 920 break;
935 921 }
936 922 for (blk--, level--; level >= 0; blk--, level--) {
937   - node = blk->bp->data;
  923 + node = blk->bp->b_addr;
938 924 ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
939 925 btree = &node->btree[ blk->index ];
940 926 if (be32_to_cpu(btree->hashval) == lasthash)
941 927 break;
942 928 blk->hashval = lasthash;
943 929 btree->hashval = cpu_to_be32(lasthash);
944   - xfs_da_log_buf(state->args->trans, blk->bp,
  930 + xfs_trans_log_buf(state->args->trans, blk->bp,
945 931 XFS_DA_LOGRANGE(node, btree, sizeof(*btree)));
946 932  
947 933 lasthash = be32_to_cpu(node->btree[be16_to_cpu(node->hdr.count)-1].hashval);
... ... @@ -960,7 +946,7 @@
960 946  
961 947 trace_xfs_da_node_remove(state->args);
962 948  
963   - node = drop_blk->bp->data;
  949 + node = drop_blk->bp->b_addr;
964 950 ASSERT(drop_blk->index < be16_to_cpu(node->hdr.count));
965 951 ASSERT(drop_blk->index >= 0);
966 952  
967 953  
968 954  
... ... @@ -972,15 +958,15 @@
972 958 tmp = be16_to_cpu(node->hdr.count) - drop_blk->index - 1;
973 959 tmp *= (uint)sizeof(xfs_da_node_entry_t);
974 960 memmove(btree, btree + 1, tmp);
975   - xfs_da_log_buf(state->args->trans, drop_blk->bp,
  961 + xfs_trans_log_buf(state->args->trans, drop_blk->bp,
976 962 XFS_DA_LOGRANGE(node, btree, tmp));
977 963 btree = &node->btree[be16_to_cpu(node->hdr.count)-1];
978 964 }
979 965 memset((char *)btree, 0, sizeof(xfs_da_node_entry_t));
980   - xfs_da_log_buf(state->args->trans, drop_blk->bp,
  966 + xfs_trans_log_buf(state->args->trans, drop_blk->bp,
981 967 XFS_DA_LOGRANGE(node, btree, sizeof(*btree)));
982 968 be16_add_cpu(&node->hdr.count, -1);
983   - xfs_da_log_buf(state->args->trans, drop_blk->bp,
  969 + xfs_trans_log_buf(state->args->trans, drop_blk->bp,
984 970 XFS_DA_LOGRANGE(node, &node->hdr, sizeof(node->hdr)));
985 971  
986 972 /*
... ... @@ -1005,8 +991,8 @@
1005 991  
1006 992 trace_xfs_da_node_unbalance(state->args);
1007 993  
1008   - drop_node = drop_blk->bp->data;
1009   - save_node = save_blk->bp->data;
  994 + drop_node = drop_blk->bp->b_addr;
  995 + save_node = save_blk->bp->b_addr;
1010 996 ASSERT(drop_node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
1011 997 ASSERT(save_node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
1012 998 tp = state->args->trans;
1013 999  
... ... @@ -1023,13 +1009,13 @@
1023 1009 tmp = be16_to_cpu(save_node->hdr.count) * (uint)sizeof(xfs_da_node_entry_t);
1024 1010 memmove(btree, &save_node->btree[0], tmp);
1025 1011 btree = &save_node->btree[0];
1026   - xfs_da_log_buf(tp, save_blk->bp,
  1012 + xfs_trans_log_buf(tp, save_blk->bp,
1027 1013 XFS_DA_LOGRANGE(save_node, btree,
1028 1014 (be16_to_cpu(save_node->hdr.count) + be16_to_cpu(drop_node->hdr.count)) *
1029 1015 sizeof(xfs_da_node_entry_t)));
1030 1016 } else {
1031 1017 btree = &save_node->btree[be16_to_cpu(save_node->hdr.count)];
1032   - xfs_da_log_buf(tp, save_blk->bp,
  1018 + xfs_trans_log_buf(tp, save_blk->bp,
1033 1019 XFS_DA_LOGRANGE(save_node, btree,
1034 1020 be16_to_cpu(drop_node->hdr.count) *
1035 1021 sizeof(xfs_da_node_entry_t)));
... ... @@ -1042,7 +1028,7 @@
1042 1028 memcpy(btree, &drop_node->btree[0], tmp);
1043 1029 be16_add_cpu(&save_node->hdr.count, be16_to_cpu(drop_node->hdr.count));
1044 1030  
1045   - xfs_da_log_buf(tp, save_blk->bp,
  1031 + xfs_trans_log_buf(tp, save_blk->bp,
1046 1032 XFS_DA_LOGRANGE(save_node, &save_node->hdr,
1047 1033 sizeof(save_node->hdr)));
1048 1034  
... ... @@ -1100,7 +1086,7 @@
1100 1086 state->path.active--;
1101 1087 return(error);
1102 1088 }
1103   - curr = blk->bp->data;
  1089 + curr = blk->bp->b_addr;
1104 1090 blk->magic = be16_to_cpu(curr->magic);
1105 1091 ASSERT(blk->magic == XFS_DA_NODE_MAGIC ||
1106 1092 blk->magic == XFS_DIR2_LEAFN_MAGIC ||
... ... @@ -1110,7 +1096,7 @@
1110 1096 * Search an intermediate node for a match.
1111 1097 */
1112 1098 if (blk->magic == XFS_DA_NODE_MAGIC) {
1113   - node = blk->bp->data;
  1099 + node = blk->bp->b_addr;
1114 1100 max = be16_to_cpu(node->hdr.count);
1115 1101 blk->hashval = be32_to_cpu(node->btree[max-1].hashval);
1116 1102  
1117 1103  
... ... @@ -1216,15 +1202,15 @@
1216 1202 xfs_da_blkinfo_t *old_info, *new_info, *tmp_info;
1217 1203 xfs_da_args_t *args;
1218 1204 int before=0, error;
1219   - xfs_dabuf_t *bp;
  1205 + struct xfs_buf *bp;
1220 1206  
1221 1207 /*
1222 1208 * Set up environment.
1223 1209 */
1224 1210 args = state->args;
1225 1211 ASSERT(args != NULL);
1226   - old_info = old_blk->bp->data;
1227   - new_info = new_blk->bp->data;
  1212 + old_info = old_blk->bp->b_addr;
  1213 + new_info = new_blk->bp->b_addr;
1228 1214 ASSERT(old_blk->magic == XFS_DA_NODE_MAGIC ||
1229 1215 old_blk->magic == XFS_DIR2_LEAFN_MAGIC ||
1230 1216 old_blk->magic == XFS_ATTR_LEAF_MAGIC);
1231 1217  
... ... @@ -1261,12 +1247,11 @@
1261 1247 if (error)
1262 1248 return(error);
1263 1249 ASSERT(bp != NULL);
1264   - tmp_info = bp->data;
  1250 + tmp_info = bp->b_addr;
1265 1251 ASSERT(be16_to_cpu(tmp_info->magic) == be16_to_cpu(old_info->magic));
1266 1252 ASSERT(be32_to_cpu(tmp_info->forw) == old_blk->blkno);
1267 1253 tmp_info->forw = cpu_to_be32(new_blk->blkno);
1268   - xfs_da_log_buf(args->trans, bp, 0, sizeof(*tmp_info)-1);
1269   - xfs_da_buf_done(bp);
  1254 + xfs_trans_log_buf(args->trans, bp, 0, sizeof(*tmp_info)-1);
1270 1255 }
1271 1256 old_info->back = cpu_to_be32(new_blk->blkno);
1272 1257 } else {
1273 1258  
1274 1259  
... ... @@ -1283,18 +1268,17 @@
1283 1268 if (error)
1284 1269 return(error);
1285 1270 ASSERT(bp != NULL);
1286   - tmp_info = bp->data;
  1271 + tmp_info = bp->b_addr;
1287 1272 ASSERT(tmp_info->magic == old_info->magic);
1288 1273 ASSERT(be32_to_cpu(tmp_info->back) == old_blk->blkno);
1289 1274 tmp_info->back = cpu_to_be32(new_blk->blkno);
1290   - xfs_da_log_buf(args->trans, bp, 0, sizeof(*tmp_info)-1);
1291   - xfs_da_buf_done(bp);
  1275 + xfs_trans_log_buf(args->trans, bp, 0, sizeof(*tmp_info)-1);
1292 1276 }
1293 1277 old_info->forw = cpu_to_be32(new_blk->blkno);
1294 1278 }
1295 1279  
1296   - xfs_da_log_buf(args->trans, old_blk->bp, 0, sizeof(*tmp_info) - 1);
1297   - xfs_da_log_buf(args->trans, new_blk->bp, 0, sizeof(*tmp_info) - 1);
  1280 + xfs_trans_log_buf(args->trans, old_blk->bp, 0, sizeof(*tmp_info) - 1);
  1281 + xfs_trans_log_buf(args->trans, new_blk->bp, 0, sizeof(*tmp_info) - 1);
1298 1282 return(0);
1299 1283 }
1300 1284  
1301 1285  
... ... @@ -1302,12 +1286,14 @@
1302 1286 * Compare two intermediate nodes for "order".
1303 1287 */
1304 1288 STATIC int
1305   -xfs_da_node_order(xfs_dabuf_t *node1_bp, xfs_dabuf_t *node2_bp)
  1289 +xfs_da_node_order(
  1290 + struct xfs_buf *node1_bp,
  1291 + struct xfs_buf *node2_bp)
1306 1292 {
1307 1293 xfs_da_intnode_t *node1, *node2;
1308 1294  
1309   - node1 = node1_bp->data;
1310   - node2 = node2_bp->data;
  1295 + node1 = node1_bp->b_addr;
  1296 + node2 = node2_bp->b_addr;
1311 1297 ASSERT(node1->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC) &&
1312 1298 node2->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
1313 1299 if ((be16_to_cpu(node1->hdr.count) > 0) && (be16_to_cpu(node2->hdr.count) > 0) &&
1314 1300  
... ... @@ -1324,11 +1310,13 @@
1324 1310 * Pick up the last hashvalue from an intermediate node.
1325 1311 */
1326 1312 STATIC uint
1327   -xfs_da_node_lasthash(xfs_dabuf_t *bp, int *count)
  1313 +xfs_da_node_lasthash(
  1314 + struct xfs_buf *bp,
  1315 + int *count)
1328 1316 {
1329 1317 xfs_da_intnode_t *node;
1330 1318  
1331   - node = bp->data;
  1319 + node = bp->b_addr;
1332 1320 ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
1333 1321 if (count)
1334 1322 *count = be16_to_cpu(node->hdr.count);
... ... @@ -1346,7 +1334,7 @@
1346 1334 {
1347 1335 xfs_da_blkinfo_t *drop_info, *save_info, *tmp_info;
1348 1336 xfs_da_args_t *args;
1349   - xfs_dabuf_t *bp;
  1337 + struct xfs_buf *bp;
1350 1338 int error;
1351 1339  
1352 1340 /*
... ... @@ -1354,8 +1342,8 @@
1354 1342 */
1355 1343 args = state->args;
1356 1344 ASSERT(args != NULL);
1357   - save_info = save_blk->bp->data;
1358   - drop_info = drop_blk->bp->data;
  1345 + save_info = save_blk->bp->b_addr;
  1346 + drop_info = drop_blk->bp->b_addr;
1359 1347 ASSERT(save_blk->magic == XFS_DA_NODE_MAGIC ||
1360 1348 save_blk->magic == XFS_DIR2_LEAFN_MAGIC ||
1361 1349 save_blk->magic == XFS_ATTR_LEAF_MAGIC);
1362 1350  
1363 1351  
... ... @@ -1380,13 +1368,12 @@
1380 1368 if (error)
1381 1369 return(error);
1382 1370 ASSERT(bp != NULL);
1383   - tmp_info = bp->data;
  1371 + tmp_info = bp->b_addr;
1384 1372 ASSERT(tmp_info->magic == save_info->magic);
1385 1373 ASSERT(be32_to_cpu(tmp_info->forw) == drop_blk->blkno);
1386 1374 tmp_info->forw = cpu_to_be32(save_blk->blkno);
1387   - xfs_da_log_buf(args->trans, bp, 0,
  1375 + xfs_trans_log_buf(args->trans, bp, 0,
1388 1376 sizeof(*tmp_info) - 1);
1389   - xfs_da_buf_done(bp);
1390 1377 }
1391 1378 } else {
1392 1379 trace_xfs_da_unlink_forward(args);
1393 1380  
1394 1381  
1395 1382  
... ... @@ -1398,17 +1385,16 @@
1398 1385 if (error)
1399 1386 return(error);
1400 1387 ASSERT(bp != NULL);
1401   - tmp_info = bp->data;
  1388 + tmp_info = bp->b_addr;
1402 1389 ASSERT(tmp_info->magic == save_info->magic);
1403 1390 ASSERT(be32_to_cpu(tmp_info->back) == drop_blk->blkno);
1404 1391 tmp_info->back = cpu_to_be32(save_blk->blkno);
1405   - xfs_da_log_buf(args->trans, bp, 0,
  1392 + xfs_trans_log_buf(args->trans, bp, 0,
1406 1393 sizeof(*tmp_info) - 1);
1407   - xfs_da_buf_done(bp);
1408 1394 }
1409 1395 }
1410 1396  
1411   - xfs_da_log_buf(args->trans, save_blk->bp, 0, sizeof(*save_info) - 1);
  1397 + xfs_trans_log_buf(args->trans, save_blk->bp, 0, sizeof(*save_info) - 1);
1412 1398 return(0);
1413 1399 }
1414 1400  
... ... @@ -1443,7 +1429,7 @@
1443 1429 level = (path->active-1) - 1; /* skip bottom layer in path */
1444 1430 for (blk = &path->blk[level]; level >= 0; blk--, level--) {
1445 1431 ASSERT(blk->bp != NULL);
1446   - node = blk->bp->data;
  1432 + node = blk->bp->b_addr;
1447 1433 ASSERT(node->hdr.info.magic == cpu_to_be16(XFS_DA_NODE_MAGIC));
1448 1434 if (forward && (blk->index < be16_to_cpu(node->hdr.count)-1)) {
1449 1435 blk->index++;
... ... @@ -1471,7 +1457,7 @@
1471 1457 * (if it's dirty, trans won't actually let go)
1472 1458 */
1473 1459 if (release)
1474   - xfs_da_brelse(args->trans, blk->bp);
  1460 + xfs_trans_brelse(args->trans, blk->bp);
1475 1461  
1476 1462 /*
1477 1463 * Read the next child block.
... ... @@ -1482,7 +1468,7 @@
1482 1468 if (error)
1483 1469 return(error);
1484 1470 ASSERT(blk->bp != NULL);
1485   - info = blk->bp->data;
  1471 + info = blk->bp->b_addr;
1486 1472 ASSERT(info->magic == cpu_to_be16(XFS_DA_NODE_MAGIC) ||
1487 1473 info->magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC) ||
1488 1474 info->magic == cpu_to_be16(XFS_ATTR_LEAF_MAGIC));
1489 1475  
... ... @@ -1702,11 +1688,13 @@
1702 1688 * a bmap btree split to do that.
1703 1689 */
1704 1690 STATIC int
1705   -xfs_da_swap_lastblock(xfs_da_args_t *args, xfs_dablk_t *dead_blknop,
1706   - xfs_dabuf_t **dead_bufp)
  1691 +xfs_da_swap_lastblock(
  1692 + xfs_da_args_t *args,
  1693 + xfs_dablk_t *dead_blknop,
  1694 + struct xfs_buf **dead_bufp)
1707 1695 {
1708 1696 xfs_dablk_t dead_blkno, last_blkno, sib_blkno, par_blkno;
1709   - xfs_dabuf_t *dead_buf, *last_buf, *sib_buf, *par_buf;
  1697 + struct xfs_buf *dead_buf, *last_buf, *sib_buf, *par_buf;
1710 1698 xfs_fileoff_t lastoff;
1711 1699 xfs_inode_t *ip;
1712 1700 xfs_trans_t *tp;
... ... @@ -1744,9 +1732,9 @@
1744 1732 /*
1745 1733 * Copy the last block into the dead buffer and log it.
1746 1734 */
1747   - memcpy(dead_buf->data, last_buf->data, mp->m_dirblksize);
1748   - xfs_da_log_buf(tp, dead_buf, 0, mp->m_dirblksize - 1);
1749   - dead_info = dead_buf->data;
  1735 + memcpy(dead_buf->b_addr, last_buf->b_addr, mp->m_dirblksize);
  1736 + xfs_trans_log_buf(tp, dead_buf, 0, mp->m_dirblksize - 1);
  1737 + dead_info = dead_buf->b_addr;
1750 1738 /*
1751 1739 * Get values from the moved block.
1752 1740 */
... ... @@ -1767,7 +1755,7 @@
1767 1755 if ((sib_blkno = be32_to_cpu(dead_info->back))) {
1768 1756 if ((error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w)))
1769 1757 goto done;
1770   - sib_info = sib_buf->data;
  1758 + sib_info = sib_buf->b_addr;
1771 1759 if (unlikely(
1772 1760 be32_to_cpu(sib_info->forw) != last_blkno ||
1773 1761 sib_info->magic != dead_info->magic)) {
1774 1762  
... ... @@ -1777,10 +1765,9 @@
1777 1765 goto done;
1778 1766 }
1779 1767 sib_info->forw = cpu_to_be32(dead_blkno);
1780   - xfs_da_log_buf(tp, sib_buf,
  1768 + xfs_trans_log_buf(tp, sib_buf,
1781 1769 XFS_DA_LOGRANGE(sib_info, &sib_info->forw,
1782 1770 sizeof(sib_info->forw)));
1783   - xfs_da_buf_done(sib_buf);
1784 1771 sib_buf = NULL;
1785 1772 }
1786 1773 /*
... ... @@ -1789,7 +1776,7 @@
1789 1776 if ((sib_blkno = be32_to_cpu(dead_info->forw))) {
1790 1777 if ((error = xfs_da_read_buf(tp, ip, sib_blkno, -1, &sib_buf, w)))
1791 1778 goto done;
1792   - sib_info = sib_buf->data;
  1779 + sib_info = sib_buf->b_addr;
1793 1780 if (unlikely(
1794 1781 be32_to_cpu(sib_info->back) != last_blkno ||
1795 1782 sib_info->magic != dead_info->magic)) {
1796 1783  
... ... @@ -1799,10 +1786,9 @@
1799 1786 goto done;
1800 1787 }
1801 1788 sib_info->back = cpu_to_be32(dead_blkno);
1802   - xfs_da_log_buf(tp, sib_buf,
  1789 + xfs_trans_log_buf(tp, sib_buf,
1803 1790 XFS_DA_LOGRANGE(sib_info, &sib_info->back,
1804 1791 sizeof(sib_info->back)));
1805   - xfs_da_buf_done(sib_buf);
1806 1792 sib_buf = NULL;
1807 1793 }
1808 1794 par_blkno = mp->m_dirleafblk;
... ... @@ -1813,7 +1799,7 @@
1813 1799 for (;;) {
1814 1800 if ((error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w)))
1815 1801 goto done;
1816   - par_node = par_buf->data;
  1802 + par_node = par_buf->b_addr;
1817 1803 if (unlikely(par_node->hdr.info.magic !=
1818 1804 cpu_to_be16(XFS_DA_NODE_MAGIC) ||
1819 1805 (level >= 0 && level != be16_to_cpu(par_node->hdr.level) + 1))) {
... ... @@ -1837,7 +1823,7 @@
1837 1823 par_blkno = be32_to_cpu(par_node->btree[entno].before);
1838 1824 if (level == dead_level + 1)
1839 1825 break;
1840   - xfs_da_brelse(tp, par_buf);
  1826 + xfs_trans_brelse(tp, par_buf);
1841 1827 par_buf = NULL;
1842 1828 }
1843 1829 /*
... ... @@ -1853,7 +1839,7 @@
1853 1839 if (entno < be16_to_cpu(par_node->hdr.count))
1854 1840 break;
1855 1841 par_blkno = be32_to_cpu(par_node->hdr.info.forw);
1856   - xfs_da_brelse(tp, par_buf);
  1842 + xfs_trans_brelse(tp, par_buf);
1857 1843 par_buf = NULL;
1858 1844 if (unlikely(par_blkno == 0)) {
1859 1845 XFS_ERROR_REPORT("xfs_da_swap_lastblock(6)",
... ... @@ -1863,7 +1849,7 @@
1863 1849 }
1864 1850 if ((error = xfs_da_read_buf(tp, ip, par_blkno, -1, &par_buf, w)))
1865 1851 goto done;
1866   - par_node = par_buf->data;
  1852 + par_node = par_buf->b_addr;
1867 1853 if (unlikely(
1868 1854 be16_to_cpu(par_node->hdr.level) != level ||
1869 1855 par_node->hdr.info.magic != cpu_to_be16(XFS_DA_NODE_MAGIC))) {
1870 1856  
1871 1857  
1872 1858  
... ... @@ -1878,20 +1864,18 @@
1878 1864 * Update the parent entry pointing to the moved block.
1879 1865 */
1880 1866 par_node->btree[entno].before = cpu_to_be32(dead_blkno);
1881   - xfs_da_log_buf(tp, par_buf,
  1867 + xfs_trans_log_buf(tp, par_buf,
1882 1868 XFS_DA_LOGRANGE(par_node, &par_node->btree[entno].before,
1883 1869 sizeof(par_node->btree[entno].before)));
1884   - xfs_da_buf_done(par_buf);
1885   - xfs_da_buf_done(dead_buf);
1886 1870 *dead_blknop = last_blkno;
1887 1871 *dead_bufp = last_buf;
1888 1872 return 0;
1889 1873 done:
1890 1874 if (par_buf)
1891   - xfs_da_brelse(tp, par_buf);
  1875 + xfs_trans_brelse(tp, par_buf);
1892 1876 if (sib_buf)
1893   - xfs_da_brelse(tp, sib_buf);
1894   - xfs_da_brelse(tp, last_buf);
  1877 + xfs_trans_brelse(tp, sib_buf);
  1878 + xfs_trans_brelse(tp, last_buf);
1895 1879 return error;
1896 1880 }
1897 1881  
... ... @@ -1899,8 +1883,10 @@
1899 1883 * Remove a btree block from a directory or attribute.
1900 1884 */
1901 1885 int
1902   -xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
1903   - xfs_dabuf_t *dead_buf)
  1886 +xfs_da_shrink_inode(
  1887 + xfs_da_args_t *args,
  1888 + xfs_dablk_t dead_blkno,
  1889 + struct xfs_buf *dead_buf)
1904 1890 {
1905 1891 xfs_inode_t *dp;
1906 1892 int done, error, w, count;
... ... @@ -1935,7 +1921,7 @@
1935 1921 break;
1936 1922 }
1937 1923 }
1938   - xfs_da_binval(tp, dead_buf);
  1924 + xfs_trans_binval(tp, dead_buf);
1939 1925 return error;
1940 1926 }
1941 1927  
... ... @@ -2099,7 +2085,7 @@
2099 2085 struct xfs_inode *dp,
2100 2086 xfs_dablk_t bno,
2101 2087 xfs_daddr_t mappedbno,
2102   - xfs_dabuf_t **bpp,
  2088 + struct xfs_buf **bpp,
2103 2089 int whichfork)
2104 2090 {
2105 2091 struct xfs_buf *bp;
... ... @@ -2128,7 +2114,7 @@
2128 2114 goto out_free;
2129 2115 }
2130 2116  
2131   - *bpp = xfs_da_buf_make(bp);
  2117 + *bpp = bp;
2132 2118  
2133 2119 out_free:
2134 2120 if (mapp != &map)
... ... @@ -2146,7 +2132,7 @@
2146 2132 struct xfs_inode *dp,
2147 2133 xfs_dablk_t bno,
2148 2134 xfs_daddr_t mappedbno,
2149   - xfs_dabuf_t **bpp,
  2135 + struct xfs_buf **bpp,
2150 2136 int whichfork)
2151 2137 {
2152 2138 struct xfs_buf *bp;
2153 2139  
... ... @@ -2178,16 +2164,14 @@
2178 2164 else
2179 2165 xfs_buf_set_ref(bp, XFS_DIR_BTREE_REF);
2180 2166  
2181   - *bpp = xfs_da_buf_make(bp);
2182   -
2183 2167 /*
2184 2168 * This verification code will be moved to a CRC verification callback
2185 2169 * function so just leave it here unchanged until then.
2186 2170 */
2187 2171 {
2188   - xfs_dir2_data_hdr_t *hdr = (*bpp)->data;
2189   - xfs_dir2_free_t *free = (*bpp)->data;
2190   - xfs_da_blkinfo_t *info = (*bpp)->data;
  2172 + xfs_dir2_data_hdr_t *hdr = bp->b_addr;
  2173 + xfs_dir2_free_t *free = bp->b_addr;
  2174 + xfs_da_blkinfo_t *info = bp->b_addr;
2191 2175 uint magic, magic1;
2192 2176 struct xfs_mount *mp = dp->i_mount;
2193 2177  
2194 2178  
... ... @@ -2207,11 +2191,11 @@
2207 2191 XFS_CORRUPTION_ERROR("xfs_da_do_buf(2)",
2208 2192 XFS_ERRLEVEL_LOW, mp, info);
2209 2193 error = XFS_ERROR(EFSCORRUPTED);
2210   - xfs_da_brelse(trans, *bpp);
  2194 + xfs_trans_brelse(trans, bp);
2211 2195 goto out_free;
2212 2196 }
2213 2197 }
2214   -
  2198 + *bpp = bp;
2215 2199 out_free:
2216 2200 if (mapp != &map)
2217 2201 kmem_free(mapp);
... ... @@ -2259,7 +2243,6 @@
2259 2243 }
2260 2244  
2261 2245 kmem_zone_t *xfs_da_state_zone; /* anchor for state struct zone */
2262   -kmem_zone_t *xfs_dabuf_zone; /* dabuf zone */
2263 2246  
2264 2247 /*
2265 2248 * Allocate a dir-state structure.
... ... @@ -2279,13 +2262,8 @@
2279 2262 {
2280 2263 int i;
2281 2264  
2282   - for (i = 0; i < state->altpath.active; i++) {
2283   - if (state->altpath.blk[i].bp) {
2284   - if (state->altpath.blk[i].bp != state->path.blk[i].bp)
2285   - xfs_da_buf_done(state->altpath.blk[i].bp);
2286   - state->altpath.blk[i].bp = NULL;
2287   - }
2288   - }
  2265 + for (i = 0; i < state->altpath.active; i++)
  2266 + state->altpath.blk[i].bp = NULL;
2289 2267 state->altpath.active = 0;
2290 2268 }
2291 2269  
2292 2270  
2293 2271  
... ... @@ -2295,89 +2273,10 @@
2295 2273 void
2296 2274 xfs_da_state_free(xfs_da_state_t *state)
2297 2275 {
2298   - int i;
2299   -
2300 2276 xfs_da_state_kill_altpath(state);
2301   - for (i = 0; i < state->path.active; i++) {
2302   - if (state->path.blk[i].bp)
2303   - xfs_da_buf_done(state->path.blk[i].bp);
2304   - }
2305   - if (state->extravalid && state->extrablk.bp)
2306   - xfs_da_buf_done(state->extrablk.bp);
2307 2277 #ifdef DEBUG
2308 2278 memset((char *)state, 0, sizeof(*state));
2309 2279 #endif /* DEBUG */
2310 2280 kmem_zone_free(xfs_da_state_zone, state);
2311   -}
2312   -
2313   -/*
2314   - * Create a dabuf.
2315   - */
2316   -/* ARGSUSED */
2317   -STATIC xfs_dabuf_t *
2318   -xfs_da_buf_make(xfs_buf_t *bp)
2319   -{
2320   - xfs_dabuf_t *dabuf;
2321   -
2322   - dabuf = kmem_zone_alloc(xfs_dabuf_zone, KM_NOFS);
2323   - dabuf->bbcount = bp->b_length;
2324   - dabuf->data = bp->b_addr;
2325   - dabuf->bp = bp;
2326   - return dabuf;
2327   -}
2328   -
2329   -/*
2330   - * Release a dabuf.
2331   - */
2332   -void
2333   -xfs_da_buf_done(xfs_dabuf_t *dabuf)
2334   -{
2335   - ASSERT(dabuf->data && dabuf->bbcount && dabuf->bp);
2336   - kmem_zone_free(xfs_dabuf_zone, dabuf);
2337   -}
2338   -
2339   -/*
2340   - * Log transaction from a dabuf.
2341   - */
2342   -void
2343   -xfs_da_log_buf(xfs_trans_t *tp, xfs_dabuf_t *dabuf, uint first, uint last)
2344   -{
2345   - ASSERT(dabuf->data && dabuf->bbcount && dabuf->bp);
2346   - ASSERT(dabuf->data == dabuf->bp->b_addr);
2347   - xfs_trans_log_buf(tp, dabuf->bp, first, last);
2348   -}
2349   -
2350   -/*
2351   - * Release dabuf from a transaction.
2352   - * Have to free up the dabuf before the buffers are released,
2353   - * since the synchronization on the dabuf is really the lock on the buffer.
2354   - */
2355   -void
2356   -xfs_da_brelse(xfs_trans_t *tp, xfs_dabuf_t *dabuf)
2357   -{
2358   - ASSERT(dabuf->data && dabuf->bbcount && dabuf->bp);
2359   - xfs_trans_brelse(tp, dabuf->bp);
2360   - xfs_da_buf_done(dabuf);
2361   -}
2362   -
2363   -/*
2364   - * Invalidate dabuf from a transaction.
2365   - */
2366   -void
2367   -xfs_da_binval(xfs_trans_t *tp, xfs_dabuf_t *dabuf)
2368   -{
2369   - ASSERT(dabuf->data && dabuf->bbcount && dabuf->bp);
2370   - xfs_da_buf_done(dabuf);
2371   - xfs_trans_binval(tp, dabuf->bp);
2372   -}
2373   -
2374   -/*
2375   - * Get the first daddr from a dabuf.
2376   - */
2377   -xfs_daddr_t
2378   -xfs_da_blkno(xfs_dabuf_t *dabuf)
2379   -{
2380   - ASSERT(dabuf->data);
2381   - return XFS_BUF_ADDR(dabuf->bp);
2382 2281 }
fs/xfs/xfs_da_btree.h
... ... @@ -133,20 +133,6 @@
133 133 { XFS_DA_OP_CILOOKUP, "CILOOKUP" }
134 134  
135 135 /*
136   - * Structure to describe buffer(s) for a block.
137   - * This is needed in the directory version 2 format case, when
138   - * multiple non-contiguous fsblocks might be needed to cover one
139   - * logical directory block.
140   - * If the buffer count is 1 then the data pointer points to the
141   - * same place as the b_addr field for the buffer, else to kmem_alloced memory.
142   - */
143   -typedef struct xfs_dabuf {
144   - short bbcount; /* how large is data in bbs */
145   - void *data; /* pointer for buffers' data */
146   - struct xfs_buf *bp; /* actually nbuf of these */
147   -} xfs_dabuf_t;
148   -
149   -/*
150 136 * Storage for holding state during Btree searches and split/join ops.
151 137 *
152 138 * Only need space for 5 intermediate nodes. With a minimum of 62-way
... ... @@ -154,7 +140,7 @@
154 140 * which is slightly more than enough.
155 141 */
156 142 typedef struct xfs_da_state_blk {
157   - xfs_dabuf_t *bp; /* buffer containing block */
  143 + struct xfs_buf *bp; /* buffer containing block */
158 144 xfs_dablk_t blkno; /* filesystem blkno of buffer */
159 145 xfs_daddr_t disk_blkno; /* on-disk blkno (in BBs) of buffer */
160 146 int index; /* relevant index into block */
... ... @@ -207,7 +193,7 @@
207 193 * Routines used for growing the Btree.
208 194 */
209 195 int xfs_da_node_create(xfs_da_args_t *args, xfs_dablk_t blkno, int level,
210   - xfs_dabuf_t **bpp, int whichfork);
  196 + struct xfs_buf **bpp, int whichfork);
211 197 int xfs_da_split(xfs_da_state_t *state);
212 198  
213 199 /*
214 200  
215 201  
... ... @@ -237,14 +223,14 @@
237 223 int count);
238 224 int xfs_da_get_buf(struct xfs_trans *trans, struct xfs_inode *dp,
239 225 xfs_dablk_t bno, xfs_daddr_t mappedbno,
240   - xfs_dabuf_t **bp, int whichfork);
  226 + struct xfs_buf **bp, int whichfork);
241 227 int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp,
242 228 xfs_dablk_t bno, xfs_daddr_t mappedbno,
243   - xfs_dabuf_t **bpp, int whichfork);
  229 + struct xfs_buf **bpp, int whichfork);
244 230 xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp,
245 231 xfs_dablk_t bno, int whichfork);
246 232 int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
247   - xfs_dabuf_t *dead_buf);
  233 + struct xfs_buf *dead_buf);
248 234  
249 235 uint xfs_da_hashname(const __uint8_t *name_string, int name_length);
250 236 enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args,
251 237  
... ... @@ -254,15 +240,7 @@
254 240 xfs_da_state_t *xfs_da_state_alloc(void);
255 241 void xfs_da_state_free(xfs_da_state_t *state);
256 242  
257   -void xfs_da_buf_done(xfs_dabuf_t *dabuf);
258   -void xfs_da_log_buf(struct xfs_trans *tp, xfs_dabuf_t *dabuf, uint first,
259   - uint last);
260   -void xfs_da_brelse(struct xfs_trans *tp, xfs_dabuf_t *dabuf);
261   -void xfs_da_binval(struct xfs_trans *tp, xfs_dabuf_t *dabuf);
262   -xfs_daddr_t xfs_da_blkno(xfs_dabuf_t *dabuf);
263   -
264 243 extern struct kmem_zone *xfs_da_state_zone;
265   -extern struct kmem_zone *xfs_dabuf_zone;
266 244 extern const struct xfs_nameops xfs_default_nameops;
267 245  
268 246 #endif /* __XFS_DA_BTREE_H__ */
... ... @@ -592,7 +592,7 @@
592 592 xfs_dir2_shrink_inode(
593 593 xfs_da_args_t *args,
594 594 xfs_dir2_db_t db,
595   - xfs_dabuf_t *bp)
  595 + struct xfs_buf *bp)
596 596 {
597 597 xfs_fileoff_t bno; /* directory file offset */
598 598 xfs_dablk_t da; /* directory file offset */
... ... @@ -634,7 +634,7 @@
634 634 /*
635 635 * Invalidate the buffer from the transaction.
636 636 */
637   - xfs_da_binval(tp, bp);
  637 + xfs_trans_binval(tp, bp);
638 638 /*
639 639 * If it's not a data block, we're done.
640 640 */
fs/xfs/xfs_dir2_block.c
... ... @@ -37,10 +37,10 @@
37 37 /*
38 38 * Local function prototypes.
39 39 */
40   -static void xfs_dir2_block_log_leaf(xfs_trans_t *tp, xfs_dabuf_t *bp, int first,
41   - int last);
42   -static void xfs_dir2_block_log_tail(xfs_trans_t *tp, xfs_dabuf_t *bp);
43   -static int xfs_dir2_block_lookup_int(xfs_da_args_t *args, xfs_dabuf_t **bpp,
  40 +static void xfs_dir2_block_log_leaf(xfs_trans_t *tp, struct xfs_buf *bp,
  41 + int first, int last);
  42 +static void xfs_dir2_block_log_tail(xfs_trans_t *tp, struct xfs_buf *bp);
  43 +static int xfs_dir2_block_lookup_int(xfs_da_args_t *args, struct xfs_buf **bpp,
44 44 int *entno);
45 45 static int xfs_dir2_block_sort(const void *a, const void *b);
46 46  
... ... @@ -66,7 +66,7 @@
66 66 xfs_dir2_data_free_t *bf; /* bestfree table in block */
67 67 xfs_dir2_data_hdr_t *hdr; /* block header */
68 68 xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
69   - xfs_dabuf_t *bp; /* buffer for block */
  69 + struct xfs_buf *bp; /* buffer for block */
70 70 xfs_dir2_block_tail_t *btp; /* block tail */
71 71 int compact; /* need to compact leaf ents */
72 72 xfs_dir2_data_entry_t *dep; /* block data entry */
73 73  
... ... @@ -102,14 +102,14 @@
102 102 return error;
103 103 }
104 104 ASSERT(bp != NULL);
105   - hdr = bp->data;
  105 + hdr = bp->b_addr;
106 106 /*
107 107 * Check the magic number, corrupted if wrong.
108 108 */
109 109 if (unlikely(hdr->magic != cpu_to_be32(XFS_DIR2_BLOCK_MAGIC))) {
110 110 XFS_CORRUPTION_ERROR("xfs_dir2_block_addname",
111 111 XFS_ERRLEVEL_LOW, mp, hdr);
112   - xfs_da_brelse(tp, bp);
  112 + xfs_trans_brelse(tp, bp);
113 113 return XFS_ERROR(EFSCORRUPTED);
114 114 }
115 115 len = xfs_dir2_data_entsize(args->namelen);
... ... @@ -212,7 +212,7 @@
212 212 * If this isn't a real add, we're done with the buffer.
213 213 */
214 214 if (args->op_flags & XFS_DA_OP_JUSTCHECK)
215   - xfs_da_brelse(tp, bp);
  215 + xfs_trans_brelse(tp, bp);
216 216 /*
217 217 * If we don't have space for the new entry & leaf ...
218 218 */
... ... @@ -228,7 +228,6 @@
228 228 * Then add the new entry in that format.
229 229 */
230 230 error = xfs_dir2_block_to_leaf(args, bp);
231   - xfs_da_buf_done(bp);
232 231 if (error)
233 232 return error;
234 233 return xfs_dir2_leaf_addname(args);
... ... @@ -422,7 +421,6 @@
422 421 xfs_dir2_block_log_tail(tp, bp);
423 422 xfs_dir2_data_log_entry(tp, bp, dep);
424 423 xfs_dir2_data_check(dp, bp);
425   - xfs_da_buf_done(bp);
426 424 return 0;
427 425 }
428 426  
... ... @@ -437,7 +435,7 @@
437 435 filldir_t filldir)
438 436 {
439 437 xfs_dir2_data_hdr_t *hdr; /* block header */
440   - xfs_dabuf_t *bp; /* buffer for block */
  438 + struct xfs_buf *bp; /* buffer for block */
441 439 xfs_dir2_block_tail_t *btp; /* block tail */
442 440 xfs_dir2_data_entry_t *dep; /* block data entry */
443 441 xfs_dir2_data_unused_t *dup; /* block unused entry */
... ... @@ -469,7 +467,7 @@
469 467 * We'll skip entries before this.
470 468 */
471 469 wantoff = xfs_dir2_dataptr_to_off(mp, *offset);
472   - hdr = bp->data;
  470 + hdr = bp->b_addr;
473 471 xfs_dir2_data_check(dp, bp);
474 472 /*
475 473 * Set up values for the loop.
... ... @@ -514,7 +512,7 @@
514 512 cook & 0x7fffffff, be64_to_cpu(dep->inumber),
515 513 DT_UNKNOWN)) {
516 514 *offset = cook & 0x7fffffff;
517   - xfs_da_brelse(NULL, bp);
  515 + xfs_trans_brelse(NULL, bp);
518 516 return 0;
519 517 }
520 518 }
... ... @@ -525,7 +523,7 @@
525 523 */
526 524 *offset = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk + 1, 0) &
527 525 0x7fffffff;
528   - xfs_da_brelse(NULL, bp);
  526 + xfs_trans_brelse(NULL, bp);
529 527 return 0;
530 528 }
531 529  
532 530  
533 531  
... ... @@ -535,17 +533,17 @@
535 533 static void
536 534 xfs_dir2_block_log_leaf(
537 535 xfs_trans_t *tp, /* transaction structure */
538   - xfs_dabuf_t *bp, /* block buffer */
  536 + struct xfs_buf *bp, /* block buffer */
539 537 int first, /* index of first logged leaf */
540 538 int last) /* index of last logged leaf */
541 539 {
542   - xfs_dir2_data_hdr_t *hdr = bp->data;
  540 + xfs_dir2_data_hdr_t *hdr = bp->b_addr;
543 541 xfs_dir2_leaf_entry_t *blp;
544 542 xfs_dir2_block_tail_t *btp;
545 543  
546 544 btp = xfs_dir2_block_tail_p(tp->t_mountp, hdr);
547 545 blp = xfs_dir2_block_leaf_p(btp);
548   - xfs_da_log_buf(tp, bp, (uint)((char *)&blp[first] - (char *)hdr),
  546 + xfs_trans_log_buf(tp, bp, (uint)((char *)&blp[first] - (char *)hdr),
549 547 (uint)((char *)&blp[last + 1] - (char *)hdr - 1));
550 548 }
551 549  
552 550  
553 551  
... ... @@ -555,13 +553,13 @@
555 553 static void
556 554 xfs_dir2_block_log_tail(
557 555 xfs_trans_t *tp, /* transaction structure */
558   - xfs_dabuf_t *bp) /* block buffer */
  556 + struct xfs_buf *bp) /* block buffer */
559 557 {
560   - xfs_dir2_data_hdr_t *hdr = bp->data;
  558 + xfs_dir2_data_hdr_t *hdr = bp->b_addr;
561 559 xfs_dir2_block_tail_t *btp;
562 560  
563 561 btp = xfs_dir2_block_tail_p(tp->t_mountp, hdr);
564   - xfs_da_log_buf(tp, bp, (uint)((char *)btp - (char *)hdr),
  562 + xfs_trans_log_buf(tp, bp, (uint)((char *)btp - (char *)hdr),
565 563 (uint)((char *)(btp + 1) - (char *)hdr - 1));
566 564 }
567 565  
... ... @@ -575,7 +573,7 @@
575 573 {
576 574 xfs_dir2_data_hdr_t *hdr; /* block header */
577 575 xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
578   - xfs_dabuf_t *bp; /* block buffer */
  576 + struct xfs_buf *bp; /* block buffer */
579 577 xfs_dir2_block_tail_t *btp; /* block tail */
580 578 xfs_dir2_data_entry_t *dep; /* block data entry */
581 579 xfs_inode_t *dp; /* incore inode */
... ... @@ -593,7 +591,7 @@
593 591 return error;
594 592 dp = args->dp;
595 593 mp = dp->i_mount;
596   - hdr = bp->data;
  594 + hdr = bp->b_addr;
597 595 xfs_dir2_data_check(dp, bp);
598 596 btp = xfs_dir2_block_tail_p(mp, hdr);
599 597 blp = xfs_dir2_block_leaf_p(btp);
... ... @@ -607,7 +605,7 @@
607 605 */
608 606 args->inumber = be64_to_cpu(dep->inumber);
609 607 error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
610   - xfs_da_brelse(args->trans, bp);
  608 + xfs_trans_brelse(args->trans, bp);
611 609 return XFS_ERROR(error);
612 610 }
613 611  
614 612  
... ... @@ -617,13 +615,13 @@
617 615 static int /* error */
618 616 xfs_dir2_block_lookup_int(
619 617 xfs_da_args_t *args, /* dir lookup arguments */
620   - xfs_dabuf_t **bpp, /* returned block buffer */
  618 + struct xfs_buf **bpp, /* returned block buffer */
621 619 int *entno) /* returned entry number */
622 620 {
623 621 xfs_dir2_dataptr_t addr; /* data entry address */
624 622 xfs_dir2_data_hdr_t *hdr; /* block header */
625 623 xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
626   - xfs_dabuf_t *bp; /* block buffer */
  624 + struct xfs_buf *bp; /* block buffer */
627 625 xfs_dir2_block_tail_t *btp; /* block tail */
628 626 xfs_dir2_data_entry_t *dep; /* block data entry */
629 627 xfs_inode_t *dp; /* incore inode */
... ... @@ -647,7 +645,7 @@
647 645 return error;
648 646 }
649 647 ASSERT(bp != NULL);
650   - hdr = bp->data;
  648 + hdr = bp->b_addr;
651 649 xfs_dir2_data_check(dp, bp);
652 650 btp = xfs_dir2_block_tail_p(mp, hdr);
653 651 blp = xfs_dir2_block_leaf_p(btp);
... ... @@ -666,7 +664,7 @@
666 664 high = mid - 1;
667 665 if (low > high) {
668 666 ASSERT(args->op_flags & XFS_DA_OP_OKNOENT);
669   - xfs_da_brelse(tp, bp);
  667 + xfs_trans_brelse(tp, bp);
670 668 return XFS_ERROR(ENOENT);
671 669 }
672 670 }
... ... @@ -714,7 +712,7 @@
714 712 /*
715 713 * No match, release the buffer and return ENOENT.
716 714 */
717   - xfs_da_brelse(tp, bp);
  715 + xfs_trans_brelse(tp, bp);
718 716 return XFS_ERROR(ENOENT);
719 717 }
720 718  
... ... @@ -728,7 +726,7 @@
728 726 {
729 727 xfs_dir2_data_hdr_t *hdr; /* block header */
730 728 xfs_dir2_leaf_entry_t *blp; /* block leaf pointer */
731   - xfs_dabuf_t *bp; /* block buffer */
  729 + struct xfs_buf *bp; /* block buffer */
732 730 xfs_dir2_block_tail_t *btp; /* block tail */
733 731 xfs_dir2_data_entry_t *dep; /* block data entry */
734 732 xfs_inode_t *dp; /* incore inode */
... ... @@ -753,7 +751,7 @@
753 751 dp = args->dp;
754 752 tp = args->trans;
755 753 mp = dp->i_mount;
756   - hdr = bp->data;
  754 + hdr = bp->b_addr;
757 755 btp = xfs_dir2_block_tail_p(mp, hdr);
758 756 blp = xfs_dir2_block_leaf_p(btp);
759 757 /*
760 758  
... ... @@ -790,10 +788,9 @@
790 788 * See if the size as a shortform is good enough.
791 789 */
792 790 size = xfs_dir2_block_sfsize(dp, hdr, &sfh);
793   - if (size > XFS_IFORK_DSIZE(dp)) {
794   - xfs_da_buf_done(bp);
  791 + if (size > XFS_IFORK_DSIZE(dp))
795 792 return 0;
796   - }
  793 +
797 794 /*
798 795 * If it works, do the conversion.
799 796 */
... ... @@ -810,7 +807,7 @@
810 807 {
811 808 xfs_dir2_data_hdr_t *hdr; /* block header */
812 809 xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
813   - xfs_dabuf_t *bp; /* block buffer */
  810 + struct xfs_buf *bp; /* block buffer */
814 811 xfs_dir2_block_tail_t *btp; /* block tail */
815 812 xfs_dir2_data_entry_t *dep; /* block data entry */
816 813 xfs_inode_t *dp; /* incore inode */
... ... @@ -829,7 +826,7 @@
829 826 }
830 827 dp = args->dp;
831 828 mp = dp->i_mount;
832   - hdr = bp->data;
  829 + hdr = bp->b_addr;
833 830 btp = xfs_dir2_block_tail_p(mp, hdr);
834 831 blp = xfs_dir2_block_leaf_p(btp);
835 832 /*
... ... @@ -844,7 +841,6 @@
844 841 dep->inumber = cpu_to_be64(args->inumber);
845 842 xfs_dir2_data_log_entry(args->trans, bp, dep);
846 843 xfs_dir2_data_check(dp, bp);
847   - xfs_da_buf_done(bp);
848 844 return 0;
849 845 }
850 846  
... ... @@ -871,8 +867,8 @@
871 867 int /* error */
872 868 xfs_dir2_leaf_to_block(
873 869 xfs_da_args_t *args, /* operation arguments */
874   - xfs_dabuf_t *lbp, /* leaf buffer */
875   - xfs_dabuf_t *dbp) /* data buffer */
  870 + struct xfs_buf *lbp, /* leaf buffer */
  871 + struct xfs_buf *dbp) /* data buffer */
876 872 {
877 873 __be16 *bestsp; /* leaf bests table */
878 874 xfs_dir2_data_hdr_t *hdr; /* block header */
... ... @@ -898,7 +894,7 @@
898 894 dp = args->dp;
899 895 tp = args->trans;
900 896 mp = dp->i_mount;
901   - leaf = lbp->data;
  897 + leaf = lbp->b_addr;
902 898 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC));
903 899 ltp = xfs_dir2_leaf_tail_p(mp, leaf);
904 900 /*
... ... @@ -914,11 +910,9 @@
914 910 if ((error =
915 911 xfs_dir2_leaf_trim_data(args, lbp,
916 912 (xfs_dir2_db_t)(be32_to_cpu(ltp->bestcount) - 1))))
917   - goto out;
918   - } else {
919   - error = 0;
920   - goto out;
921   - }
  913 + return error;
  914 + } else
  915 + return 0;
922 916 }
923 917 /*
924 918 * Read the data block if we don't already have it, give up if it fails.
925 919  
... ... @@ -926,9 +920,9 @@
926 920 if (dbp == NULL &&
927 921 (error = xfs_da_read_buf(tp, dp, mp->m_dirdatablk, -1, &dbp,
928 922 XFS_DATA_FORK))) {
929   - goto out;
  923 + return error;
930 924 }
931   - hdr = dbp->data;
  925 + hdr = dbp->b_addr;
932 926 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC));
933 927 /*
934 928 * Size of the "leaf" area in the block.
... ... @@ -944,10 +938,9 @@
944 938 * If it's not free or is too short we can't do it.
945 939 */
946 940 if (be16_to_cpu(dup->freetag) != XFS_DIR2_DATA_FREE_TAG ||
947   - be16_to_cpu(dup->length) < size) {
948   - error = 0;
949   - goto out;
950   - }
  941 + be16_to_cpu(dup->length) < size)
  942 + return 0;
  943 +
951 944 /*
952 945 * Start converting it to block form.
953 946 */
954 947  
955 948  
... ... @@ -989,25 +982,17 @@
989 982 * Pitch the old leaf block.
990 983 */
991 984 error = xfs_da_shrink_inode(args, mp->m_dirleafblk, lbp);
992   - lbp = NULL;
993   - if (error) {
994   - goto out;
995   - }
  985 + if (error)
  986 + return error;
  987 +
996 988 /*
997 989 * Now see if the resulting block can be shrunken to shortform.
998 990 */
999 991 size = xfs_dir2_block_sfsize(dp, hdr, &sfh);
1000   - if (size > XFS_IFORK_DSIZE(dp)) {
1001   - error = 0;
1002   - goto out;
1003   - }
  992 + if (size > XFS_IFORK_DSIZE(dp))
  993 + return 0;
  994 +
1004 995 return xfs_dir2_block_to_sf(args, dbp, size, &sfh);
1005   -out:
1006   - if (lbp)
1007   - xfs_da_buf_done(lbp);
1008   - if (dbp)
1009   - xfs_da_buf_done(dbp);
1010   - return error;
1011 996 }
1012 997  
1013 998 /*
... ... @@ -1020,7 +1005,7 @@
1020 1005 xfs_dir2_db_t blkno; /* dir-relative block # (0) */
1021 1006 xfs_dir2_data_hdr_t *hdr; /* block header */
1022 1007 xfs_dir2_leaf_entry_t *blp; /* block leaf entries */
1023   - xfs_dabuf_t *bp; /* block buffer */
  1008 + struct xfs_buf *bp; /* block buffer */
1024 1009 xfs_dir2_block_tail_t *btp; /* block tail pointer */
1025 1010 xfs_dir2_data_entry_t *dep; /* data entry pointer */
1026 1011 xfs_inode_t *dp; /* incore directory inode */
... ... @@ -1088,7 +1073,7 @@
1088 1073 kmem_free(sfp);
1089 1074 return error;
1090 1075 }
1091   - hdr = bp->data;
  1076 + hdr = bp->b_addr;
1092 1077 hdr->magic = cpu_to_be32(XFS_DIR2_BLOCK_MAGIC);
1093 1078 /*
1094 1079 * Compute size of block "tail" area.
... ... @@ -1217,7 +1202,6 @@
1217 1202 xfs_dir2_block_log_leaf(tp, bp, 0, be32_to_cpu(btp->count) - 1);
1218 1203 xfs_dir2_block_log_tail(tp, bp);
1219 1204 xfs_dir2_data_check(dp, bp);
1220   - xfs_da_buf_done(bp);
1221 1205 return 0;
1222 1206 }
fs/xfs/xfs_dir2_data.c
... ... @@ -42,8 +42,8 @@
42 42 */
43 43 void
44 44 xfs_dir2_data_check(
45   - xfs_inode_t *dp, /* incore inode pointer */
46   - xfs_dabuf_t *bp) /* data block's buffer */
  45 + struct xfs_inode *dp, /* incore inode pointer */
  46 + struct xfs_buf *bp) /* data block's buffer */
47 47 {
48 48 xfs_dir2_dataptr_t addr; /* addr for leaf lookup */
49 49 xfs_dir2_data_free_t *bf; /* bestfree table */
... ... @@ -65,7 +65,7 @@
65 65 struct xfs_name name;
66 66  
67 67 mp = dp->i_mount;
68   - hdr = bp->data;
  68 + hdr = bp->b_addr;
69 69 bf = hdr->bestfree;
70 70 p = (char *)(hdr + 1);
71 71  
72 72  
... ... @@ -389,9 +389,9 @@
389 389 xfs_dir2_data_init(
390 390 xfs_da_args_t *args, /* directory operation args */
391 391 xfs_dir2_db_t blkno, /* logical dir block number */
392   - xfs_dabuf_t **bpp) /* output block buffer */
  392 + struct xfs_buf **bpp) /* output block buffer */
393 393 {
394   - xfs_dabuf_t *bp; /* block buffer */
  394 + struct xfs_buf *bp; /* block buffer */
395 395 xfs_dir2_data_hdr_t *hdr; /* data block header */
396 396 xfs_inode_t *dp; /* incore directory inode */
397 397 xfs_dir2_data_unused_t *dup; /* unused entry pointer */
... ... @@ -417,7 +417,7 @@
417 417 /*
418 418 * Initialize the header.
419 419 */
420   - hdr = bp->data;
  420 + hdr = bp->b_addr;
421 421 hdr->magic = cpu_to_be32(XFS_DIR2_DATA_MAGIC);
422 422 hdr->bestfree[0].offset = cpu_to_be16(sizeof(*hdr));
423 423 for (i = 1; i < XFS_DIR2_DATA_FD_COUNT; i++) {
424 424  
425 425  
... ... @@ -449,16 +449,16 @@
449 449 */
450 450 void
451 451 xfs_dir2_data_log_entry(
452   - xfs_trans_t *tp, /* transaction pointer */
453   - xfs_dabuf_t *bp, /* block buffer */
  452 + struct xfs_trans *tp,
  453 + struct xfs_buf *bp,
454 454 xfs_dir2_data_entry_t *dep) /* data entry pointer */
455 455 {
456   - xfs_dir2_data_hdr_t *hdr = bp->data;
  456 + xfs_dir2_data_hdr_t *hdr = bp->b_addr;
457 457  
458 458 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
459 459 hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC));
460 460  
461   - xfs_da_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr),
  461 + xfs_trans_log_buf(tp, bp, (uint)((char *)dep - (char *)hdr),
462 462 (uint)((char *)(xfs_dir2_data_entry_tag_p(dep) + 1) -
463 463 (char *)hdr - 1));
464 464 }
465 465  
466 466  
... ... @@ -468,15 +468,15 @@
468 468 */
469 469 void
470 470 xfs_dir2_data_log_header(
471   - xfs_trans_t *tp, /* transaction pointer */
472   - xfs_dabuf_t *bp) /* block buffer */
  471 + struct xfs_trans *tp,
  472 + struct xfs_buf *bp)
473 473 {
474   - xfs_dir2_data_hdr_t *hdr = bp->data;
  474 + xfs_dir2_data_hdr_t *hdr = bp->b_addr;
475 475  
476 476 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
477 477 hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC));
478 478  
479   - xfs_da_log_buf(tp, bp, 0, sizeof(*hdr) - 1);
  479 + xfs_trans_log_buf(tp, bp, 0, sizeof(*hdr) - 1);
480 480 }
481 481  
482 482 /*
483 483  
... ... @@ -484,11 +484,11 @@
484 484 */
485 485 void
486 486 xfs_dir2_data_log_unused(
487   - xfs_trans_t *tp, /* transaction pointer */
488   - xfs_dabuf_t *bp, /* block buffer */
  487 + struct xfs_trans *tp,
  488 + struct xfs_buf *bp,
489 489 xfs_dir2_data_unused_t *dup) /* data unused pointer */
490 490 {
491   - xfs_dir2_data_hdr_t *hdr = bp->data;
  491 + xfs_dir2_data_hdr_t *hdr = bp->b_addr;
492 492  
493 493 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
494 494 hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC));
495 495  
... ... @@ -496,13 +496,13 @@
496 496 /*
497 497 * Log the first part of the unused entry.
498 498 */
499   - xfs_da_log_buf(tp, bp, (uint)((char *)dup - (char *)hdr),
  499 + xfs_trans_log_buf(tp, bp, (uint)((char *)dup - (char *)hdr),
500 500 (uint)((char *)&dup->length + sizeof(dup->length) -
501 501 1 - (char *)hdr));
502 502 /*
503 503 * Log the end (tag) of the unused entry.
504 504 */
505   - xfs_da_log_buf(tp, bp,
  505 + xfs_trans_log_buf(tp, bp,
506 506 (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr),
507 507 (uint)((char *)xfs_dir2_data_unused_tag_p(dup) - (char *)hdr +
508 508 sizeof(xfs_dir2_data_off_t) - 1));
... ... @@ -514,8 +514,8 @@
514 514 */
515 515 void
516 516 xfs_dir2_data_make_free(
517   - xfs_trans_t *tp, /* transaction pointer */
518   - xfs_dabuf_t *bp, /* block buffer */
  517 + struct xfs_trans *tp,
  518 + struct xfs_buf *bp,
519 519 xfs_dir2_data_aoff_t offset, /* starting byte offset */
520 520 xfs_dir2_data_aoff_t len, /* length in bytes */
521 521 int *needlogp, /* out: log header */
... ... @@ -531,7 +531,7 @@
531 531 xfs_dir2_data_unused_t *prevdup; /* unused entry before us */
532 532  
533 533 mp = tp->t_mountp;
534   - hdr = bp->data;
  534 + hdr = bp->b_addr;
535 535  
536 536 /*
537 537 * Figure out where the end of the data area is.
... ... @@ -696,8 +696,8 @@
696 696 */
697 697 void
698 698 xfs_dir2_data_use_free(
699   - xfs_trans_t *tp, /* transaction pointer */
700   - xfs_dabuf_t *bp, /* data block buffer */
  699 + struct xfs_trans *tp,
  700 + struct xfs_buf *bp,
701 701 xfs_dir2_data_unused_t *dup, /* unused entry */
702 702 xfs_dir2_data_aoff_t offset, /* starting offset to use */
703 703 xfs_dir2_data_aoff_t len, /* length to use */
... ... @@ -713,7 +713,7 @@
713 713 xfs_dir2_data_unused_t *newdup2; /* another new unused entry */
714 714 int oldlen; /* old unused entry's length */
715 715  
716   - hdr = bp->data;
  716 + hdr = bp->b_addr;
717 717 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC) ||
718 718 hdr->magic == cpu_to_be32(XFS_DIR2_BLOCK_MAGIC));
719 719 ASSERT(be16_to_cpu(dup->freetag) == XFS_DIR2_DATA_FREE_TAG);
fs/xfs/xfs_dir2_leaf.c
... ... @@ -38,15 +38,15 @@
38 38 * Local function declarations.
39 39 */
40 40 #ifdef DEBUG
41   -static void xfs_dir2_leaf_check(xfs_inode_t *dp, xfs_dabuf_t *bp);
  41 +static void xfs_dir2_leaf_check(struct xfs_inode *dp, struct xfs_buf *bp);
42 42 #else
43 43 #define xfs_dir2_leaf_check(dp, bp)
44 44 #endif
45   -static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, xfs_dabuf_t **lbpp,
46   - int *indexp, xfs_dabuf_t **dbpp);
47   -static void xfs_dir2_leaf_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp,
  45 +static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, struct xfs_buf **lbpp,
  46 + int *indexp, struct xfs_buf **dbpp);
  47 +static void xfs_dir2_leaf_log_bests(struct xfs_trans *tp, struct xfs_buf *bp,
48 48 int first, int last);
49   -static void xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_dabuf *bp);
  49 +static void xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_buf *bp);
50 50  
51 51  
52 52 /*
... ... @@ -55,7 +55,7 @@
55 55 int /* error */
56 56 xfs_dir2_block_to_leaf(
57 57 xfs_da_args_t *args, /* operation arguments */
58   - xfs_dabuf_t *dbp) /* input block's buffer */
  58 + struct xfs_buf *dbp) /* input block's buffer */
59 59 {
60 60 __be16 *bestsp; /* leaf's bestsp entries */
61 61 xfs_dablk_t blkno; /* leaf block's bno */
... ... @@ -64,7 +64,7 @@
64 64 xfs_dir2_block_tail_t *btp; /* block's tail */
65 65 xfs_inode_t *dp; /* incore directory inode */
66 66 int error; /* error return code */
67   - xfs_dabuf_t *lbp; /* leaf block's buffer */
  67 + struct xfs_buf *lbp; /* leaf block's buffer */
68 68 xfs_dir2_db_t ldb; /* leaf block's bno */
69 69 xfs_dir2_leaf_t *leaf; /* leaf structure */
70 70 xfs_dir2_leaf_tail_t *ltp; /* leaf's tail */
... ... @@ -95,8 +95,8 @@
95 95 return error;
96 96 }
97 97 ASSERT(lbp != NULL);
98   - leaf = lbp->data;
99   - hdr = dbp->data;
  98 + leaf = lbp->b_addr;
  99 + hdr = dbp->b_addr;
100 100 xfs_dir2_data_check(dp, dbp);
101 101 btp = xfs_dir2_block_tail_p(mp, hdr);
102 102 blp = xfs_dir2_block_leaf_p(btp);
... ... @@ -143,7 +143,6 @@
143 143 xfs_dir2_leaf_check(dp, lbp);
144 144 xfs_dir2_data_check(dp, dbp);
145 145 xfs_dir2_leaf_log_bests(tp, lbp, 0, 0);
146   - xfs_da_buf_done(lbp);
147 146 return 0;
148 147 }
149 148  
... ... @@ -282,7 +281,7 @@
282 281 __be16 *bestsp; /* freespace table in leaf */
283 282 int compact; /* need to compact leaves */
284 283 xfs_dir2_data_hdr_t *hdr; /* data block header */
285   - xfs_dabuf_t *dbp; /* data block buffer */
  284 + struct xfs_buf *dbp; /* data block buffer */
286 285 xfs_dir2_data_entry_t *dep; /* data block entry */
287 286 xfs_inode_t *dp; /* incore directory inode */
288 287 xfs_dir2_data_unused_t *dup; /* data unused entry */
... ... @@ -291,7 +290,7 @@
291 290 int highstale; /* index of next stale leaf */
292 291 int i; /* temporary, index */
293 292 int index; /* leaf table position */
294   - xfs_dabuf_t *lbp; /* leaf's buffer */
  293 + struct xfs_buf *lbp; /* leaf's buffer */
295 294 xfs_dir2_leaf_t *leaf; /* leaf structure */
296 295 int length; /* length of new entry */
297 296 xfs_dir2_leaf_entry_t *lep; /* leaf entry table pointer */
... ... @@ -328,7 +327,7 @@
328 327 * But if there are dup hash values the index is of the first of those.
329 328 */
330 329 index = xfs_dir2_leaf_search_hash(args, lbp);
331   - leaf = lbp->data;
  330 + leaf = lbp->b_addr;
332 331 ltp = xfs_dir2_leaf_tail_p(mp, leaf);
333 332 bestsp = xfs_dir2_leaf_bests_p(ltp);
334 333 length = xfs_dir2_data_entsize(args->namelen);
335 334  
... ... @@ -402,14 +401,13 @@
402 401 */
403 402 if ((args->op_flags & XFS_DA_OP_JUSTCHECK) ||
404 403 args->total == 0) {
405   - xfs_da_brelse(tp, lbp);
  404 + xfs_trans_brelse(tp, lbp);
406 405 return XFS_ERROR(ENOSPC);
407 406 }
408 407 /*
409 408 * Convert to node form.
410 409 */
411 410 error = xfs_dir2_leaf_to_node(args, lbp);
412   - xfs_da_buf_done(lbp);
413 411 if (error)
414 412 return error;
415 413 /*
... ... @@ -427,7 +425,7 @@
427 425 * a new data block.
428 426 */
429 427 if (args->op_flags & XFS_DA_OP_JUSTCHECK) {
430   - xfs_da_brelse(tp, lbp);
  428 + xfs_trans_brelse(tp, lbp);
431 429 return use_block == -1 ? XFS_ERROR(ENOSPC) : 0;
432 430 }
433 431 /*
... ... @@ -435,7 +433,7 @@
435 433 * changed anything.
436 434 */
437 435 if (args->total == 0 && use_block == -1) {
438   - xfs_da_brelse(tp, lbp);
  436 + xfs_trans_brelse(tp, lbp);
439 437 return XFS_ERROR(ENOSPC);
440 438 }
441 439 /*
442 440  
... ... @@ -466,14 +464,14 @@
466 464 */
467 465 if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_DATA_SPACE,
468 466 &use_block))) {
469   - xfs_da_brelse(tp, lbp);
  467 + xfs_trans_brelse(tp, lbp);
470 468 return error;
471 469 }
472 470 /*
473 471 * Initialize the block.
474 472 */
475 473 if ((error = xfs_dir2_data_init(args, use_block, &dbp))) {
476   - xfs_da_brelse(tp, lbp);
  474 + xfs_trans_brelse(tp, lbp);
477 475 return error;
478 476 }
479 477 /*
... ... @@ -493,7 +491,7 @@
493 491 */
494 492 else
495 493 xfs_dir2_leaf_log_bests(tp, lbp, use_block, use_block);
496   - hdr = dbp->data;
  494 + hdr = dbp->b_addr;
497 495 bestsp[use_block] = hdr->bestfree[0].length;
498 496 grown = 1;
499 497 }
500 498  
... ... @@ -505,10 +503,10 @@
505 503 if ((error =
506 504 xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, use_block),
507 505 -1, &dbp, XFS_DATA_FORK))) {
508   - xfs_da_brelse(tp, lbp);
  506 + xfs_trans_brelse(tp, lbp);
509 507 return error;
510 508 }
511   - hdr = dbp->data;
  509 + hdr = dbp->b_addr;
512 510 grown = 0;
513 511 }
514 512 xfs_dir2_data_check(dp, dbp);
515 513  
... ... @@ -570,9 +568,7 @@
570 568 xfs_dir2_leaf_log_header(tp, lbp);
571 569 xfs_dir2_leaf_log_ents(tp, lbp, lfloglow, lfloghigh);
572 570 xfs_dir2_leaf_check(dp, lbp);
573   - xfs_da_buf_done(lbp);
574 571 xfs_dir2_data_check(dp, dbp);
575   - xfs_da_buf_done(dbp);
576 572 return 0;
577 573 }
578 574  
... ... @@ -583,8 +579,8 @@
583 579 */
584 580 STATIC void
585 581 xfs_dir2_leaf_check(
586   - xfs_inode_t *dp, /* incore directory inode */
587   - xfs_dabuf_t *bp) /* leaf's buffer */
  582 + struct xfs_inode *dp, /* incore directory inode */
  583 + struct xfs_buf *bp) /* leaf's buffer */
588 584 {
589 585 int i; /* leaf index */
590 586 xfs_dir2_leaf_t *leaf; /* leaf structure */
... ... @@ -592,7 +588,7 @@
592 588 xfs_mount_t *mp; /* filesystem mount point */
593 589 int stale; /* count of stale leaves */
594 590  
595   - leaf = bp->data;
  591 + leaf = bp->b_addr;
596 592 mp = dp->i_mount;
597 593 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC));
598 594 /*
599 595  
... ... @@ -628,14 +624,14 @@
628 624 void
629 625 xfs_dir2_leaf_compact(
630 626 xfs_da_args_t *args, /* operation arguments */
631   - xfs_dabuf_t *bp) /* leaf buffer */
  627 + struct xfs_buf *bp) /* leaf buffer */
632 628 {
633 629 int from; /* source leaf index */
634 630 xfs_dir2_leaf_t *leaf; /* leaf structure */
635 631 int loglow; /* first leaf entry to log */
636 632 int to; /* target leaf index */
637 633  
638   - leaf = bp->data;
  634 + leaf = bp->b_addr;
639 635 if (!leaf->hdr.stale) {
640 636 return;
641 637 }
... ... @@ -677,7 +673,7 @@
677 673 */
678 674 void
679 675 xfs_dir2_leaf_compact_x1(
680   - xfs_dabuf_t *bp, /* leaf buffer */
  676 + struct xfs_buf *bp, /* leaf buffer */
681 677 int *indexp, /* insertion index */
682 678 int *lowstalep, /* out: stale entry before us */
683 679 int *highstalep, /* out: stale entry after us */
... ... @@ -693,7 +689,7 @@
693 689 int newindex=0; /* new insertion index */
694 690 int to; /* destination copy index */
695 691  
696   - leaf = bp->data;
  692 + leaf = bp->b_addr;
697 693 ASSERT(be16_to_cpu(leaf->hdr.stale) > 1);
698 694 index = *indexp;
699 695  
... ... @@ -775,7 +771,7 @@
775 771 xfs_off_t *offset,
776 772 filldir_t filldir)
777 773 {
778   - xfs_dabuf_t *bp; /* data block buffer */
  774 + struct xfs_buf *bp; /* data block buffer */
779 775 int byteoff; /* offset in current block */
780 776 xfs_dir2_db_t curdb; /* db for current block */
781 777 xfs_dir2_off_t curoff; /* current overall offset */
782 778  
... ... @@ -839,13 +835,13 @@
839 835 * If we have no buffer, or we're off the end of the
840 836 * current buffer, need to get another one.
841 837 */
842   - if (!bp || ptr >= (char *)bp->data + mp->m_dirblksize) {
  838 + if (!bp || ptr >= (char *)bp->b_addr + mp->m_dirblksize) {
843 839 /*
844 840 * If we have a buffer, we need to release it and
845 841 * take it out of the mapping.
846 842 */
847 843 if (bp) {
848   - xfs_da_brelse(NULL, bp);
  844 + xfs_trans_brelse(NULL, bp);
849 845 bp = NULL;
850 846 map_blocks -= mp->m_dirblkfsbs;
851 847 /*
... ... @@ -1035,7 +1031,7 @@
1035 1031 else if (curoff > newoff)
1036 1032 ASSERT(xfs_dir2_byte_to_db(mp, curoff) ==
1037 1033 curdb);
1038   - hdr = bp->data;
  1034 + hdr = bp->b_addr;
1039 1035 xfs_dir2_data_check(dp, bp);
1040 1036 /*
1041 1037 * Find our position in the block.
... ... @@ -1119,7 +1115,7 @@
1119 1115 *offset = xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff;
1120 1116 kmem_free(map);
1121 1117 if (bp)
1122   - xfs_da_brelse(NULL, bp);
  1118 + xfs_trans_brelse(NULL, bp);
1123 1119 return error;
1124 1120 }
1125 1121  
1126 1122  
... ... @@ -1130,10 +1126,10 @@
1130 1126 xfs_dir2_leaf_init(
1131 1127 xfs_da_args_t *args, /* operation arguments */
1132 1128 xfs_dir2_db_t bno, /* directory block number */
1133   - xfs_dabuf_t **bpp, /* out: leaf buffer */
  1129 + struct xfs_buf **bpp, /* out: leaf buffer */
1134 1130 int magic) /* magic number for block */
1135 1131 {
1136   - xfs_dabuf_t *bp; /* leaf buffer */
  1132 + struct xfs_buf *bp; /* leaf buffer */
1137 1133 xfs_inode_t *dp; /* incore directory inode */
1138 1134 int error; /* error return code */
1139 1135 xfs_dir2_leaf_t *leaf; /* leaf structure */
... ... @@ -1156,7 +1152,7 @@
1156 1152 return error;
1157 1153 }
1158 1154 ASSERT(bp != NULL);
1159   - leaf = bp->data;
  1155 + leaf = bp->b_addr;
1160 1156 /*
1161 1157 * Initialize the header.
1162 1158 */
... ... @@ -1186,7 +1182,7 @@
1186 1182 static void
1187 1183 xfs_dir2_leaf_log_bests(
1188 1184 xfs_trans_t *tp, /* transaction pointer */
1189   - xfs_dabuf_t *bp, /* leaf buffer */
  1185 + struct xfs_buf *bp, /* leaf buffer */
1190 1186 int first, /* first entry to log */
1191 1187 int last) /* last entry to log */
1192 1188 {
1193 1189  
... ... @@ -1195,12 +1191,12 @@
1195 1191 xfs_dir2_leaf_t *leaf; /* leaf structure */
1196 1192 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
1197 1193  
1198   - leaf = bp->data;
  1194 + leaf = bp->b_addr;
1199 1195 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC));
1200 1196 ltp = xfs_dir2_leaf_tail_p(tp->t_mountp, leaf);
1201 1197 firstb = xfs_dir2_leaf_bests_p(ltp) + first;
1202 1198 lastb = xfs_dir2_leaf_bests_p(ltp) + last;
1203   - xfs_da_log_buf(tp, bp, (uint)((char *)firstb - (char *)leaf),
  1199 + xfs_trans_log_buf(tp, bp, (uint)((char *)firstb - (char *)leaf),
1204 1200 (uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1));
1205 1201 }
1206 1202  
... ... @@ -1210,7 +1206,7 @@
1210 1206 void
1211 1207 xfs_dir2_leaf_log_ents(
1212 1208 xfs_trans_t *tp, /* transaction pointer */
1213   - xfs_dabuf_t *bp, /* leaf buffer */
  1209 + struct xfs_buf *bp, /* leaf buffer */
1214 1210 int first, /* first entry to log */
1215 1211 int last) /* last entry to log */
1216 1212 {
1217 1213  
... ... @@ -1218,12 +1214,12 @@
1218 1214 xfs_dir2_leaf_entry_t *lastlep; /* pointer to last entry */
1219 1215 xfs_dir2_leaf_t *leaf; /* leaf structure */
1220 1216  
1221   - leaf = bp->data;
  1217 + leaf = bp->b_addr;
1222 1218 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) ||
1223 1219 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
1224 1220 firstlep = &leaf->ents[first];
1225 1221 lastlep = &leaf->ents[last];
1226   - xfs_da_log_buf(tp, bp, (uint)((char *)firstlep - (char *)leaf),
  1222 + xfs_trans_log_buf(tp, bp, (uint)((char *)firstlep - (char *)leaf),
1227 1223 (uint)((char *)lastlep - (char *)leaf + sizeof(*lastlep) - 1));
1228 1224 }
1229 1225  
1230 1226  
1231 1227  
... ... @@ -1232,15 +1228,15 @@
1232 1228 */
1233 1229 void
1234 1230 xfs_dir2_leaf_log_header(
1235   - xfs_trans_t *tp, /* transaction pointer */
1236   - xfs_dabuf_t *bp) /* leaf buffer */
  1231 + struct xfs_trans *tp,
  1232 + struct xfs_buf *bp)
1237 1233 {
1238 1234 xfs_dir2_leaf_t *leaf; /* leaf structure */
1239 1235  
1240   - leaf = bp->data;
  1236 + leaf = bp->b_addr;
1241 1237 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) ||
1242 1238 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
1243   - xfs_da_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf),
  1239 + xfs_trans_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf),
1244 1240 (uint)(sizeof(leaf->hdr) - 1));
1245 1241 }
1246 1242  
1247 1243  
1248 1244  
... ... @@ -1249,18 +1245,18 @@
1249 1245 */
1250 1246 STATIC void
1251 1247 xfs_dir2_leaf_log_tail(
1252   - xfs_trans_t *tp, /* transaction pointer */
1253   - xfs_dabuf_t *bp) /* leaf buffer */
  1248 + struct xfs_trans *tp,
  1249 + struct xfs_buf *bp)
1254 1250 {
1255 1251 xfs_dir2_leaf_t *leaf; /* leaf structure */
1256 1252 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
1257 1253 xfs_mount_t *mp; /* filesystem mount point */
1258 1254  
1259 1255 mp = tp->t_mountp;
1260   - leaf = bp->data;
  1256 + leaf = bp->b_addr;
1261 1257 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC));
1262 1258 ltp = xfs_dir2_leaf_tail_p(mp, leaf);
1263   - xfs_da_log_buf(tp, bp, (uint)((char *)ltp - (char *)leaf),
  1259 + xfs_trans_log_buf(tp, bp, (uint)((char *)ltp - (char *)leaf),
1264 1260 (uint)(mp->m_dirblksize - 1));
1265 1261 }
1266 1262  
1267 1263  
... ... @@ -1273,12 +1269,12 @@
1273 1269 xfs_dir2_leaf_lookup(
1274 1270 xfs_da_args_t *args) /* operation arguments */
1275 1271 {
1276   - xfs_dabuf_t *dbp; /* data block buffer */
  1272 + struct xfs_buf *dbp; /* data block buffer */
1277 1273 xfs_dir2_data_entry_t *dep; /* data block entry */
1278 1274 xfs_inode_t *dp; /* incore directory inode */
1279 1275 int error; /* error return code */
1280 1276 int index; /* found entry index */
1281   - xfs_dabuf_t *lbp; /* leaf buffer */
  1277 + struct xfs_buf *lbp; /* leaf buffer */
1282 1278 xfs_dir2_leaf_t *leaf; /* leaf structure */
1283 1279 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1284 1280 xfs_trans_t *tp; /* transaction pointer */
... ... @@ -1294,7 +1290,7 @@
1294 1290 tp = args->trans;
1295 1291 dp = args->dp;
1296 1292 xfs_dir2_leaf_check(dp, lbp);
1297   - leaf = lbp->data;
  1293 + leaf = lbp->b_addr;
1298 1294 /*
1299 1295 * Get to the leaf entry and contained data entry address.
1300 1296 */
1301 1297  
... ... @@ -1303,15 +1299,15 @@
1303 1299 * Point to the data entry.
1304 1300 */
1305 1301 dep = (xfs_dir2_data_entry_t *)
1306   - ((char *)dbp->data +
  1302 + ((char *)dbp->b_addr +
1307 1303 xfs_dir2_dataptr_to_off(dp->i_mount, be32_to_cpu(lep->address)));
1308 1304 /*
1309 1305 * Return the found inode number & CI name if appropriate
1310 1306 */
1311 1307 args->inumber = be64_to_cpu(dep->inumber);
1312 1308 error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
1313   - xfs_da_brelse(tp, dbp);
1314   - xfs_da_brelse(tp, lbp);
  1309 + xfs_trans_brelse(tp, dbp);
  1310 + xfs_trans_brelse(tp, lbp);
1315 1311 return XFS_ERROR(error);
1316 1312 }
1317 1313  
1318 1314  
1319 1315  
1320 1316  
... ... @@ -1324,17 +1320,17 @@
1324 1320 static int /* error */
1325 1321 xfs_dir2_leaf_lookup_int(
1326 1322 xfs_da_args_t *args, /* operation arguments */
1327   - xfs_dabuf_t **lbpp, /* out: leaf buffer */
  1323 + struct xfs_buf **lbpp, /* out: leaf buffer */
1328 1324 int *indexp, /* out: index in leaf block */
1329   - xfs_dabuf_t **dbpp) /* out: data buffer */
  1325 + struct xfs_buf **dbpp) /* out: data buffer */
1330 1326 {
1331 1327 xfs_dir2_db_t curdb = -1; /* current data block number */
1332   - xfs_dabuf_t *dbp = NULL; /* data buffer */
  1328 + struct xfs_buf *dbp = NULL; /* data buffer */
1333 1329 xfs_dir2_data_entry_t *dep; /* data entry */
1334 1330 xfs_inode_t *dp; /* incore directory inode */
1335 1331 int error; /* error return code */
1336 1332 int index; /* index in leaf block */
1337   - xfs_dabuf_t *lbp; /* leaf buffer */
  1333 + struct xfs_buf *lbp; /* leaf buffer */
1338 1334 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1339 1335 xfs_dir2_leaf_t *leaf; /* leaf structure */
1340 1336 xfs_mount_t *mp; /* filesystem mount point */
... ... @@ -1354,7 +1350,7 @@
1354 1350 if (error)
1355 1351 return error;
1356 1352 *lbpp = lbp;
1357   - leaf = lbp->data;
  1353 + leaf = lbp->b_addr;
1358 1354 xfs_dir2_leaf_check(dp, lbp);
1359 1355 /*
1360 1356 * Look for the first leaf entry with our hash value.
1361 1357  
... ... @@ -1382,12 +1378,12 @@
1382 1378 */
1383 1379 if (newdb != curdb) {
1384 1380 if (dbp)
1385   - xfs_da_brelse(tp, dbp);
  1381 + xfs_trans_brelse(tp, dbp);
1386 1382 error = xfs_da_read_buf(tp, dp,
1387 1383 xfs_dir2_db_to_da(mp, newdb),
1388 1384 -1, &dbp, XFS_DATA_FORK);
1389 1385 if (error) {
1390   - xfs_da_brelse(tp, lbp);
  1386 + xfs_trans_brelse(tp, lbp);
1391 1387 return error;
1392 1388 }
1393 1389 xfs_dir2_data_check(dp, dbp);
... ... @@ -1396,7 +1392,7 @@
1396 1392 /*
1397 1393 * Point to the data entry.
1398 1394 */
1399   - dep = (xfs_dir2_data_entry_t *)((char *)dbp->data +
  1395 + dep = (xfs_dir2_data_entry_t *)((char *)dbp->b_addr +
1400 1396 xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
1401 1397 /*
1402 1398 * Compare name and if it's an exact match, return the index
1403 1399  
... ... @@ -1424,12 +1420,12 @@
1424 1420 if (args->cmpresult == XFS_CMP_CASE) {
1425 1421 ASSERT(cidb != -1);
1426 1422 if (cidb != curdb) {
1427   - xfs_da_brelse(tp, dbp);
  1423 + xfs_trans_brelse(tp, dbp);
1428 1424 error = xfs_da_read_buf(tp, dp,
1429 1425 xfs_dir2_db_to_da(mp, cidb),
1430 1426 -1, &dbp, XFS_DATA_FORK);
1431 1427 if (error) {
1432   - xfs_da_brelse(tp, lbp);
  1428 + xfs_trans_brelse(tp, lbp);
1433 1429 return error;
1434 1430 }
1435 1431 }
... ... @@ -1441,8 +1437,8 @@
1441 1437 */
1442 1438 ASSERT(cidb == -1);
1443 1439 if (dbp)
1444   - xfs_da_brelse(tp, dbp);
1445   - xfs_da_brelse(tp, lbp);
  1440 + xfs_trans_brelse(tp, dbp);
  1441 + xfs_trans_brelse(tp, lbp);
1446 1442 return XFS_ERROR(ENOENT);
1447 1443 }
1448 1444  
1449 1445  
... ... @@ -1456,13 +1452,13 @@
1456 1452 __be16 *bestsp; /* leaf block best freespace */
1457 1453 xfs_dir2_data_hdr_t *hdr; /* data block header */
1458 1454 xfs_dir2_db_t db; /* data block number */
1459   - xfs_dabuf_t *dbp; /* data block buffer */
  1455 + struct xfs_buf *dbp; /* data block buffer */
1460 1456 xfs_dir2_data_entry_t *dep; /* data entry structure */
1461 1457 xfs_inode_t *dp; /* incore directory inode */
1462 1458 int error; /* error return code */
1463 1459 xfs_dir2_db_t i; /* temporary data block # */
1464 1460 int index; /* index into leaf entries */
1465   - xfs_dabuf_t *lbp; /* leaf buffer */
  1461 + struct xfs_buf *lbp; /* leaf buffer */
1466 1462 xfs_dir2_leaf_t *leaf; /* leaf structure */
1467 1463 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1468 1464 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
... ... @@ -1483,8 +1479,8 @@
1483 1479 dp = args->dp;
1484 1480 tp = args->trans;
1485 1481 mp = dp->i_mount;
1486   - leaf = lbp->data;
1487   - hdr = dbp->data;
  1482 + leaf = lbp->b_addr;
  1483 + hdr = dbp->b_addr;
1488 1484 xfs_dir2_data_check(dp, dbp);
1489 1485 /*
1490 1486 * Point to the leaf entry, use that to point to the data entry.
1491 1487  
1492 1488  
... ... @@ -1541,12 +1537,9 @@
1541 1537 * Just go on, returning success, leaving the
1542 1538 * empty block in place.
1543 1539 */
1544   - if (error == ENOSPC && args->total == 0) {
1545   - xfs_da_buf_done(dbp);
  1540 + if (error == ENOSPC && args->total == 0)
1546 1541 error = 0;
1547   - }
1548 1542 xfs_dir2_leaf_check(dp, lbp);
1549   - xfs_da_buf_done(lbp);
1550 1543 return error;
1551 1544 }
1552 1545 dbp = NULL;
1553 1546  
... ... @@ -1577,10 +1570,9 @@
1577 1570 /*
1578 1571 * If the data block was not the first one, drop it.
1579 1572 */
1580   - else if (db != mp->m_dirdatablk && dbp != NULL) {
1581   - xfs_da_buf_done(dbp);
  1573 + else if (db != mp->m_dirdatablk)
1582 1574 dbp = NULL;
1583   - }
  1575 +
1584 1576 xfs_dir2_leaf_check(dp, lbp);
1585 1577 /*
1586 1578 * See if we can convert to block form.
1587 1579  
... ... @@ -1595,12 +1587,12 @@
1595 1587 xfs_dir2_leaf_replace(
1596 1588 xfs_da_args_t *args) /* operation arguments */
1597 1589 {
1598   - xfs_dabuf_t *dbp; /* data block buffer */
  1590 + struct xfs_buf *dbp; /* data block buffer */
1599 1591 xfs_dir2_data_entry_t *dep; /* data block entry */
1600 1592 xfs_inode_t *dp; /* incore directory inode */
1601 1593 int error; /* error return code */
1602 1594 int index; /* index of leaf entry */
1603   - xfs_dabuf_t *lbp; /* leaf buffer */
  1595 + struct xfs_buf *lbp; /* leaf buffer */
1604 1596 xfs_dir2_leaf_t *leaf; /* leaf structure */
1605 1597 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1606 1598 xfs_trans_t *tp; /* transaction pointer */
... ... @@ -1614,7 +1606,7 @@
1614 1606 return error;
1615 1607 }
1616 1608 dp = args->dp;
1617   - leaf = lbp->data;
  1609 + leaf = lbp->b_addr;
1618 1610 /*
1619 1611 * Point to the leaf entry, get data address from it.
1620 1612 */
... ... @@ -1623,7 +1615,7 @@
1623 1615 * Point to the data entry.
1624 1616 */
1625 1617 dep = (xfs_dir2_data_entry_t *)
1626   - ((char *)dbp->data +
  1618 + ((char *)dbp->b_addr +
1627 1619 xfs_dir2_dataptr_to_off(dp->i_mount, be32_to_cpu(lep->address)));
1628 1620 ASSERT(args->inumber != be64_to_cpu(dep->inumber));
1629 1621 /*
1630 1622  
... ... @@ -1632,9 +1624,8 @@
1632 1624 dep->inumber = cpu_to_be64(args->inumber);
1633 1625 tp = args->trans;
1634 1626 xfs_dir2_data_log_entry(tp, dbp, dep);
1635   - xfs_da_buf_done(dbp);
1636 1627 xfs_dir2_leaf_check(dp, lbp);
1637   - xfs_da_brelse(tp, lbp);
  1628 + xfs_trans_brelse(tp, lbp);
1638 1629 return 0;
1639 1630 }
1640 1631  
... ... @@ -1646,7 +1637,7 @@
1646 1637 int /* index value */
1647 1638 xfs_dir2_leaf_search_hash(
1648 1639 xfs_da_args_t *args, /* operation arguments */
1649   - xfs_dabuf_t *lbp) /* leaf buffer */
  1640 + struct xfs_buf *lbp) /* leaf buffer */
1650 1641 {
1651 1642 xfs_dahash_t hash=0; /* hash from this entry */
1652 1643 xfs_dahash_t hashwant; /* hash value looking for */
... ... @@ -1656,7 +1647,7 @@
1656 1647 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1657 1648 int mid=0; /* current leaf index */
1658 1649  
1659   - leaf = lbp->data;
  1650 + leaf = lbp->b_addr;
1660 1651 #ifndef __KERNEL__
1661 1652 if (!leaf->hdr.count)
1662 1653 return 0;
1663 1654  
... ... @@ -1699,11 +1690,11 @@
1699 1690 int /* error */
1700 1691 xfs_dir2_leaf_trim_data(
1701 1692 xfs_da_args_t *args, /* operation arguments */
1702   - xfs_dabuf_t *lbp, /* leaf buffer */
  1693 + struct xfs_buf *lbp, /* leaf buffer */
1703 1694 xfs_dir2_db_t db) /* data block number */
1704 1695 {
1705 1696 __be16 *bestsp; /* leaf bests table */
1706   - xfs_dabuf_t *dbp; /* data block buffer */
  1697 + struct xfs_buf *dbp; /* data block buffer */
1707 1698 xfs_inode_t *dp; /* incore directory inode */
1708 1699 int error; /* error return value */
1709 1700 xfs_dir2_leaf_t *leaf; /* leaf structure */
1710 1701  
... ... @@ -1722,12 +1713,12 @@
1722 1713 return error;
1723 1714 }
1724 1715  
1725   - leaf = lbp->data;
  1716 + leaf = lbp->b_addr;
1726 1717 ltp = xfs_dir2_leaf_tail_p(mp, leaf);
1727 1718  
1728 1719 #ifdef DEBUG
1729 1720 {
1730   - struct xfs_dir2_data_hdr *hdr = dbp->data;
  1721 + struct xfs_dir2_data_hdr *hdr = dbp->b_addr;
1731 1722  
1732 1723 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC));
1733 1724 ASSERT(be16_to_cpu(hdr->bestfree[0].length) ==
... ... @@ -1741,7 +1732,7 @@
1741 1732 */
1742 1733 if ((error = xfs_dir2_shrink_inode(args, db, dbp))) {
1743 1734 ASSERT(error != ENOSPC);
1744   - xfs_da_brelse(tp, dbp);
  1735 + xfs_trans_brelse(tp, dbp);
1745 1736 return error;
1746 1737 }
1747 1738 /*
1748 1739  
... ... @@ -1781,10 +1772,10 @@
1781 1772 xfs_da_args_t *args; /* operation arguments */
1782 1773 xfs_inode_t *dp; /* incore directory inode */
1783 1774 int error; /* error return code */
1784   - xfs_dabuf_t *fbp; /* buffer for freespace block */
  1775 + struct xfs_buf *fbp; /* buffer for freespace block */
1785 1776 xfs_fileoff_t fo; /* freespace file offset */
1786 1777 xfs_dir2_free_t *free; /* freespace structure */
1787   - xfs_dabuf_t *lbp; /* buffer for leaf block */
  1778 + struct xfs_buf *lbp; /* buffer for leaf block */
1788 1779 xfs_dir2_leaf_tail_t *ltp; /* tail of leaf structure */
1789 1780 xfs_dir2_leaf_t *leaf; /* leaf structure */
1790 1781 xfs_mount_t *mp; /* filesystem mount point */
... ... @@ -1838,7 +1829,7 @@
1838 1829 if (XFS_FSB_TO_B(mp, fo) > XFS_DIR2_LEAF_OFFSET + mp->m_dirblksize)
1839 1830 return 0;
1840 1831 lbp = state->path.blk[0].bp;
1841   - leaf = lbp->data;
  1832 + leaf = lbp->b_addr;
1842 1833 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
1843 1834 /*
1844 1835 * Read the freespace block.
... ... @@ -1847,7 +1838,7 @@
1847 1838 XFS_DATA_FORK))) {
1848 1839 return error;
1849 1840 }
1850   - free = fbp->data;
  1841 + free = fbp->b_addr;
1851 1842 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
1852 1843 ASSERT(!free->hdr.firstdb);
1853 1844  
... ... @@ -1857,7 +1848,7 @@
1857 1848 */
1858 1849 if (xfs_dir2_leaf_size(&leaf->hdr, be32_to_cpu(free->hdr.nvalid)) >
1859 1850 mp->m_dirblksize) {
1860   - xfs_da_brelse(tp, fbp);
  1851 + xfs_trans_brelse(tp, fbp);
1861 1852 return 0;
1862 1853 }
1863 1854  
fs/xfs/xfs_dir2_node.c
... ... @@ -36,20 +36,20 @@
36 36 /*
37 37 * Function declarations.
38 38 */
39   -static void xfs_dir2_free_log_header(xfs_trans_t *tp, xfs_dabuf_t *bp);
40   -static int xfs_dir2_leafn_add(xfs_dabuf_t *bp, xfs_da_args_t *args, int index);
  39 +static int xfs_dir2_leafn_add(struct xfs_buf *bp, xfs_da_args_t *args,
  40 + int index);
41 41 #ifdef DEBUG
42   -static void xfs_dir2_leafn_check(xfs_inode_t *dp, xfs_dabuf_t *bp);
  42 +static void xfs_dir2_leafn_check(struct xfs_inode *dp, struct xfs_buf *bp);
43 43 #else
44 44 #define xfs_dir2_leafn_check(dp, bp)
45 45 #endif
46   -static void xfs_dir2_leafn_moveents(xfs_da_args_t *args, xfs_dabuf_t *bp_s,
47   - int start_s, xfs_dabuf_t *bp_d, int start_d,
48   - int count);
  46 +static void xfs_dir2_leafn_moveents(xfs_da_args_t *args, struct xfs_buf *bp_s,
  47 + int start_s, struct xfs_buf *bp_d,
  48 + int start_d, int count);
49 49 static void xfs_dir2_leafn_rebalance(xfs_da_state_t *state,
50 50 xfs_da_state_blk_t *blk1,
51 51 xfs_da_state_blk_t *blk2);
52   -static int xfs_dir2_leafn_remove(xfs_da_args_t *args, xfs_dabuf_t *bp,
  52 +static int xfs_dir2_leafn_remove(xfs_da_args_t *args, struct xfs_buf *bp,
53 53 int index, xfs_da_state_blk_t *dblk,
54 54 int *rval);
55 55 static int xfs_dir2_node_addname_int(xfs_da_args_t *args,
56 56  
57 57  
... ... @@ -60,16 +60,16 @@
60 60 */
61 61 STATIC void
62 62 xfs_dir2_free_log_bests(
63   - xfs_trans_t *tp, /* transaction pointer */
64   - xfs_dabuf_t *bp, /* freespace buffer */
  63 + struct xfs_trans *tp,
  64 + struct xfs_buf *bp,
65 65 int first, /* first entry to log */
66 66 int last) /* last entry to log */
67 67 {
68 68 xfs_dir2_free_t *free; /* freespace structure */
69 69  
70   - free = bp->data;
  70 + free = bp->b_addr;
71 71 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
72   - xfs_da_log_buf(tp, bp,
  72 + xfs_trans_log_buf(tp, bp,
73 73 (uint)((char *)&free->bests[first] - (char *)free),
74 74 (uint)((char *)&free->bests[last] - (char *)free +
75 75 sizeof(free->bests[0]) - 1));
76 76  
77 77  
... ... @@ -80,14 +80,14 @@
80 80 */
81 81 static void
82 82 xfs_dir2_free_log_header(
83   - xfs_trans_t *tp, /* transaction pointer */
84   - xfs_dabuf_t *bp) /* freespace buffer */
  83 + struct xfs_trans *tp,
  84 + struct xfs_buf *bp)
85 85 {
86 86 xfs_dir2_free_t *free; /* freespace structure */
87 87  
88   - free = bp->data;
  88 + free = bp->b_addr;
89 89 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
90   - xfs_da_log_buf(tp, bp, (uint)((char *)&free->hdr - (char *)free),
  90 + xfs_trans_log_buf(tp, bp, (uint)((char *)&free->hdr - (char *)free),
91 91 (uint)(sizeof(xfs_dir2_free_hdr_t) - 1));
92 92 }
93 93  
94 94  
... ... @@ -99,11 +99,11 @@
99 99 int /* error */
100 100 xfs_dir2_leaf_to_node(
101 101 xfs_da_args_t *args, /* operation arguments */
102   - xfs_dabuf_t *lbp) /* leaf buffer */
  102 + struct xfs_buf *lbp) /* leaf buffer */
103 103 {
104 104 xfs_inode_t *dp; /* incore directory inode */
105 105 int error; /* error return value */
106   - xfs_dabuf_t *fbp; /* freespace buffer */
  106 + struct xfs_buf *fbp; /* freespace buffer */
107 107 xfs_dir2_db_t fdb; /* freespace block number */
108 108 xfs_dir2_free_t *free; /* freespace structure */
109 109 __be16 *from; /* pointer to freespace entry */
... ... @@ -136,8 +136,8 @@
136 136 return error;
137 137 }
138 138 ASSERT(fbp != NULL);
139   - free = fbp->data;
140   - leaf = lbp->data;
  139 + free = fbp->b_addr;
  140 + leaf = lbp->b_addr;
141 141 ltp = xfs_dir2_leaf_tail_p(mp, leaf);
142 142 /*
143 143 * Initialize the freespace block header.
... ... @@ -164,7 +164,6 @@
164 164 xfs_dir2_leaf_log_header(tp, lbp);
165 165 xfs_dir2_free_log_header(tp, fbp);
166 166 xfs_dir2_free_log_bests(tp, fbp, 0, be32_to_cpu(free->hdr.nvalid) - 1);
167   - xfs_da_buf_done(fbp);
168 167 xfs_dir2_leafn_check(dp, lbp);
169 168 return 0;
170 169 }
... ... @@ -175,7 +174,7 @@
175 174 */
176 175 static int /* error */
177 176 xfs_dir2_leafn_add(
178   - xfs_dabuf_t *bp, /* leaf buffer */
  177 + struct xfs_buf *bp, /* leaf buffer */
179 178 xfs_da_args_t *args, /* operation arguments */
180 179 int index) /* insertion pt for new entry */
181 180 {
... ... @@ -195,7 +194,7 @@
195 194 dp = args->dp;
196 195 mp = dp->i_mount;
197 196 tp = args->trans;
198   - leaf = bp->data;
  197 + leaf = bp->b_addr;
199 198  
200 199 /*
201 200 * Quick check just to make sure we are not going to index
202 201  
... ... @@ -261,15 +260,15 @@
261 260 */
262 261 void
263 262 xfs_dir2_leafn_check(
264   - xfs_inode_t *dp, /* incore directory inode */
265   - xfs_dabuf_t *bp) /* leaf buffer */
  263 + struct xfs_inode *dp,
  264 + struct xfs_buf *bp)
266 265 {
267 266 int i; /* leaf index */
268 267 xfs_dir2_leaf_t *leaf; /* leaf structure */
269 268 xfs_mount_t *mp; /* filesystem mount point */
270 269 int stale; /* count of stale leaves */
271 270  
272   - leaf = bp->data;
  271 + leaf = bp->b_addr;
273 272 mp = dp->i_mount;
274 273 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
275 274 ASSERT(be16_to_cpu(leaf->hdr.count) <= xfs_dir2_max_leaf_ents(mp));
276 275  
... ... @@ -291,12 +290,12 @@
291 290 */
292 291 xfs_dahash_t /* hash value */
293 292 xfs_dir2_leafn_lasthash(
294   - xfs_dabuf_t *bp, /* leaf buffer */
  293 + struct xfs_buf *bp, /* leaf buffer */
295 294 int *count) /* count of entries in leaf */
296 295 {
297 296 xfs_dir2_leaf_t *leaf; /* leaf structure */
298 297  
299   - leaf = bp->data;
  298 + leaf = bp->b_addr;
300 299 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
301 300 if (count)
302 301 *count = be16_to_cpu(leaf->hdr.count);
303 302  
... ... @@ -311,12 +310,12 @@
311 310 */
312 311 STATIC int
313 312 xfs_dir2_leafn_lookup_for_addname(
314   - xfs_dabuf_t *bp, /* leaf buffer */
  313 + struct xfs_buf *bp, /* leaf buffer */
315 314 xfs_da_args_t *args, /* operation arguments */
316 315 int *indexp, /* out: leaf entry index */
317 316 xfs_da_state_t *state) /* state to fill in */
318 317 {
319   - xfs_dabuf_t *curbp = NULL; /* current data/free buffer */
  318 + struct xfs_buf *curbp = NULL; /* current data/free buffer */
320 319 xfs_dir2_db_t curdb = -1; /* current data block number */
321 320 xfs_dir2_db_t curfdb = -1; /* current free block number */
322 321 xfs_inode_t *dp; /* incore directory inode */
... ... @@ -335,7 +334,7 @@
335 334 dp = args->dp;
336 335 tp = args->trans;
337 336 mp = dp->i_mount;
338   - leaf = bp->data;
  337 + leaf = bp->b_addr;
339 338 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
340 339 #ifdef __KERNEL__
341 340 ASSERT(be16_to_cpu(leaf->hdr.count) > 0);
... ... @@ -352,7 +351,7 @@
352 351 /* If so, it's a free block buffer, get the block number. */
353 352 curbp = state->extrablk.bp;
354 353 curfdb = state->extrablk.blkno;
355   - free = curbp->data;
  354 + free = curbp->b_addr;
356 355 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
357 356 }
358 357 length = xfs_dir2_data_entsize(args->namelen);
... ... @@ -394,7 +393,7 @@
394 393 * If we had one before, drop it.
395 394 */
396 395 if (curbp)
397   - xfs_da_brelse(tp, curbp);
  396 + xfs_trans_brelse(tp, curbp);
398 397 /*
399 398 * Read the free block.
400 399 */
... ... @@ -403,7 +402,7 @@
403 402 -1, &curbp, XFS_DATA_FORK);
404 403 if (error)
405 404 return error;
406   - free = curbp->data;
  405 + free = curbp->b_addr;
407 406 ASSERT(be32_to_cpu(free->hdr.magic) ==
408 407 XFS_DIR2_FREE_MAGIC);
409 408 ASSERT((be32_to_cpu(free->hdr.firstdb) %
... ... @@ -424,7 +423,7 @@
424 423 XFS_ERROR_REPORT("xfs_dir2_leafn_lookup_int",
425 424 XFS_ERRLEVEL_LOW, mp);
426 425 if (curfdb != newfdb)
427   - xfs_da_brelse(tp, curbp);
  426 + xfs_trans_brelse(tp, curbp);
428 427 return XFS_ERROR(EFSCORRUPTED);
429 428 }
430 429 curfdb = newfdb;
431 430  
... ... @@ -459,12 +458,12 @@
459 458 */
460 459 STATIC int
461 460 xfs_dir2_leafn_lookup_for_entry(
462   - xfs_dabuf_t *bp, /* leaf buffer */
  461 + struct xfs_buf *bp, /* leaf buffer */
463 462 xfs_da_args_t *args, /* operation arguments */
464 463 int *indexp, /* out: leaf entry index */
465 464 xfs_da_state_t *state) /* state to fill in */
466 465 {
467   - xfs_dabuf_t *curbp = NULL; /* current data/free buffer */
  466 + struct xfs_buf *curbp = NULL; /* current data/free buffer */
468 467 xfs_dir2_db_t curdb = -1; /* current data block number */
469 468 xfs_dir2_data_entry_t *dep; /* data block entry */
470 469 xfs_inode_t *dp; /* incore directory inode */
... ... @@ -480,7 +479,7 @@
480 479 dp = args->dp;
481 480 tp = args->trans;
482 481 mp = dp->i_mount;
483   - leaf = bp->data;
  482 + leaf = bp->b_addr;
484 483 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
485 484 #ifdef __KERNEL__
486 485 ASSERT(be16_to_cpu(leaf->hdr.count) > 0);
... ... @@ -525,7 +524,7 @@
525 524 */
526 525 if (curbp && (args->cmpresult == XFS_CMP_DIFFERENT ||
527 526 curdb != state->extrablk.blkno))
528   - xfs_da_brelse(tp, curbp);
  527 + xfs_trans_brelse(tp, curbp);
529 528 /*
530 529 * If needing the block that is saved with a CI match,
531 530 * use it otherwise read in the new data block.
... ... @@ -547,7 +546,7 @@
547 546 /*
548 547 * Point to the data entry.
549 548 */
550   - dep = (xfs_dir2_data_entry_t *)((char *)curbp->data +
  549 + dep = (xfs_dir2_data_entry_t *)((char *)curbp->b_addr +
551 550 xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
552 551 /*
553 552 * Compare the entry and if it's an exact match, return
... ... @@ -559,7 +558,7 @@
559 558 /* If there is a CI match block, drop it */
560 559 if (args->cmpresult != XFS_CMP_DIFFERENT &&
561 560 curdb != state->extrablk.blkno)
562   - xfs_da_brelse(tp, state->extrablk.bp);
  561 + xfs_trans_brelse(tp, state->extrablk.bp);
563 562 args->cmpresult = cmp;
564 563 args->inumber = be64_to_cpu(dep->inumber);
565 564 *indexp = index;
... ... @@ -567,7 +566,7 @@
567 566 state->extrablk.bp = curbp;
568 567 state->extrablk.blkno = curdb;
569 568 state->extrablk.index = (int)((char *)dep -
570   - (char *)curbp->data);
  569 + (char *)curbp->b_addr);
571 570 state->extrablk.magic = XFS_DIR2_DATA_MAGIC;
572 571 if (cmp == XFS_CMP_EXACT)
573 572 return XFS_ERROR(EEXIST);
... ... @@ -586,7 +585,7 @@
586 585 } else {
587 586 /* If the curbp is not the CI match block, drop it */
588 587 if (state->extrablk.bp != curbp)
589   - xfs_da_brelse(tp, curbp);
  588 + xfs_trans_brelse(tp, curbp);
590 589 }
591 590 } else {
592 591 state->extravalid = 0;
... ... @@ -602,7 +601,7 @@
602 601 */
603 602 int
604 603 xfs_dir2_leafn_lookup_int(
605   - xfs_dabuf_t *bp, /* leaf buffer */
  604 + struct xfs_buf *bp, /* leaf buffer */
606 605 xfs_da_args_t *args, /* operation arguments */
607 606 int *indexp, /* out: leaf entry index */
608 607 xfs_da_state_t *state) /* state to fill in */
609 608  
... ... @@ -620,9 +619,9 @@
620 619 static void
621 620 xfs_dir2_leafn_moveents(
622 621 xfs_da_args_t *args, /* operation arguments */
623   - xfs_dabuf_t *bp_s, /* source leaf buffer */
  622 + struct xfs_buf *bp_s, /* source leaf buffer */
624 623 int start_s, /* source leaf index */
625   - xfs_dabuf_t *bp_d, /* destination leaf buffer */
  624 + struct xfs_buf *bp_d, /* destination leaf buffer */
626 625 int start_d, /* destination leaf index */
627 626 int count) /* count of leaves to copy */
628 627 {
... ... @@ -640,8 +639,8 @@
640 639 return;
641 640 }
642 641 tp = args->trans;
643   - leaf_s = bp_s->data;
644   - leaf_d = bp_d->data;
  642 + leaf_s = bp_s->b_addr;
  643 + leaf_d = bp_d->b_addr;
645 644 /*
646 645 * If the destination index is not the end of the current
647 646 * destination leaf entries, open up a hole in the destination
648 647  
... ... @@ -702,14 +701,14 @@
702 701 */
703 702 int /* sort order */
704 703 xfs_dir2_leafn_order(
705   - xfs_dabuf_t *leaf1_bp, /* leaf1 buffer */
706   - xfs_dabuf_t *leaf2_bp) /* leaf2 buffer */
  704 + struct xfs_buf *leaf1_bp, /* leaf1 buffer */
  705 + struct xfs_buf *leaf2_bp) /* leaf2 buffer */
707 706 {
708 707 xfs_dir2_leaf_t *leaf1; /* leaf1 structure */
709 708 xfs_dir2_leaf_t *leaf2; /* leaf2 structure */
710 709  
711   - leaf1 = leaf1_bp->data;
712   - leaf2 = leaf2_bp->data;
  710 + leaf1 = leaf1_bp->b_addr;
  711 + leaf2 = leaf2_bp->b_addr;
713 712 ASSERT(leaf1->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
714 713 ASSERT(leaf2->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
715 714 if (be16_to_cpu(leaf1->hdr.count) > 0 &&
... ... @@ -757,8 +756,8 @@
757 756 blk1 = blk2;
758 757 blk2 = tmp;
759 758 }
760   - leaf1 = blk1->bp->data;
761   - leaf2 = blk2->bp->data;
  759 + leaf1 = blk1->bp->b_addr;
  760 + leaf2 = blk2->bp->b_addr;
762 761 oldsum = be16_to_cpu(leaf1->hdr.count) + be16_to_cpu(leaf2->hdr.count);
763 762 #ifdef DEBUG
764 763 oldstale = be16_to_cpu(leaf1->hdr.stale) + be16_to_cpu(leaf2->hdr.stale);
765 764  
... ... @@ -834,14 +833,14 @@
834 833 static int /* error */
835 834 xfs_dir2_leafn_remove(
836 835 xfs_da_args_t *args, /* operation arguments */
837   - xfs_dabuf_t *bp, /* leaf buffer */
  836 + struct xfs_buf *bp, /* leaf buffer */
838 837 int index, /* leaf entry index */
839 838 xfs_da_state_blk_t *dblk, /* data block */
840 839 int *rval) /* resulting block needs join */
841 840 {
842 841 xfs_dir2_data_hdr_t *hdr; /* data block header */
843 842 xfs_dir2_db_t db; /* data block number */
844   - xfs_dabuf_t *dbp; /* data block buffer */
  843 + struct xfs_buf *dbp; /* data block buffer */
845 844 xfs_dir2_data_entry_t *dep; /* data block entry */
846 845 xfs_inode_t *dp; /* incore directory inode */
847 846 xfs_dir2_leaf_t *leaf; /* leaf structure */
... ... @@ -858,7 +857,7 @@
858 857 dp = args->dp;
859 858 tp = args->trans;
860 859 mp = dp->i_mount;
861   - leaf = bp->data;
  860 + leaf = bp->b_addr;
862 861 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
863 862 /*
864 863 * Point to the entry we're removing.
... ... @@ -884,7 +883,7 @@
884 883 * in the data block in case it changes.
885 884 */
886 885 dbp = dblk->bp;
887   - hdr = dbp->data;
  886 + hdr = dbp->b_addr;
888 887 dep = (xfs_dir2_data_entry_t *)((char *)hdr + off);
889 888 longest = be16_to_cpu(hdr->bestfree[0].length);
890 889 needlog = needscan = 0;
... ... @@ -905,7 +904,7 @@
905 904 */
906 905 if (longest < be16_to_cpu(hdr->bestfree[0].length)) {
907 906 int error; /* error return value */
908   - xfs_dabuf_t *fbp; /* freeblock buffer */
  907 + struct xfs_buf *fbp; /* freeblock buffer */
909 908 xfs_dir2_db_t fdb; /* freeblock block number */
910 909 int findex; /* index in freeblock entries */
911 910 xfs_dir2_free_t *free; /* freeblock structure */
... ... @@ -920,7 +919,7 @@
920 919 -1, &fbp, XFS_DATA_FORK))) {
921 920 return error;
922 921 }
923   - free = fbp->data;
  922 + free = fbp->b_addr;
924 923 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
925 924 ASSERT(be32_to_cpu(free->hdr.firstdb) ==
926 925 xfs_dir2_free_max_bests(mp) *
... ... @@ -948,9 +947,7 @@
948 947 * In this case just drop the buffer and some one else
949 948 * will eventually get rid of the empty block.
950 949 */
951   - else if (error == ENOSPC && args->total == 0)
952   - xfs_da_buf_done(dbp);
953   - else
  950 + else if (!(error == ENOSPC && args->total == 0))
954 951 return error;
955 952 }
956 953 /*
... ... @@ -1018,11 +1015,6 @@
1018 1015 */
1019 1016 if (logfree)
1020 1017 xfs_dir2_free_log_bests(tp, fbp, findex, findex);
1021   - /*
1022   - * Drop the buffer if we still have it.
1023   - */
1024   - if (fbp)
1025   - xfs_da_buf_done(fbp);
1026 1018 }
1027 1019 xfs_dir2_leafn_check(dp, bp);
1028 1020 /*
... ... @@ -1114,7 +1106,7 @@
1114 1106 {
1115 1107 xfs_da_state_blk_t *blk; /* leaf block */
1116 1108 xfs_dablk_t blkno; /* leaf block number */
1117   - xfs_dabuf_t *bp; /* leaf buffer */
  1109 + struct xfs_buf *bp; /* leaf buffer */
1118 1110 int bytes; /* bytes in use */
1119 1111 int count; /* leaf live entry count */
1120 1112 int error; /* error return value */
... ... @@ -1130,7 +1122,7 @@
1130 1122 * to coalesce with a sibling.
1131 1123 */
1132 1124 blk = &state->path.blk[state->path.active - 1];
1133   - info = blk->bp->data;
  1125 + info = blk->bp->b_addr;
1134 1126 ASSERT(info->magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
1135 1127 leaf = (xfs_dir2_leaf_t *)info;
1136 1128 count = be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale);
... ... @@ -1189,7 +1181,7 @@
1189 1181 leaf = (xfs_dir2_leaf_t *)info;
1190 1182 count = be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale);
1191 1183 bytes = state->blocksize - (state->blocksize >> 2);
1192   - leaf = bp->data;
  1184 + leaf = bp->b_addr;
1193 1185 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
1194 1186 count += be16_to_cpu(leaf->hdr.count) - be16_to_cpu(leaf->hdr.stale);
1195 1187 bytes -= count * (uint)sizeof(leaf->ents[0]);
... ... @@ -1198,7 +1190,7 @@
1198 1190 */
1199 1191 if (bytes >= 0)
1200 1192 break;
1201   - xfs_da_brelse(state->args->trans, bp);
  1193 + xfs_trans_brelse(state->args->trans, bp);
1202 1194 }
1203 1195 /*
1204 1196 * Didn't like either block, give up.
1205 1197  
... ... @@ -1207,12 +1199,8 @@
1207 1199 *action = 0;
1208 1200 return 0;
1209 1201 }
  1202 +
1210 1203 /*
1211   - * Done with the sibling leaf block here, drop the dabuf
1212   - * so path_shift can get it.
1213   - */
1214   - xfs_da_buf_done(bp);
1215   - /*
1216 1204 * Make altpath point to the block we want to keep (the lower
1217 1205 * numbered block) and path point to the block we want to drop.
1218 1206 */
... ... @@ -1247,8 +1235,8 @@
1247 1235 args = state->args;
1248 1236 ASSERT(drop_blk->magic == XFS_DIR2_LEAFN_MAGIC);
1249 1237 ASSERT(save_blk->magic == XFS_DIR2_LEAFN_MAGIC);
1250   - drop_leaf = drop_blk->bp->data;
1251   - save_leaf = save_blk->bp->data;
  1238 + drop_leaf = drop_blk->bp->b_addr;
  1239 + save_leaf = save_blk->bp->b_addr;
1252 1240 ASSERT(drop_leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
1253 1241 ASSERT(save_leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
1254 1242 /*
1255 1243  
... ... @@ -1356,13 +1344,13 @@
1356 1344 {
1357 1345 xfs_dir2_data_hdr_t *hdr; /* data block header */
1358 1346 xfs_dir2_db_t dbno; /* data block number */
1359   - xfs_dabuf_t *dbp; /* data block buffer */
  1347 + struct xfs_buf *dbp; /* data block buffer */
1360 1348 xfs_dir2_data_entry_t *dep; /* data entry pointer */
1361 1349 xfs_inode_t *dp; /* incore directory inode */
1362 1350 xfs_dir2_data_unused_t *dup; /* data unused entry pointer */
1363 1351 int error; /* error return value */
1364 1352 xfs_dir2_db_t fbno; /* freespace block number */
1365   - xfs_dabuf_t *fbp; /* freespace buffer */
  1353 + struct xfs_buf *fbp; /* freespace buffer */
1366 1354 int findex; /* freespace entry index */
1367 1355 xfs_dir2_free_t *free=NULL; /* freespace block structure */
1368 1356 xfs_dir2_db_t ifbno; /* initial freespace block no */
... ... @@ -1390,7 +1378,7 @@
1390 1378 * Remember initial freespace block number.
1391 1379 */
1392 1380 ifbno = fblk->blkno;
1393   - free = fbp->data;
  1381 + free = fbp->b_addr;
1394 1382 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
1395 1383 findex = fblk->index;
1396 1384 /*
... ... @@ -1474,7 +1462,7 @@
1474 1462 if (unlikely(fbp == NULL)) {
1475 1463 continue;
1476 1464 }
1477   - free = fbp->data;
  1465 + free = fbp->b_addr;
1478 1466 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
1479 1467 findex = 0;
1480 1468 }
... ... @@ -1492,7 +1480,7 @@
1492 1480 /*
1493 1481 * Drop the block.
1494 1482 */
1495   - xfs_da_brelse(tp, fbp);
  1483 + xfs_trans_brelse(tp, fbp);
1496 1484 fbp = NULL;
1497 1485 if (fblk && fblk->bp)
1498 1486 fblk->bp = NULL;
1499 1487  
1500 1488  
1501 1489  
1502 1490  
... ... @@ -1507,36 +1495,23 @@
1507 1495 /*
1508 1496 * Not allowed to allocate, return failure.
1509 1497 */
1510   - if ((args->op_flags & XFS_DA_OP_JUSTCHECK) ||
1511   - args->total == 0) {
1512   - /*
1513   - * Drop the freespace buffer unless it came from our
1514   - * caller.
1515   - */
1516   - if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL)
1517   - xfs_da_buf_done(fbp);
  1498 + if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || args->total == 0)
1518 1499 return XFS_ERROR(ENOSPC);
1519   - }
  1500 +
1520 1501 /*
1521 1502 * Allocate and initialize the new data block.
1522 1503 */
1523 1504 if (unlikely((error = xfs_dir2_grow_inode(args,
1524 1505 XFS_DIR2_DATA_SPACE,
1525 1506 &dbno)) ||
1526   - (error = xfs_dir2_data_init(args, dbno, &dbp)))) {
1527   - /*
1528   - * Drop the freespace buffer unless it came from our
1529   - * caller.
1530   - */
1531   - if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL)
1532   - xfs_da_buf_done(fbp);
  1507 + (error = xfs_dir2_data_init(args, dbno, &dbp))))
1533 1508 return error;
1534   - }
  1509 +
1535 1510 /*
1536 1511 * If (somehow) we have a freespace block, get rid of it.
1537 1512 */
1538 1513 if (fbp)
1539   - xfs_da_brelse(tp, fbp);
  1514 + xfs_trans_brelse(tp, fbp);
1540 1515 if (fblk && fblk->bp)
1541 1516 fblk->bp = NULL;
1542 1517  
1543 1518  
... ... @@ -1547,10 +1522,9 @@
1547 1522 fbno = xfs_dir2_db_to_fdb(mp, dbno);
1548 1523 if (unlikely(error = xfs_da_read_buf(tp, dp,
1549 1524 xfs_dir2_db_to_da(mp, fbno), -2, &fbp,
1550   - XFS_DATA_FORK))) {
1551   - xfs_da_buf_done(dbp);
  1525 + XFS_DATA_FORK)))
1552 1526 return error;
1553   - }
  1527 +
1554 1528 /*
1555 1529 * If there wasn't a freespace block, the read will
1556 1530 * return a NULL fbp. Allocate and initialize a new one.
... ... @@ -1598,7 +1572,7 @@
1598 1572 * Initialize the new block to be empty, and remember
1599 1573 * its first slot as our empty slot.
1600 1574 */
1601   - free = fbp->data;
  1575 + free = fbp->b_addr;
1602 1576 free->hdr.magic = cpu_to_be32(XFS_DIR2_FREE_MAGIC);
1603 1577 free->hdr.firstdb = cpu_to_be32(
1604 1578 (fbno - XFS_DIR2_FREE_FIRSTDB(mp)) *
... ... @@ -1606,7 +1580,7 @@
1606 1580 free->hdr.nvalid = 0;
1607 1581 free->hdr.nused = 0;
1608 1582 } else {
1609   - free = fbp->data;
  1583 + free = fbp->b_addr;
1610 1584 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
1611 1585 }
1612 1586  
... ... @@ -1639,7 +1613,7 @@
1639 1613 * We haven't allocated the data entry yet so this will
1640 1614 * change again.
1641 1615 */
1642   - hdr = dbp->data;
  1616 + hdr = dbp->b_addr;
1643 1617 free->bests[findex] = hdr->bestfree[0].length;
1644 1618 logfree = 1;
1645 1619 }
1646 1620  
1647 1621  
1648 1622  
... ... @@ -1650,22 +1624,17 @@
1650 1624 /*
1651 1625 * If just checking, we succeeded.
1652 1626 */
1653   - if (args->op_flags & XFS_DA_OP_JUSTCHECK) {
1654   - if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL)
1655   - xfs_da_buf_done(fbp);
  1627 + if (args->op_flags & XFS_DA_OP_JUSTCHECK)
1656 1628 return 0;
1657   - }
  1629 +
1658 1630 /*
1659 1631 * Read the data block in.
1660 1632 */
1661   - if (unlikely(
1662   - error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, dbno),
1663   - -1, &dbp, XFS_DATA_FORK))) {
1664   - if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL)
1665   - xfs_da_buf_done(fbp);
  1633 + error = xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, dbno),
  1634 + -1, &dbp, XFS_DATA_FORK);
  1635 + if (error)
1666 1636 return error;
1667   - }
1668   - hdr = dbp->data;
  1637 + hdr = dbp->b_addr;
1669 1638 logfree = 0;
1670 1639 }
1671 1640 ASSERT(be16_to_cpu(hdr->bestfree[0].length) >= length);
1672 1641  
... ... @@ -1714,16 +1683,10 @@
1714 1683 if (logfree)
1715 1684 xfs_dir2_free_log_bests(tp, fbp, findex, findex);
1716 1685 /*
1717   - * If the caller didn't hand us the freespace block, drop it.
1718   - */
1719   - if ((fblk == NULL || fblk->bp == NULL) && fbp != NULL)
1720   - xfs_da_buf_done(fbp);
1721   - /*
1722 1686 * Return the data block and offset in args, then drop the data block.
1723 1687 */
1724 1688 args->blkno = (xfs_dablk_t)dbno;
1725 1689 args->index = be16_to_cpu(*tagp);
1726   - xfs_da_buf_done(dbp);
1727 1690 return 0;
1728 1691 }
1729 1692  
1730 1693  
1731 1694  
... ... @@ -1761,22 +1724,23 @@
1761 1724 /* If a CI match, dup the actual name and return EEXIST */
1762 1725 xfs_dir2_data_entry_t *dep;
1763 1726  
1764   - dep = (xfs_dir2_data_entry_t *)((char *)state->extrablk.bp->
1765   - data + state->extrablk.index);
  1727 + dep = (xfs_dir2_data_entry_t *)
  1728 + ((char *)state->extrablk.bp->b_addr +
  1729 + state->extrablk.index);
1766 1730 rval = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
1767 1731 }
1768 1732 /*
1769 1733 * Release the btree blocks and leaf block.
1770 1734 */
1771 1735 for (i = 0; i < state->path.active; i++) {
1772   - xfs_da_brelse(args->trans, state->path.blk[i].bp);
  1736 + xfs_trans_brelse(args->trans, state->path.blk[i].bp);
1773 1737 state->path.blk[i].bp = NULL;
1774 1738 }
1775 1739 /*
1776 1740 * Release the data block if we have it.
1777 1741 */
1778 1742 if (state->extravalid && state->extrablk.bp) {
1779   - xfs_da_brelse(args->trans, state->extrablk.bp);
  1743 + xfs_trans_brelse(args->trans, state->extrablk.bp);
1780 1744 state->extrablk.bp = NULL;
1781 1745 }
1782 1746 xfs_da_state_free(state);
1783 1747  
... ... @@ -1893,13 +1857,13 @@
1893 1857 */
1894 1858 blk = &state->path.blk[state->path.active - 1];
1895 1859 ASSERT(blk->magic == XFS_DIR2_LEAFN_MAGIC);
1896   - leaf = blk->bp->data;
  1860 + leaf = blk->bp->b_addr;
1897 1861 lep = &leaf->ents[blk->index];
1898 1862 ASSERT(state->extravalid);
1899 1863 /*
1900 1864 * Point to the data entry.
1901 1865 */
1902   - hdr = state->extrablk.bp->data;
  1866 + hdr = state->extrablk.bp->b_addr;
1903 1867 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC));
1904 1868 dep = (xfs_dir2_data_entry_t *)
1905 1869 ((char *)hdr +
1906 1870  
... ... @@ -1916,14 +1880,14 @@
1916 1880 * Didn't find it, and we're holding a data block. Drop it.
1917 1881 */
1918 1882 else if (state->extravalid) {
1919   - xfs_da_brelse(args->trans, state->extrablk.bp);
  1883 + xfs_trans_brelse(args->trans, state->extrablk.bp);
1920 1884 state->extrablk.bp = NULL;
1921 1885 }
1922 1886 /*
1923 1887 * Release all the buffers in the cursor.
1924 1888 */
1925 1889 for (i = 0; i < state->path.active; i++) {
1926   - xfs_da_brelse(args->trans, state->path.blk[i].bp);
  1890 + xfs_trans_brelse(args->trans, state->path.blk[i].bp);
1927 1891 state->path.blk[i].bp = NULL;
1928 1892 }
1929 1893 xfs_da_state_free(state);
... ... @@ -1940,7 +1904,7 @@
1940 1904 xfs_fileoff_t fo, /* free block number */
1941 1905 int *rvalp) /* out: did something */
1942 1906 {
1943   - xfs_dabuf_t *bp; /* freespace buffer */
  1907 + struct xfs_buf *bp; /* freespace buffer */
1944 1908 xfs_inode_t *dp; /* incore directory inode */
1945 1909 int error; /* error return code */
1946 1910 xfs_dir2_free_t *free; /* freespace structure */
1947 1911  
... ... @@ -1965,13 +1929,13 @@
1965 1929 if (bp == NULL) {
1966 1930 return 0;
1967 1931 }
1968   - free = bp->data;
  1932 + free = bp->b_addr;
1969 1933 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
1970 1934 /*
1971 1935 * If there are used entries, there's nothing to do.
1972 1936 */
1973 1937 if (be32_to_cpu(free->hdr.nused) > 0) {
1974   - xfs_da_brelse(tp, bp);
  1938 + xfs_trans_brelse(tp, bp);
1975 1939 *rvalp = 0;
1976 1940 return 0;
1977 1941 }
... ... @@ -1987,7 +1951,7 @@
1987 1951 * pieces. This is the last block of an extent.
1988 1952 */
1989 1953 ASSERT(error != ENOSPC);
1990   - xfs_da_brelse(tp, bp);
  1954 + xfs_trans_brelse(tp, bp);
1991 1955 return error;
1992 1956 }
1993 1957 /*
fs/xfs/xfs_dir2_priv.h
... ... @@ -25,7 +25,7 @@
25 25 extern int xfs_dir2_grow_inode(struct xfs_da_args *args, int space,
26 26 xfs_dir2_db_t *dbp);
27 27 extern int xfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
28   - struct xfs_dabuf *bp);
  28 + struct xfs_buf *bp);
29 29 extern int xfs_dir_cilookup_result(struct xfs_da_args *args,
30 30 const unsigned char *name, int len);
31 31  
32 32  
... ... @@ -37,11 +37,11 @@
37 37 extern int xfs_dir2_block_removename(struct xfs_da_args *args);
38 38 extern int xfs_dir2_block_replace(struct xfs_da_args *args);
39 39 extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args,
40   - struct xfs_dabuf *lbp, struct xfs_dabuf *dbp);
  40 + struct xfs_buf *lbp, struct xfs_buf *dbp);
41 41  
42 42 /* xfs_dir2_data.c */
43 43 #ifdef DEBUG
44   -extern void xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_dabuf *bp);
  44 +extern void xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_buf *bp);
45 45 #else
46 46 #define xfs_dir2_data_check(dp,bp)
47 47 #endif
48 48  
49 49  
50 50  
51 51  
52 52  
53 53  
54 54  
55 55  
56 56  
... ... @@ -51,43 +51,43 @@
51 51 extern void xfs_dir2_data_freescan(struct xfs_mount *mp,
52 52 struct xfs_dir2_data_hdr *hdr, int *loghead);
53 53 extern int xfs_dir2_data_init(struct xfs_da_args *args, xfs_dir2_db_t blkno,
54   - struct xfs_dabuf **bpp);
55   -extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_dabuf *bp,
  54 + struct xfs_buf **bpp);
  55 +extern void xfs_dir2_data_log_entry(struct xfs_trans *tp, struct xfs_buf *bp,
56 56 struct xfs_dir2_data_entry *dep);
57 57 extern void xfs_dir2_data_log_header(struct xfs_trans *tp,
58   - struct xfs_dabuf *bp);
59   -extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_dabuf *bp,
  58 + struct xfs_buf *bp);
  59 +extern void xfs_dir2_data_log_unused(struct xfs_trans *tp, struct xfs_buf *bp,
60 60 struct xfs_dir2_data_unused *dup);
61   -extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_dabuf *bp,
  61 +extern void xfs_dir2_data_make_free(struct xfs_trans *tp, struct xfs_buf *bp,
62 62 xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len,
63 63 int *needlogp, int *needscanp);
64   -extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_dabuf *bp,
  64 +extern void xfs_dir2_data_use_free(struct xfs_trans *tp, struct xfs_buf *bp,
65 65 struct xfs_dir2_data_unused *dup, xfs_dir2_data_aoff_t offset,
66 66 xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp);
67 67  
68 68 /* xfs_dir2_leaf.c */
69 69 extern int xfs_dir2_block_to_leaf(struct xfs_da_args *args,
70   - struct xfs_dabuf *dbp);
  70 + struct xfs_buf *dbp);
71 71 extern int xfs_dir2_leaf_addname(struct xfs_da_args *args);
72 72 extern void xfs_dir2_leaf_compact(struct xfs_da_args *args,
73   - struct xfs_dabuf *bp);
74   -extern void xfs_dir2_leaf_compact_x1(struct xfs_dabuf *bp, int *indexp,
  73 + struct xfs_buf *bp);
  74 +extern void xfs_dir2_leaf_compact_x1(struct xfs_buf *bp, int *indexp,
75 75 int *lowstalep, int *highstalep, int *lowlogp, int *highlogp);
76 76 extern int xfs_dir2_leaf_getdents(struct xfs_inode *dp, void *dirent,
77 77 size_t bufsize, xfs_off_t *offset, filldir_t filldir);
78 78 extern int xfs_dir2_leaf_init(struct xfs_da_args *args, xfs_dir2_db_t bno,
79   - struct xfs_dabuf **bpp, int magic);
80   -extern void xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_dabuf *bp,
  79 + struct xfs_buf **bpp, int magic);
  80 +extern void xfs_dir2_leaf_log_ents(struct xfs_trans *tp, struct xfs_buf *bp,
81 81 int first, int last);
82 82 extern void xfs_dir2_leaf_log_header(struct xfs_trans *tp,
83   - struct xfs_dabuf *bp);
  83 + struct xfs_buf *bp);
84 84 extern int xfs_dir2_leaf_lookup(struct xfs_da_args *args);
85 85 extern int xfs_dir2_leaf_removename(struct xfs_da_args *args);
86 86 extern int xfs_dir2_leaf_replace(struct xfs_da_args *args);
87 87 extern int xfs_dir2_leaf_search_hash(struct xfs_da_args *args,
88   - struct xfs_dabuf *lbp);
  88 + struct xfs_buf *lbp);
89 89 extern int xfs_dir2_leaf_trim_data(struct xfs_da_args *args,
90   - struct xfs_dabuf *lbp, xfs_dir2_db_t db);
  90 + struct xfs_buf *lbp, xfs_dir2_db_t db);
91 91 extern struct xfs_dir2_leaf_entry *
92 92 xfs_dir2_leaf_find_entry(struct xfs_dir2_leaf *leaf, int index, int compact,
93 93 int lowstale, int highstale,
94 94  
... ... @@ -96,13 +96,13 @@
96 96  
97 97 /* xfs_dir2_node.c */
98 98 extern int xfs_dir2_leaf_to_node(struct xfs_da_args *args,
99   - struct xfs_dabuf *lbp);
100   -extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_dabuf *bp, int *count);
101   -extern int xfs_dir2_leafn_lookup_int(struct xfs_dabuf *bp,
  99 + struct xfs_buf *lbp);
  100 +extern xfs_dahash_t xfs_dir2_leafn_lasthash(struct xfs_buf *bp, int *count);
  101 +extern int xfs_dir2_leafn_lookup_int(struct xfs_buf *bp,
102 102 struct xfs_da_args *args, int *indexp,
103 103 struct xfs_da_state *state);
104   -extern int xfs_dir2_leafn_order(struct xfs_dabuf *leaf1_bp,
105   - struct xfs_dabuf *leaf2_bp);
  104 +extern int xfs_dir2_leafn_order(struct xfs_buf *leaf1_bp,
  105 + struct xfs_buf *leaf2_bp);
106 106 extern int xfs_dir2_leafn_split(struct xfs_da_state *state,
107 107 struct xfs_da_state_blk *oldblk, struct xfs_da_state_blk *newblk);
108 108 extern int xfs_dir2_leafn_toosmall(struct xfs_da_state *state, int *action);
... ... @@ -122,7 +122,7 @@
122 122 struct xfs_dir2_sf_entry *sfep);
123 123 extern int xfs_dir2_block_sfsize(struct xfs_inode *dp,
124 124 struct xfs_dir2_data_hdr *block, struct xfs_dir2_sf_hdr *sfhp);
125   -extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_dabuf *bp,
  125 +extern int xfs_dir2_block_to_sf(struct xfs_da_args *args, struct xfs_buf *bp,
126 126 int size, xfs_dir2_sf_hdr_t *sfhp);
127 127 extern int xfs_dir2_sf_addname(struct xfs_da_args *args);
128 128 extern int xfs_dir2_sf_create(struct xfs_da_args *args, xfs_ino_t pino);
fs/xfs/xfs_dir2_sf.c
... ... @@ -222,7 +222,7 @@
222 222 int /* error */
223 223 xfs_dir2_block_to_sf(
224 224 xfs_da_args_t *args, /* operation arguments */
225   - xfs_dabuf_t *bp, /* block buffer */
  225 + struct xfs_buf *bp,
226 226 int size, /* shortform directory size */
227 227 xfs_dir2_sf_hdr_t *sfhp) /* shortform directory hdr */
228 228 {
... ... @@ -249,7 +249,7 @@
249 249 * and add local data.
250 250 */
251 251 hdr = kmem_alloc(mp->m_dirblksize, KM_SLEEP);
252   - memcpy(hdr, bp->data, mp->m_dirblksize);
  252 + memcpy(hdr, bp->b_addr, mp->m_dirblksize);
253 253 logflags = XFS_ILOG_CORE;
254 254 if ((error = xfs_dir2_shrink_inode(args, mp->m_dirdatablk, bp))) {
255 255 ASSERT(error != ENOSPC);
... ... @@ -1491,13 +1491,9 @@
1491 1491 if (!xfs_da_state_zone)
1492 1492 goto out_destroy_btree_cur_zone;
1493 1493  
1494   - xfs_dabuf_zone = kmem_zone_init(sizeof(xfs_dabuf_t), "xfs_dabuf");
1495   - if (!xfs_dabuf_zone)
1496   - goto out_destroy_da_state_zone;
1497   -
1498 1494 xfs_ifork_zone = kmem_zone_init(sizeof(xfs_ifork_t), "xfs_ifork");
1499 1495 if (!xfs_ifork_zone)
1500   - goto out_destroy_dabuf_zone;
  1496 + goto out_destroy_da_state_zone;
1501 1497  
1502 1498 xfs_trans_zone = kmem_zone_init(sizeof(xfs_trans_t), "xfs_trans");
1503 1499 if (!xfs_trans_zone)
... ... @@ -1560,8 +1556,6 @@
1560 1556 kmem_zone_destroy(xfs_trans_zone);
1561 1557 out_destroy_ifork_zone:
1562 1558 kmem_zone_destroy(xfs_ifork_zone);
1563   - out_destroy_dabuf_zone:
1564   - kmem_zone_destroy(xfs_dabuf_zone);
1565 1559 out_destroy_da_state_zone:
1566 1560 kmem_zone_destroy(xfs_da_state_zone);
1567 1561 out_destroy_btree_cur_zone:
... ... @@ -1589,7 +1583,6 @@
1589 1583 kmem_zone_destroy(xfs_log_item_desc_zone);
1590 1584 kmem_zone_destroy(xfs_trans_zone);
1591 1585 kmem_zone_destroy(xfs_ifork_zone);
1592   - kmem_zone_destroy(xfs_dabuf_zone);
1593 1586 kmem_zone_destroy(xfs_da_state_zone);
1594 1587 kmem_zone_destroy(xfs_btree_cur_zone);
1595 1588 kmem_zone_destroy(xfs_bmap_free_item_zone);