aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_dir2_leaf.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-06-22 04:50:14 -0400
committerBen Myers <bpm@sgi.com>2012-07-01 15:50:07 -0400
commit1d9025e56143c0c4aebebdb62e46618d3d284218 (patch)
treec31b34008dbd17ac1811c73cc515ea7f6247e2f0 /fs/xfs/xfs_dir2_leaf.c
parent3605431fb9739a30ccd0c6380ae8e3c6f8e670a5 (diff)
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>
Diffstat (limited to 'fs/xfs/xfs_dir2_leaf.c')
-rw-r--r--fs/xfs/xfs_dir2_leaf.c191
1 files changed, 91 insertions, 100 deletions
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index 397ffbcbab1d..69accf6cbc46 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -38,15 +38,15 @@
38 * Local function declarations. 38 * Local function declarations.
39 */ 39 */
40#ifdef DEBUG 40#ifdef DEBUG
41static void xfs_dir2_leaf_check(xfs_inode_t *dp, xfs_dabuf_t *bp); 41static void xfs_dir2_leaf_check(struct xfs_inode *dp, struct xfs_buf *bp);
42#else 42#else
43#define xfs_dir2_leaf_check(dp, bp) 43#define xfs_dir2_leaf_check(dp, bp)
44#endif 44#endif
45static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, xfs_dabuf_t **lbpp, 45static int xfs_dir2_leaf_lookup_int(xfs_da_args_t *args, struct xfs_buf **lbpp,
46 int *indexp, xfs_dabuf_t **dbpp); 46 int *indexp, struct xfs_buf **dbpp);
47static void xfs_dir2_leaf_log_bests(struct xfs_trans *tp, struct xfs_dabuf *bp, 47static void xfs_dir2_leaf_log_bests(struct xfs_trans *tp, struct xfs_buf *bp,
48 int first, int last); 48 int first, int last);
49static void xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_dabuf *bp); 49static void xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_buf *bp);
50 50
51 51
52/* 52/*
@@ -55,7 +55,7 @@ static void xfs_dir2_leaf_log_tail(struct xfs_trans *tp, struct xfs_dabuf *bp);
55int /* error */ 55int /* error */
56xfs_dir2_block_to_leaf( 56xfs_dir2_block_to_leaf(
57 xfs_da_args_t *args, /* operation arguments */ 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 __be16 *bestsp; /* leaf's bestsp entries */ 60 __be16 *bestsp; /* leaf's bestsp entries */
61 xfs_dablk_t blkno; /* leaf block's bno */ 61 xfs_dablk_t blkno; /* leaf block's bno */
@@ -64,7 +64,7 @@ xfs_dir2_block_to_leaf(
64 xfs_dir2_block_tail_t *btp; /* block's tail */ 64 xfs_dir2_block_tail_t *btp; /* block's tail */
65 xfs_inode_t *dp; /* incore directory inode */ 65 xfs_inode_t *dp; /* incore directory inode */
66 int error; /* error return code */ 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 xfs_dir2_db_t ldb; /* leaf block's bno */ 68 xfs_dir2_db_t ldb; /* leaf block's bno */
69 xfs_dir2_leaf_t *leaf; /* leaf structure */ 69 xfs_dir2_leaf_t *leaf; /* leaf structure */
70 xfs_dir2_leaf_tail_t *ltp; /* leaf's tail */ 70 xfs_dir2_leaf_tail_t *ltp; /* leaf's tail */
@@ -95,8 +95,8 @@ xfs_dir2_block_to_leaf(
95 return error; 95 return error;
96 } 96 }
97 ASSERT(lbp != NULL); 97 ASSERT(lbp != NULL);
98 leaf = lbp->data; 98 leaf = lbp->b_addr;
99 hdr = dbp->data; 99 hdr = dbp->b_addr;
100 xfs_dir2_data_check(dp, dbp); 100 xfs_dir2_data_check(dp, dbp);
101 btp = xfs_dir2_block_tail_p(mp, hdr); 101 btp = xfs_dir2_block_tail_p(mp, hdr);
102 blp = xfs_dir2_block_leaf_p(btp); 102 blp = xfs_dir2_block_leaf_p(btp);
@@ -143,7 +143,6 @@ xfs_dir2_block_to_leaf(
143 xfs_dir2_leaf_check(dp, lbp); 143 xfs_dir2_leaf_check(dp, lbp);
144 xfs_dir2_data_check(dp, dbp); 144 xfs_dir2_data_check(dp, dbp);
145 xfs_dir2_leaf_log_bests(tp, lbp, 0, 0); 145 xfs_dir2_leaf_log_bests(tp, lbp, 0, 0);
146 xfs_da_buf_done(lbp);
147 return 0; 146 return 0;
148} 147}
149 148
@@ -282,7 +281,7 @@ xfs_dir2_leaf_addname(
282 __be16 *bestsp; /* freespace table in leaf */ 281 __be16 *bestsp; /* freespace table in leaf */
283 int compact; /* need to compact leaves */ 282 int compact; /* need to compact leaves */
284 xfs_dir2_data_hdr_t *hdr; /* data block header */ 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 xfs_dir2_data_entry_t *dep; /* data block entry */ 285 xfs_dir2_data_entry_t *dep; /* data block entry */
287 xfs_inode_t *dp; /* incore directory inode */ 286 xfs_inode_t *dp; /* incore directory inode */
288 xfs_dir2_data_unused_t *dup; /* data unused entry */ 287 xfs_dir2_data_unused_t *dup; /* data unused entry */
@@ -291,7 +290,7 @@ xfs_dir2_leaf_addname(
291 int highstale; /* index of next stale leaf */ 290 int highstale; /* index of next stale leaf */
292 int i; /* temporary, index */ 291 int i; /* temporary, index */
293 int index; /* leaf table position */ 292 int index; /* leaf table position */
294 xfs_dabuf_t *lbp; /* leaf's buffer */ 293 struct xfs_buf *lbp; /* leaf's buffer */
295 xfs_dir2_leaf_t *leaf; /* leaf structure */ 294 xfs_dir2_leaf_t *leaf; /* leaf structure */
296 int length; /* length of new entry */ 295 int length; /* length of new entry */
297 xfs_dir2_leaf_entry_t *lep; /* leaf entry table pointer */ 296 xfs_dir2_leaf_entry_t *lep; /* leaf entry table pointer */
@@ -328,7 +327,7 @@ xfs_dir2_leaf_addname(
328 * But if there are dup hash values the index is of the first of those. 327 * But if there are dup hash values the index is of the first of those.
329 */ 328 */
330 index = xfs_dir2_leaf_search_hash(args, lbp); 329 index = xfs_dir2_leaf_search_hash(args, lbp);
331 leaf = lbp->data; 330 leaf = lbp->b_addr;
332 ltp = xfs_dir2_leaf_tail_p(mp, leaf); 331 ltp = xfs_dir2_leaf_tail_p(mp, leaf);
333 bestsp = xfs_dir2_leaf_bests_p(ltp); 332 bestsp = xfs_dir2_leaf_bests_p(ltp);
334 length = xfs_dir2_data_entsize(args->namelen); 333 length = xfs_dir2_data_entsize(args->namelen);
@@ -402,14 +401,13 @@ xfs_dir2_leaf_addname(
402 */ 401 */
403 if ((args->op_flags & XFS_DA_OP_JUSTCHECK) || 402 if ((args->op_flags & XFS_DA_OP_JUSTCHECK) ||
404 args->total == 0) { 403 args->total == 0) {
405 xfs_da_brelse(tp, lbp); 404 xfs_trans_brelse(tp, lbp);
406 return XFS_ERROR(ENOSPC); 405 return XFS_ERROR(ENOSPC);
407 } 406 }
408 /* 407 /*
409 * Convert to node form. 408 * Convert to node form.
410 */ 409 */
411 error = xfs_dir2_leaf_to_node(args, lbp); 410 error = xfs_dir2_leaf_to_node(args, lbp);
412 xfs_da_buf_done(lbp);
413 if (error) 411 if (error)
414 return error; 412 return error;
415 /* 413 /*
@@ -427,7 +425,7 @@ xfs_dir2_leaf_addname(
427 * a new data block. 425 * a new data block.
428 */ 426 */
429 if (args->op_flags & XFS_DA_OP_JUSTCHECK) { 427 if (args->op_flags & XFS_DA_OP_JUSTCHECK) {
430 xfs_da_brelse(tp, lbp); 428 xfs_trans_brelse(tp, lbp);
431 return use_block == -1 ? XFS_ERROR(ENOSPC) : 0; 429 return use_block == -1 ? XFS_ERROR(ENOSPC) : 0;
432 } 430 }
433 /* 431 /*
@@ -435,7 +433,7 @@ xfs_dir2_leaf_addname(
435 * changed anything. 433 * changed anything.
436 */ 434 */
437 if (args->total == 0 && use_block == -1) { 435 if (args->total == 0 && use_block == -1) {
438 xfs_da_brelse(tp, lbp); 436 xfs_trans_brelse(tp, lbp);
439 return XFS_ERROR(ENOSPC); 437 return XFS_ERROR(ENOSPC);
440 } 438 }
441 /* 439 /*
@@ -466,14 +464,14 @@ xfs_dir2_leaf_addname(
466 */ 464 */
467 if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_DATA_SPACE, 465 if ((error = xfs_dir2_grow_inode(args, XFS_DIR2_DATA_SPACE,
468 &use_block))) { 466 &use_block))) {
469 xfs_da_brelse(tp, lbp); 467 xfs_trans_brelse(tp, lbp);
470 return error; 468 return error;
471 } 469 }
472 /* 470 /*
473 * Initialize the block. 471 * Initialize the block.
474 */ 472 */
475 if ((error = xfs_dir2_data_init(args, use_block, &dbp))) { 473 if ((error = xfs_dir2_data_init(args, use_block, &dbp))) {
476 xfs_da_brelse(tp, lbp); 474 xfs_trans_brelse(tp, lbp);
477 return error; 475 return error;
478 } 476 }
479 /* 477 /*
@@ -493,7 +491,7 @@ xfs_dir2_leaf_addname(
493 */ 491 */
494 else 492 else
495 xfs_dir2_leaf_log_bests(tp, lbp, use_block, use_block); 493 xfs_dir2_leaf_log_bests(tp, lbp, use_block, use_block);
496 hdr = dbp->data; 494 hdr = dbp->b_addr;
497 bestsp[use_block] = hdr->bestfree[0].length; 495 bestsp[use_block] = hdr->bestfree[0].length;
498 grown = 1; 496 grown = 1;
499 } 497 }
@@ -505,10 +503,10 @@ xfs_dir2_leaf_addname(
505 if ((error = 503 if ((error =
506 xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, use_block), 504 xfs_da_read_buf(tp, dp, xfs_dir2_db_to_da(mp, use_block),
507 -1, &dbp, XFS_DATA_FORK))) { 505 -1, &dbp, XFS_DATA_FORK))) {
508 xfs_da_brelse(tp, lbp); 506 xfs_trans_brelse(tp, lbp);
509 return error; 507 return error;
510 } 508 }
511 hdr = dbp->data; 509 hdr = dbp->b_addr;
512 grown = 0; 510 grown = 0;
513 } 511 }
514 xfs_dir2_data_check(dp, dbp); 512 xfs_dir2_data_check(dp, dbp);
@@ -570,9 +568,7 @@ xfs_dir2_leaf_addname(
570 xfs_dir2_leaf_log_header(tp, lbp); 568 xfs_dir2_leaf_log_header(tp, lbp);
571 xfs_dir2_leaf_log_ents(tp, lbp, lfloglow, lfloghigh); 569 xfs_dir2_leaf_log_ents(tp, lbp, lfloglow, lfloghigh);
572 xfs_dir2_leaf_check(dp, lbp); 570 xfs_dir2_leaf_check(dp, lbp);
573 xfs_da_buf_done(lbp);
574 xfs_dir2_data_check(dp, dbp); 571 xfs_dir2_data_check(dp, dbp);
575 xfs_da_buf_done(dbp);
576 return 0; 572 return 0;
577} 573}
578 574
@@ -583,8 +579,8 @@ xfs_dir2_leaf_addname(
583 */ 579 */
584STATIC void 580STATIC void
585xfs_dir2_leaf_check( 581xfs_dir2_leaf_check(
586 xfs_inode_t *dp, /* incore directory inode */ 582 struct xfs_inode *dp, /* incore directory inode */
587 xfs_dabuf_t *bp) /* leaf's buffer */ 583 struct xfs_buf *bp) /* leaf's buffer */
588{ 584{
589 int i; /* leaf index */ 585 int i; /* leaf index */
590 xfs_dir2_leaf_t *leaf; /* leaf structure */ 586 xfs_dir2_leaf_t *leaf; /* leaf structure */
@@ -592,7 +588,7 @@ xfs_dir2_leaf_check(
592 xfs_mount_t *mp; /* filesystem mount point */ 588 xfs_mount_t *mp; /* filesystem mount point */
593 int stale; /* count of stale leaves */ 589 int stale; /* count of stale leaves */
594 590
595 leaf = bp->data; 591 leaf = bp->b_addr;
596 mp = dp->i_mount; 592 mp = dp->i_mount;
597 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC)); 593 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC));
598 /* 594 /*
@@ -628,14 +624,14 @@ xfs_dir2_leaf_check(
628void 624void
629xfs_dir2_leaf_compact( 625xfs_dir2_leaf_compact(
630 xfs_da_args_t *args, /* operation arguments */ 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 int from; /* source leaf index */ 629 int from; /* source leaf index */
634 xfs_dir2_leaf_t *leaf; /* leaf structure */ 630 xfs_dir2_leaf_t *leaf; /* leaf structure */
635 int loglow; /* first leaf entry to log */ 631 int loglow; /* first leaf entry to log */
636 int to; /* target leaf index */ 632 int to; /* target leaf index */
637 633
638 leaf = bp->data; 634 leaf = bp->b_addr;
639 if (!leaf->hdr.stale) { 635 if (!leaf->hdr.stale) {
640 return; 636 return;
641 } 637 }
@@ -677,7 +673,7 @@ xfs_dir2_leaf_compact(
677 */ 673 */
678void 674void
679xfs_dir2_leaf_compact_x1( 675xfs_dir2_leaf_compact_x1(
680 xfs_dabuf_t *bp, /* leaf buffer */ 676 struct xfs_buf *bp, /* leaf buffer */
681 int *indexp, /* insertion index */ 677 int *indexp, /* insertion index */
682 int *lowstalep, /* out: stale entry before us */ 678 int *lowstalep, /* out: stale entry before us */
683 int *highstalep, /* out: stale entry after us */ 679 int *highstalep, /* out: stale entry after us */
@@ -693,7 +689,7 @@ xfs_dir2_leaf_compact_x1(
693 int newindex=0; /* new insertion index */ 689 int newindex=0; /* new insertion index */
694 int to; /* destination copy index */ 690 int to; /* destination copy index */
695 691
696 leaf = bp->data; 692 leaf = bp->b_addr;
697 ASSERT(be16_to_cpu(leaf->hdr.stale) > 1); 693 ASSERT(be16_to_cpu(leaf->hdr.stale) > 1);
698 index = *indexp; 694 index = *indexp;
699 695
@@ -775,7 +771,7 @@ xfs_dir2_leaf_getdents(
775 xfs_off_t *offset, 771 xfs_off_t *offset,
776 filldir_t filldir) 772 filldir_t filldir)
777{ 773{
778 xfs_dabuf_t *bp; /* data block buffer */ 774 struct xfs_buf *bp; /* data block buffer */
779 int byteoff; /* offset in current block */ 775 int byteoff; /* offset in current block */
780 xfs_dir2_db_t curdb; /* db for current block */ 776 xfs_dir2_db_t curdb; /* db for current block */
781 xfs_dir2_off_t curoff; /* current overall offset */ 777 xfs_dir2_off_t curoff; /* current overall offset */
@@ -839,13 +835,13 @@ xfs_dir2_leaf_getdents(
839 * If we have no buffer, or we're off the end of the 835 * If we have no buffer, or we're off the end of the
840 * current buffer, need to get another one. 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 * If we have a buffer, we need to release it and 840 * If we have a buffer, we need to release it and
845 * take it out of the mapping. 841 * take it out of the mapping.
846 */ 842 */
847 if (bp) { 843 if (bp) {
848 xfs_da_brelse(NULL, bp); 844 xfs_trans_brelse(NULL, bp);
849 bp = NULL; 845 bp = NULL;
850 map_blocks -= mp->m_dirblkfsbs; 846 map_blocks -= mp->m_dirblkfsbs;
851 /* 847 /*
@@ -1035,7 +1031,7 @@ xfs_dir2_leaf_getdents(
1035 else if (curoff > newoff) 1031 else if (curoff > newoff)
1036 ASSERT(xfs_dir2_byte_to_db(mp, curoff) == 1032 ASSERT(xfs_dir2_byte_to_db(mp, curoff) ==
1037 curdb); 1033 curdb);
1038 hdr = bp->data; 1034 hdr = bp->b_addr;
1039 xfs_dir2_data_check(dp, bp); 1035 xfs_dir2_data_check(dp, bp);
1040 /* 1036 /*
1041 * Find our position in the block. 1037 * Find our position in the block.
@@ -1119,7 +1115,7 @@ xfs_dir2_leaf_getdents(
1119 *offset = xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff; 1115 *offset = xfs_dir2_byte_to_dataptr(mp, curoff) & 0x7fffffff;
1120 kmem_free(map); 1116 kmem_free(map);
1121 if (bp) 1117 if (bp)
1122 xfs_da_brelse(NULL, bp); 1118 xfs_trans_brelse(NULL, bp);
1123 return error; 1119 return error;
1124} 1120}
1125 1121
@@ -1130,10 +1126,10 @@ int
1130xfs_dir2_leaf_init( 1126xfs_dir2_leaf_init(
1131 xfs_da_args_t *args, /* operation arguments */ 1127 xfs_da_args_t *args, /* operation arguments */
1132 xfs_dir2_db_t bno, /* directory block number */ 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 int magic) /* magic number for block */ 1130 int magic) /* magic number for block */
1135{ 1131{
1136 xfs_dabuf_t *bp; /* leaf buffer */ 1132 struct xfs_buf *bp; /* leaf buffer */
1137 xfs_inode_t *dp; /* incore directory inode */ 1133 xfs_inode_t *dp; /* incore directory inode */
1138 int error; /* error return code */ 1134 int error; /* error return code */
1139 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1135 xfs_dir2_leaf_t *leaf; /* leaf structure */
@@ -1156,7 +1152,7 @@ xfs_dir2_leaf_init(
1156 return error; 1152 return error;
1157 } 1153 }
1158 ASSERT(bp != NULL); 1154 ASSERT(bp != NULL);
1159 leaf = bp->data; 1155 leaf = bp->b_addr;
1160 /* 1156 /*
1161 * Initialize the header. 1157 * Initialize the header.
1162 */ 1158 */
@@ -1186,7 +1182,7 @@ xfs_dir2_leaf_init(
1186static void 1182static void
1187xfs_dir2_leaf_log_bests( 1183xfs_dir2_leaf_log_bests(
1188 xfs_trans_t *tp, /* transaction pointer */ 1184 xfs_trans_t *tp, /* transaction pointer */
1189 xfs_dabuf_t *bp, /* leaf buffer */ 1185 struct xfs_buf *bp, /* leaf buffer */
1190 int first, /* first entry to log */ 1186 int first, /* first entry to log */
1191 int last) /* last entry to log */ 1187 int last) /* last entry to log */
1192{ 1188{
@@ -1195,12 +1191,12 @@ xfs_dir2_leaf_log_bests(
1195 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1191 xfs_dir2_leaf_t *leaf; /* leaf structure */
1196 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ 1192 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
1197 1193
1198 leaf = bp->data; 1194 leaf = bp->b_addr;
1199 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC)); 1195 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC));
1200 ltp = xfs_dir2_leaf_tail_p(tp->t_mountp, leaf); 1196 ltp = xfs_dir2_leaf_tail_p(tp->t_mountp, leaf);
1201 firstb = xfs_dir2_leaf_bests_p(ltp) + first; 1197 firstb = xfs_dir2_leaf_bests_p(ltp) + first;
1202 lastb = xfs_dir2_leaf_bests_p(ltp) + last; 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 (uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1)); 1200 (uint)((char *)lastb - (char *)leaf + sizeof(*lastb) - 1));
1205} 1201}
1206 1202
@@ -1210,7 +1206,7 @@ xfs_dir2_leaf_log_bests(
1210void 1206void
1211xfs_dir2_leaf_log_ents( 1207xfs_dir2_leaf_log_ents(
1212 xfs_trans_t *tp, /* transaction pointer */ 1208 xfs_trans_t *tp, /* transaction pointer */
1213 xfs_dabuf_t *bp, /* leaf buffer */ 1209 struct xfs_buf *bp, /* leaf buffer */
1214 int first, /* first entry to log */ 1210 int first, /* first entry to log */
1215 int last) /* last entry to log */ 1211 int last) /* last entry to log */
1216{ 1212{
@@ -1218,12 +1214,12 @@ xfs_dir2_leaf_log_ents(
1218 xfs_dir2_leaf_entry_t *lastlep; /* pointer to last entry */ 1214 xfs_dir2_leaf_entry_t *lastlep; /* pointer to last entry */
1219 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1215 xfs_dir2_leaf_t *leaf; /* leaf structure */
1220 1216
1221 leaf = bp->data; 1217 leaf = bp->b_addr;
1222 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || 1218 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) ||
1223 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); 1219 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
1224 firstlep = &leaf->ents[first]; 1220 firstlep = &leaf->ents[first];
1225 lastlep = &leaf->ents[last]; 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 (uint)((char *)lastlep - (char *)leaf + sizeof(*lastlep) - 1)); 1223 (uint)((char *)lastlep - (char *)leaf + sizeof(*lastlep) - 1));
1228} 1224}
1229 1225
@@ -1232,15 +1228,15 @@ xfs_dir2_leaf_log_ents(
1232 */ 1228 */
1233void 1229void
1234xfs_dir2_leaf_log_header( 1230xfs_dir2_leaf_log_header(
1235 xfs_trans_t *tp, /* transaction pointer */ 1231 struct xfs_trans *tp,
1236 xfs_dabuf_t *bp) /* leaf buffer */ 1232 struct xfs_buf *bp)
1237{ 1233{
1238 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1234 xfs_dir2_leaf_t *leaf; /* leaf structure */
1239 1235
1240 leaf = bp->data; 1236 leaf = bp->b_addr;
1241 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) || 1237 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC) ||
1242 leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); 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 (uint)(sizeof(leaf->hdr) - 1)); 1240 (uint)(sizeof(leaf->hdr) - 1));
1245} 1241}
1246 1242
@@ -1249,18 +1245,18 @@ xfs_dir2_leaf_log_header(
1249 */ 1245 */
1250STATIC void 1246STATIC void
1251xfs_dir2_leaf_log_tail( 1247xfs_dir2_leaf_log_tail(
1252 xfs_trans_t *tp, /* transaction pointer */ 1248 struct xfs_trans *tp,
1253 xfs_dabuf_t *bp) /* leaf buffer */ 1249 struct xfs_buf *bp)
1254{ 1250{
1255 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1251 xfs_dir2_leaf_t *leaf; /* leaf structure */
1256 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ 1252 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
1257 xfs_mount_t *mp; /* filesystem mount point */ 1253 xfs_mount_t *mp; /* filesystem mount point */
1258 1254
1259 mp = tp->t_mountp; 1255 mp = tp->t_mountp;
1260 leaf = bp->data; 1256 leaf = bp->b_addr;
1261 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC)); 1257 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAF1_MAGIC));
1262 ltp = xfs_dir2_leaf_tail_p(mp, leaf); 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 (uint)(mp->m_dirblksize - 1)); 1260 (uint)(mp->m_dirblksize - 1));
1265} 1261}
1266 1262
@@ -1273,12 +1269,12 @@ int
1273xfs_dir2_leaf_lookup( 1269xfs_dir2_leaf_lookup(
1274 xfs_da_args_t *args) /* operation arguments */ 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 xfs_dir2_data_entry_t *dep; /* data block entry */ 1273 xfs_dir2_data_entry_t *dep; /* data block entry */
1278 xfs_inode_t *dp; /* incore directory inode */ 1274 xfs_inode_t *dp; /* incore directory inode */
1279 int error; /* error return code */ 1275 int error; /* error return code */
1280 int index; /* found entry index */ 1276 int index; /* found entry index */
1281 xfs_dabuf_t *lbp; /* leaf buffer */ 1277 struct xfs_buf *lbp; /* leaf buffer */
1282 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1278 xfs_dir2_leaf_t *leaf; /* leaf structure */
1283 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ 1279 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1284 xfs_trans_t *tp; /* transaction pointer */ 1280 xfs_trans_t *tp; /* transaction pointer */
@@ -1294,7 +1290,7 @@ xfs_dir2_leaf_lookup(
1294 tp = args->trans; 1290 tp = args->trans;
1295 dp = args->dp; 1291 dp = args->dp;
1296 xfs_dir2_leaf_check(dp, lbp); 1292 xfs_dir2_leaf_check(dp, lbp);
1297 leaf = lbp->data; 1293 leaf = lbp->b_addr;
1298 /* 1294 /*
1299 * Get to the leaf entry and contained data entry address. 1295 * Get to the leaf entry and contained data entry address.
1300 */ 1296 */
@@ -1303,15 +1299,15 @@ xfs_dir2_leaf_lookup(
1303 * Point to the data entry. 1299 * Point to the data entry.
1304 */ 1300 */
1305 dep = (xfs_dir2_data_entry_t *) 1301 dep = (xfs_dir2_data_entry_t *)
1306 ((char *)dbp->data + 1302 ((char *)dbp->b_addr +
1307 xfs_dir2_dataptr_to_off(dp->i_mount, be32_to_cpu(lep->address))); 1303 xfs_dir2_dataptr_to_off(dp->i_mount, be32_to_cpu(lep->address)));
1308 /* 1304 /*
1309 * Return the found inode number & CI name if appropriate 1305 * Return the found inode number & CI name if appropriate
1310 */ 1306 */
1311 args->inumber = be64_to_cpu(dep->inumber); 1307 args->inumber = be64_to_cpu(dep->inumber);
1312 error = xfs_dir_cilookup_result(args, dep->name, dep->namelen); 1308 error = xfs_dir_cilookup_result(args, dep->name, dep->namelen);
1313 xfs_da_brelse(tp, dbp); 1309 xfs_trans_brelse(tp, dbp);
1314 xfs_da_brelse(tp, lbp); 1310 xfs_trans_brelse(tp, lbp);
1315 return XFS_ERROR(error); 1311 return XFS_ERROR(error);
1316} 1312}
1317 1313
@@ -1324,17 +1320,17 @@ xfs_dir2_leaf_lookup(
1324static int /* error */ 1320static int /* error */
1325xfs_dir2_leaf_lookup_int( 1321xfs_dir2_leaf_lookup_int(
1326 xfs_da_args_t *args, /* operation arguments */ 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 int *indexp, /* out: index in leaf block */ 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 xfs_dir2_db_t curdb = -1; /* current data block number */ 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 xfs_dir2_data_entry_t *dep; /* data entry */ 1329 xfs_dir2_data_entry_t *dep; /* data entry */
1334 xfs_inode_t *dp; /* incore directory inode */ 1330 xfs_inode_t *dp; /* incore directory inode */
1335 int error; /* error return code */ 1331 int error; /* error return code */
1336 int index; /* index in leaf block */ 1332 int index; /* index in leaf block */
1337 xfs_dabuf_t *lbp; /* leaf buffer */ 1333 struct xfs_buf *lbp; /* leaf buffer */
1338 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ 1334 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1339 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1335 xfs_dir2_leaf_t *leaf; /* leaf structure */
1340 xfs_mount_t *mp; /* filesystem mount point */ 1336 xfs_mount_t *mp; /* filesystem mount point */
@@ -1354,7 +1350,7 @@ xfs_dir2_leaf_lookup_int(
1354 if (error) 1350 if (error)
1355 return error; 1351 return error;
1356 *lbpp = lbp; 1352 *lbpp = lbp;
1357 leaf = lbp->data; 1353 leaf = lbp->b_addr;
1358 xfs_dir2_leaf_check(dp, lbp); 1354 xfs_dir2_leaf_check(dp, lbp);
1359 /* 1355 /*
1360 * Look for the first leaf entry with our hash value. 1356 * Look for the first leaf entry with our hash value.
@@ -1382,12 +1378,12 @@ xfs_dir2_leaf_lookup_int(
1382 */ 1378 */
1383 if (newdb != curdb) { 1379 if (newdb != curdb) {
1384 if (dbp) 1380 if (dbp)
1385 xfs_da_brelse(tp, dbp); 1381 xfs_trans_brelse(tp, dbp);
1386 error = xfs_da_read_buf(tp, dp, 1382 error = xfs_da_read_buf(tp, dp,
1387 xfs_dir2_db_to_da(mp, newdb), 1383 xfs_dir2_db_to_da(mp, newdb),
1388 -1, &dbp, XFS_DATA_FORK); 1384 -1, &dbp, XFS_DATA_FORK);
1389 if (error) { 1385 if (error) {
1390 xfs_da_brelse(tp, lbp); 1386 xfs_trans_brelse(tp, lbp);
1391 return error; 1387 return error;
1392 } 1388 }
1393 xfs_dir2_data_check(dp, dbp); 1389 xfs_dir2_data_check(dp, dbp);
@@ -1396,7 +1392,7 @@ xfs_dir2_leaf_lookup_int(
1396 /* 1392 /*
1397 * Point to the data entry. 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 xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address))); 1396 xfs_dir2_dataptr_to_off(mp, be32_to_cpu(lep->address)));
1401 /* 1397 /*
1402 * Compare name and if it's an exact match, return the index 1398 * Compare name and if it's an exact match, return the index
@@ -1424,12 +1420,12 @@ xfs_dir2_leaf_lookup_int(
1424 if (args->cmpresult == XFS_CMP_CASE) { 1420 if (args->cmpresult == XFS_CMP_CASE) {
1425 ASSERT(cidb != -1); 1421 ASSERT(cidb != -1);
1426 if (cidb != curdb) { 1422 if (cidb != curdb) {
1427 xfs_da_brelse(tp, dbp); 1423 xfs_trans_brelse(tp, dbp);
1428 error = xfs_da_read_buf(tp, dp, 1424 error = xfs_da_read_buf(tp, dp,
1429 xfs_dir2_db_to_da(mp, cidb), 1425 xfs_dir2_db_to_da(mp, cidb),
1430 -1, &dbp, XFS_DATA_FORK); 1426 -1, &dbp, XFS_DATA_FORK);
1431 if (error) { 1427 if (error) {
1432 xfs_da_brelse(tp, lbp); 1428 xfs_trans_brelse(tp, lbp);
1433 return error; 1429 return error;
1434 } 1430 }
1435 } 1431 }
@@ -1441,8 +1437,8 @@ xfs_dir2_leaf_lookup_int(
1441 */ 1437 */
1442 ASSERT(cidb == -1); 1438 ASSERT(cidb == -1);
1443 if (dbp) 1439 if (dbp)
1444 xfs_da_brelse(tp, dbp); 1440 xfs_trans_brelse(tp, dbp);
1445 xfs_da_brelse(tp, lbp); 1441 xfs_trans_brelse(tp, lbp);
1446 return XFS_ERROR(ENOENT); 1442 return XFS_ERROR(ENOENT);
1447} 1443}
1448 1444
@@ -1456,13 +1452,13 @@ xfs_dir2_leaf_removename(
1456 __be16 *bestsp; /* leaf block best freespace */ 1452 __be16 *bestsp; /* leaf block best freespace */
1457 xfs_dir2_data_hdr_t *hdr; /* data block header */ 1453 xfs_dir2_data_hdr_t *hdr; /* data block header */
1458 xfs_dir2_db_t db; /* data block number */ 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 xfs_dir2_data_entry_t *dep; /* data entry structure */ 1456 xfs_dir2_data_entry_t *dep; /* data entry structure */
1461 xfs_inode_t *dp; /* incore directory inode */ 1457 xfs_inode_t *dp; /* incore directory inode */
1462 int error; /* error return code */ 1458 int error; /* error return code */
1463 xfs_dir2_db_t i; /* temporary data block # */ 1459 xfs_dir2_db_t i; /* temporary data block # */
1464 int index; /* index into leaf entries */ 1460 int index; /* index into leaf entries */
1465 xfs_dabuf_t *lbp; /* leaf buffer */ 1461 struct xfs_buf *lbp; /* leaf buffer */
1466 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1462 xfs_dir2_leaf_t *leaf; /* leaf structure */
1467 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ 1463 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1468 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */ 1464 xfs_dir2_leaf_tail_t *ltp; /* leaf tail structure */
@@ -1483,8 +1479,8 @@ xfs_dir2_leaf_removename(
1483 dp = args->dp; 1479 dp = args->dp;
1484 tp = args->trans; 1480 tp = args->trans;
1485 mp = dp->i_mount; 1481 mp = dp->i_mount;
1486 leaf = lbp->data; 1482 leaf = lbp->b_addr;
1487 hdr = dbp->data; 1483 hdr = dbp->b_addr;
1488 xfs_dir2_data_check(dp, dbp); 1484 xfs_dir2_data_check(dp, dbp);
1489 /* 1485 /*
1490 * Point to the leaf entry, use that to point to the data entry. 1486 * Point to the leaf entry, use that to point to the data entry.
@@ -1541,12 +1537,9 @@ xfs_dir2_leaf_removename(
1541 * Just go on, returning success, leaving the 1537 * Just go on, returning success, leaving the
1542 * empty block in place. 1538 * empty block in place.
1543 */ 1539 */
1544 if (error == ENOSPC && args->total == 0) { 1540 if (error == ENOSPC && args->total == 0)
1545 xfs_da_buf_done(dbp);
1546 error = 0; 1541 error = 0;
1547 }
1548 xfs_dir2_leaf_check(dp, lbp); 1542 xfs_dir2_leaf_check(dp, lbp);
1549 xfs_da_buf_done(lbp);
1550 return error; 1543 return error;
1551 } 1544 }
1552 dbp = NULL; 1545 dbp = NULL;
@@ -1577,10 +1570,9 @@ xfs_dir2_leaf_removename(
1577 /* 1570 /*
1578 * If the data block was not the first one, drop it. 1571 * If the data block was not the first one, drop it.
1579 */ 1572 */
1580 else if (db != mp->m_dirdatablk && dbp != NULL) { 1573 else if (db != mp->m_dirdatablk)
1581 xfs_da_buf_done(dbp);
1582 dbp = NULL; 1574 dbp = NULL;
1583 } 1575
1584 xfs_dir2_leaf_check(dp, lbp); 1576 xfs_dir2_leaf_check(dp, lbp);
1585 /* 1577 /*
1586 * See if we can convert to block form. 1578 * See if we can convert to block form.
@@ -1595,12 +1587,12 @@ int /* error */
1595xfs_dir2_leaf_replace( 1587xfs_dir2_leaf_replace(
1596 xfs_da_args_t *args) /* operation arguments */ 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 xfs_dir2_data_entry_t *dep; /* data block entry */ 1591 xfs_dir2_data_entry_t *dep; /* data block entry */
1600 xfs_inode_t *dp; /* incore directory inode */ 1592 xfs_inode_t *dp; /* incore directory inode */
1601 int error; /* error return code */ 1593 int error; /* error return code */
1602 int index; /* index of leaf entry */ 1594 int index; /* index of leaf entry */
1603 xfs_dabuf_t *lbp; /* leaf buffer */ 1595 struct xfs_buf *lbp; /* leaf buffer */
1604 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1596 xfs_dir2_leaf_t *leaf; /* leaf structure */
1605 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ 1597 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1606 xfs_trans_t *tp; /* transaction pointer */ 1598 xfs_trans_t *tp; /* transaction pointer */
@@ -1614,7 +1606,7 @@ xfs_dir2_leaf_replace(
1614 return error; 1606 return error;
1615 } 1607 }
1616 dp = args->dp; 1608 dp = args->dp;
1617 leaf = lbp->data; 1609 leaf = lbp->b_addr;
1618 /* 1610 /*
1619 * Point to the leaf entry, get data address from it. 1611 * Point to the leaf entry, get data address from it.
1620 */ 1612 */
@@ -1623,7 +1615,7 @@ xfs_dir2_leaf_replace(
1623 * Point to the data entry. 1615 * Point to the data entry.
1624 */ 1616 */
1625 dep = (xfs_dir2_data_entry_t *) 1617 dep = (xfs_dir2_data_entry_t *)
1626 ((char *)dbp->data + 1618 ((char *)dbp->b_addr +
1627 xfs_dir2_dataptr_to_off(dp->i_mount, be32_to_cpu(lep->address))); 1619 xfs_dir2_dataptr_to_off(dp->i_mount, be32_to_cpu(lep->address)));
1628 ASSERT(args->inumber != be64_to_cpu(dep->inumber)); 1620 ASSERT(args->inumber != be64_to_cpu(dep->inumber));
1629 /* 1621 /*
@@ -1632,9 +1624,8 @@ xfs_dir2_leaf_replace(
1632 dep->inumber = cpu_to_be64(args->inumber); 1624 dep->inumber = cpu_to_be64(args->inumber);
1633 tp = args->trans; 1625 tp = args->trans;
1634 xfs_dir2_data_log_entry(tp, dbp, dep); 1626 xfs_dir2_data_log_entry(tp, dbp, dep);
1635 xfs_da_buf_done(dbp);
1636 xfs_dir2_leaf_check(dp, lbp); 1627 xfs_dir2_leaf_check(dp, lbp);
1637 xfs_da_brelse(tp, lbp); 1628 xfs_trans_brelse(tp, lbp);
1638 return 0; 1629 return 0;
1639} 1630}
1640 1631
@@ -1646,7 +1637,7 @@ xfs_dir2_leaf_replace(
1646int /* index value */ 1637int /* index value */
1647xfs_dir2_leaf_search_hash( 1638xfs_dir2_leaf_search_hash(
1648 xfs_da_args_t *args, /* operation arguments */ 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 xfs_dahash_t hash=0; /* hash from this entry */ 1642 xfs_dahash_t hash=0; /* hash from this entry */
1652 xfs_dahash_t hashwant; /* hash value looking for */ 1643 xfs_dahash_t hashwant; /* hash value looking for */
@@ -1656,7 +1647,7 @@ xfs_dir2_leaf_search_hash(
1656 xfs_dir2_leaf_entry_t *lep; /* leaf entry */ 1647 xfs_dir2_leaf_entry_t *lep; /* leaf entry */
1657 int mid=0; /* current leaf index */ 1648 int mid=0; /* current leaf index */
1658 1649
1659 leaf = lbp->data; 1650 leaf = lbp->b_addr;
1660#ifndef __KERNEL__ 1651#ifndef __KERNEL__
1661 if (!leaf->hdr.count) 1652 if (!leaf->hdr.count)
1662 return 0; 1653 return 0;
@@ -1699,11 +1690,11 @@ xfs_dir2_leaf_search_hash(
1699int /* error */ 1690int /* error */
1700xfs_dir2_leaf_trim_data( 1691xfs_dir2_leaf_trim_data(
1701 xfs_da_args_t *args, /* operation arguments */ 1692 xfs_da_args_t *args, /* operation arguments */
1702 xfs_dabuf_t *lbp, /* leaf buffer */ 1693 struct xfs_buf *lbp, /* leaf buffer */
1703 xfs_dir2_db_t db) /* data block number */ 1694 xfs_dir2_db_t db) /* data block number */
1704{ 1695{
1705 __be16 *bestsp; /* leaf bests table */ 1696 __be16 *bestsp; /* leaf bests table */
1706 xfs_dabuf_t *dbp; /* data block buffer */ 1697 struct xfs_buf *dbp; /* data block buffer */
1707 xfs_inode_t *dp; /* incore directory inode */ 1698 xfs_inode_t *dp; /* incore directory inode */
1708 int error; /* error return value */ 1699 int error; /* error return value */
1709 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1700 xfs_dir2_leaf_t *leaf; /* leaf structure */
@@ -1722,12 +1713,12 @@ xfs_dir2_leaf_trim_data(
1722 return error; 1713 return error;
1723 } 1714 }
1724 1715
1725 leaf = lbp->data; 1716 leaf = lbp->b_addr;
1726 ltp = xfs_dir2_leaf_tail_p(mp, leaf); 1717 ltp = xfs_dir2_leaf_tail_p(mp, leaf);
1727 1718
1728#ifdef DEBUG 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 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC)); 1723 ASSERT(hdr->magic == cpu_to_be32(XFS_DIR2_DATA_MAGIC));
1733 ASSERT(be16_to_cpu(hdr->bestfree[0].length) == 1724 ASSERT(be16_to_cpu(hdr->bestfree[0].length) ==
@@ -1741,7 +1732,7 @@ xfs_dir2_leaf_trim_data(
1741 */ 1732 */
1742 if ((error = xfs_dir2_shrink_inode(args, db, dbp))) { 1733 if ((error = xfs_dir2_shrink_inode(args, db, dbp))) {
1743 ASSERT(error != ENOSPC); 1734 ASSERT(error != ENOSPC);
1744 xfs_da_brelse(tp, dbp); 1735 xfs_trans_brelse(tp, dbp);
1745 return error; 1736 return error;
1746 } 1737 }
1747 /* 1738 /*
@@ -1781,10 +1772,10 @@ xfs_dir2_node_to_leaf(
1781 xfs_da_args_t *args; /* operation arguments */ 1772 xfs_da_args_t *args; /* operation arguments */
1782 xfs_inode_t *dp; /* incore directory inode */ 1773 xfs_inode_t *dp; /* incore directory inode */
1783 int error; /* error return code */ 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 xfs_fileoff_t fo; /* freespace file offset */ 1776 xfs_fileoff_t fo; /* freespace file offset */
1786 xfs_dir2_free_t *free; /* freespace structure */ 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 xfs_dir2_leaf_tail_t *ltp; /* tail of leaf structure */ 1779 xfs_dir2_leaf_tail_t *ltp; /* tail of leaf structure */
1789 xfs_dir2_leaf_t *leaf; /* leaf structure */ 1780 xfs_dir2_leaf_t *leaf; /* leaf structure */
1790 xfs_mount_t *mp; /* filesystem mount point */ 1781 xfs_mount_t *mp; /* filesystem mount point */
@@ -1838,7 +1829,7 @@ xfs_dir2_node_to_leaf(
1838 if (XFS_FSB_TO_B(mp, fo) > XFS_DIR2_LEAF_OFFSET + mp->m_dirblksize) 1829 if (XFS_FSB_TO_B(mp, fo) > XFS_DIR2_LEAF_OFFSET + mp->m_dirblksize)
1839 return 0; 1830 return 0;
1840 lbp = state->path.blk[0].bp; 1831 lbp = state->path.blk[0].bp;
1841 leaf = lbp->data; 1832 leaf = lbp->b_addr;
1842 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC)); 1833 ASSERT(leaf->hdr.info.magic == cpu_to_be16(XFS_DIR2_LEAFN_MAGIC));
1843 /* 1834 /*
1844 * Read the freespace block. 1835 * Read the freespace block.
@@ -1847,7 +1838,7 @@ xfs_dir2_node_to_leaf(
1847 XFS_DATA_FORK))) { 1838 XFS_DATA_FORK))) {
1848 return error; 1839 return error;
1849 } 1840 }
1850 free = fbp->data; 1841 free = fbp->b_addr;
1851 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC)); 1842 ASSERT(free->hdr.magic == cpu_to_be32(XFS_DIR2_FREE_MAGIC));
1852 ASSERT(!free->hdr.firstdb); 1843 ASSERT(!free->hdr.firstdb);
1853 1844
@@ -1857,7 +1848,7 @@ xfs_dir2_node_to_leaf(
1857 */ 1848 */
1858 if (xfs_dir2_leaf_size(&leaf->hdr, be32_to_cpu(free->hdr.nvalid)) > 1849 if (xfs_dir2_leaf_size(&leaf->hdr, be32_to_cpu(free->hdr.nvalid)) >
1859 mp->m_dirblksize) { 1850 mp->m_dirblksize) {
1860 xfs_da_brelse(tp, fbp); 1851 xfs_trans_brelse(tp, fbp);
1861 return 0; 1852 return 0;
1862 } 1853 }
1863 1854