diff options
Diffstat (limited to 'fs/xfs/xfs_trans_buf.c')
-rw-r--r-- | fs/xfs/xfs_trans_buf.c | 64 |
1 files changed, 15 insertions, 49 deletions
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c index d1d08aa404b..74a1c33e409 100644 --- a/fs/xfs/xfs_trans_buf.c +++ b/fs/xfs/xfs_trans_buf.c | |||
@@ -47,36 +47,17 @@ xfs_trans_buf_item_match( | |||
47 | xfs_daddr_t blkno, | 47 | xfs_daddr_t blkno, |
48 | int len) | 48 | int len) |
49 | { | 49 | { |
50 | xfs_log_item_chunk_t *licp; | 50 | struct xfs_log_item_desc *lidp; |
51 | xfs_log_item_desc_t *lidp; | 51 | struct xfs_buf_log_item *blip; |
52 | xfs_buf_log_item_t *blip; | ||
53 | int i; | ||
54 | 52 | ||
55 | len = BBTOB(len); | 53 | len = BBTOB(len); |
56 | for (licp = &tp->t_items; licp != NULL; licp = licp->lic_next) { | 54 | list_for_each_entry(lidp, &tp->t_items, lid_trans) { |
57 | if (xfs_lic_are_all_free(licp)) { | 55 | blip = (struct xfs_buf_log_item *)lidp->lid_item; |
58 | ASSERT(licp == &tp->t_items); | 56 | if (blip->bli_item.li_type == XFS_LI_BUF && |
59 | ASSERT(licp->lic_next == NULL); | 57 | XFS_BUF_TARGET(blip->bli_buf) == target && |
60 | return NULL; | 58 | XFS_BUF_ADDR(blip->bli_buf) == blkno && |
61 | } | 59 | XFS_BUF_COUNT(blip->bli_buf) == len) |
62 | 60 | return blip->bli_buf; | |
63 | for (i = 0; i < licp->lic_unused; i++) { | ||
64 | /* | ||
65 | * Skip unoccupied slots. | ||
66 | */ | ||
67 | if (xfs_lic_isfree(licp, i)) | ||
68 | continue; | ||
69 | |||
70 | lidp = xfs_lic_slot(licp, i); | ||
71 | blip = (xfs_buf_log_item_t *)lidp->lid_item; | ||
72 | if (blip->bli_item.li_type != XFS_LI_BUF) | ||
73 | continue; | ||
74 | |||
75 | if (XFS_BUF_TARGET(blip->bli_buf) == target && | ||
76 | XFS_BUF_ADDR(blip->bli_buf) == blkno && | ||
77 | XFS_BUF_COUNT(blip->bli_buf) == len) | ||
78 | return blip->bli_buf; | ||
79 | } | ||
80 | } | 61 | } |
81 | 62 | ||
82 | return NULL; | 63 | return NULL; |
@@ -123,7 +104,7 @@ _xfs_trans_bjoin( | |||
123 | /* | 104 | /* |
124 | * Get a log_item_desc to point at the new item. | 105 | * Get a log_item_desc to point at the new item. |
125 | */ | 106 | */ |
126 | (void) xfs_trans_add_item(tp, (xfs_log_item_t *)bip); | 107 | xfs_trans_add_item(tp, &bip->bli_item); |
127 | 108 | ||
128 | /* | 109 | /* |
129 | * Initialize b_fsprivate2 so we can find it with incore_match() | 110 | * Initialize b_fsprivate2 so we can find it with incore_match() |
@@ -479,7 +460,6 @@ xfs_trans_brelse(xfs_trans_t *tp, | |||
479 | { | 460 | { |
480 | xfs_buf_log_item_t *bip; | 461 | xfs_buf_log_item_t *bip; |
481 | xfs_log_item_t *lip; | 462 | xfs_log_item_t *lip; |
482 | xfs_log_item_desc_t *lidp; | ||
483 | 463 | ||
484 | /* | 464 | /* |
485 | * Default to a normal brelse() call if the tp is NULL. | 465 | * Default to a normal brelse() call if the tp is NULL. |
@@ -510,13 +490,6 @@ xfs_trans_brelse(xfs_trans_t *tp, | |||
510 | ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); | 490 | ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_CANCEL)); |
511 | ASSERT(atomic_read(&bip->bli_refcount) > 0); | 491 | ASSERT(atomic_read(&bip->bli_refcount) > 0); |
512 | 492 | ||
513 | /* | ||
514 | * Find the item descriptor pointing to this buffer's | ||
515 | * log item. It must be there. | ||
516 | */ | ||
517 | lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)bip); | ||
518 | ASSERT(lidp != NULL); | ||
519 | |||
520 | trace_xfs_trans_brelse(bip); | 493 | trace_xfs_trans_brelse(bip); |
521 | 494 | ||
522 | /* | 495 | /* |
@@ -532,7 +505,7 @@ xfs_trans_brelse(xfs_trans_t *tp, | |||
532 | * If the buffer is dirty within this transaction, we can't | 505 | * If the buffer is dirty within this transaction, we can't |
533 | * release it until we commit. | 506 | * release it until we commit. |
534 | */ | 507 | */ |
535 | if (lidp->lid_flags & XFS_LID_DIRTY) | 508 | if (bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY) |
536 | return; | 509 | return; |
537 | 510 | ||
538 | /* | 511 | /* |
@@ -549,7 +522,7 @@ xfs_trans_brelse(xfs_trans_t *tp, | |||
549 | /* | 522 | /* |
550 | * Free up the log item descriptor tracking the released item. | 523 | * Free up the log item descriptor tracking the released item. |
551 | */ | 524 | */ |
552 | xfs_trans_free_item(tp, lidp); | 525 | xfs_trans_del_item(&bip->bli_item); |
553 | 526 | ||
554 | /* | 527 | /* |
555 | * Clear the hold flag in the buf log item if it is set. | 528 | * Clear the hold flag in the buf log item if it is set. |
@@ -661,7 +634,6 @@ xfs_trans_log_buf(xfs_trans_t *tp, | |||
661 | uint last) | 634 | uint last) |
662 | { | 635 | { |
663 | xfs_buf_log_item_t *bip; | 636 | xfs_buf_log_item_t *bip; |
664 | xfs_log_item_desc_t *lidp; | ||
665 | 637 | ||
666 | ASSERT(XFS_BUF_ISBUSY(bp)); | 638 | ASSERT(XFS_BUF_ISBUSY(bp)); |
667 | ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); | 639 | ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); |
@@ -703,11 +675,8 @@ xfs_trans_log_buf(xfs_trans_t *tp, | |||
703 | bip->bli_format.blf_flags &= ~XFS_BLF_CANCEL; | 675 | bip->bli_format.blf_flags &= ~XFS_BLF_CANCEL; |
704 | } | 676 | } |
705 | 677 | ||
706 | lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)bip); | ||
707 | ASSERT(lidp != NULL); | ||
708 | |||
709 | tp->t_flags |= XFS_TRANS_DIRTY; | 678 | tp->t_flags |= XFS_TRANS_DIRTY; |
710 | lidp->lid_flags |= XFS_LID_DIRTY; | 679 | bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY; |
711 | bip->bli_flags |= XFS_BLI_LOGGED; | 680 | bip->bli_flags |= XFS_BLI_LOGGED; |
712 | xfs_buf_item_log(bip, first, last); | 681 | xfs_buf_item_log(bip, first, last); |
713 | } | 682 | } |
@@ -736,7 +705,6 @@ xfs_trans_binval( | |||
736 | xfs_trans_t *tp, | 705 | xfs_trans_t *tp, |
737 | xfs_buf_t *bp) | 706 | xfs_buf_t *bp) |
738 | { | 707 | { |
739 | xfs_log_item_desc_t *lidp; | ||
740 | xfs_buf_log_item_t *bip; | 708 | xfs_buf_log_item_t *bip; |
741 | 709 | ||
742 | ASSERT(XFS_BUF_ISBUSY(bp)); | 710 | ASSERT(XFS_BUF_ISBUSY(bp)); |
@@ -744,8 +712,6 @@ xfs_trans_binval( | |||
744 | ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); | 712 | ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); |
745 | 713 | ||
746 | bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); | 714 | bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); |
747 | lidp = xfs_trans_find_item(tp, (xfs_log_item_t*)bip); | ||
748 | ASSERT(lidp != NULL); | ||
749 | ASSERT(atomic_read(&bip->bli_refcount) > 0); | 715 | ASSERT(atomic_read(&bip->bli_refcount) > 0); |
750 | 716 | ||
751 | trace_xfs_trans_binval(bip); | 717 | trace_xfs_trans_binval(bip); |
@@ -760,7 +726,7 @@ xfs_trans_binval( | |||
760 | ASSERT(!(bip->bli_flags & (XFS_BLI_LOGGED | XFS_BLI_DIRTY))); | 726 | ASSERT(!(bip->bli_flags & (XFS_BLI_LOGGED | XFS_BLI_DIRTY))); |
761 | ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_INODE_BUF)); | 727 | ASSERT(!(bip->bli_format.blf_flags & XFS_BLF_INODE_BUF)); |
762 | ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); | 728 | ASSERT(bip->bli_format.blf_flags & XFS_BLF_CANCEL); |
763 | ASSERT(lidp->lid_flags & XFS_LID_DIRTY); | 729 | ASSERT(bip->bli_item.li_desc->lid_flags & XFS_LID_DIRTY); |
764 | ASSERT(tp->t_flags & XFS_TRANS_DIRTY); | 730 | ASSERT(tp->t_flags & XFS_TRANS_DIRTY); |
765 | return; | 731 | return; |
766 | } | 732 | } |
@@ -793,7 +759,7 @@ xfs_trans_binval( | |||
793 | bip->bli_format.blf_flags |= XFS_BLF_CANCEL; | 759 | bip->bli_format.blf_flags |= XFS_BLF_CANCEL; |
794 | memset((char *)(bip->bli_format.blf_data_map), 0, | 760 | memset((char *)(bip->bli_format.blf_data_map), 0, |
795 | (bip->bli_format.blf_map_size * sizeof(uint))); | 761 | (bip->bli_format.blf_map_size * sizeof(uint))); |
796 | lidp->lid_flags |= XFS_LID_DIRTY; | 762 | bip->bli_item.li_desc->lid_flags |= XFS_LID_DIRTY; |
797 | tp->t_flags |= XFS_TRANS_DIRTY; | 763 | tp->t_flags |= XFS_TRANS_DIRTY; |
798 | } | 764 | } |
799 | 765 | ||