aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2011-07-13 07:43:49 -0400
committerChristoph Hellwig <hch@lst.de>2011-07-13 07:43:49 -0400
commitbf9d9013a2a559858efb590bf922377be9d6d969 (patch)
treed6c30253605901475db0110c61c25e9d139d20d4
parent77936d0280616d84d1eb0eb38a6f857d2827a434 (diff)
xfs: add a proper transaction pointer to struct xfs_buf
Replace the typeless b_fspriv2 and the ugly macros around it with a properly typed transaction pointer. As a fallout the log buffer state debug checks are also removed. We could have kept them using casts, but as they do not have a real purpose we can as well just remove them. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Alex Elder <aelder@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com>
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.h4
-rw-r--r--fs/xfs/xfs_buf_item.c4
-rw-r--r--fs/xfs/xfs_log.c9
-rw-r--r--fs/xfs/xfs_trans_buf.c32
4 files changed, 19 insertions, 30 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h
index 21604a17e2a3..2eec8f0f2a52 100644
--- a/fs/xfs/linux-2.6/xfs_buf.h
+++ b/fs/xfs/linux-2.6/xfs_buf.h
@@ -149,7 +149,7 @@ typedef struct xfs_buf {
149 xfs_buf_iodone_t b_iodone; /* I/O completion function */ 149 xfs_buf_iodone_t b_iodone; /* I/O completion function */
150 struct completion b_iowait; /* queue for I/O waiters */ 150 struct completion b_iowait; /* queue for I/O waiters */
151 void *b_fspriv; 151 void *b_fspriv;
152 void *b_fspriv2; 152 struct xfs_trans *b_transp;
153 struct page **b_pages; /* array of page pointers */ 153 struct page **b_pages; /* array of page pointers */
154 struct page *b_page_array[XB_PAGES]; /* inline pages */ 154 struct page *b_page_array[XB_PAGES]; /* inline pages */
155 unsigned long b_queuetime; /* time buffer was queued */ 155 unsigned long b_queuetime; /* time buffer was queued */
@@ -282,8 +282,6 @@ void xfs_buf_stale(struct xfs_buf *bp);
282 282
283#define XFS_BUF_FSPRIVATE(bp, type) ((type)(bp)->b_fspriv) 283#define XFS_BUF_FSPRIVATE(bp, type) ((type)(bp)->b_fspriv)
284#define XFS_BUF_SET_FSPRIVATE(bp, val) ((bp)->b_fspriv = (void*)(val)) 284#define XFS_BUF_SET_FSPRIVATE(bp, val) ((bp)->b_fspriv = (void*)(val))
285#define XFS_BUF_FSPRIVATE2(bp, type) ((type)(bp)->b_fspriv2)
286#define XFS_BUF_SET_FSPRIVATE2(bp, val) ((bp)->b_fspriv2 = (void*)(val))
287#define XFS_BUF_SET_START(bp) do { } while (0) 285#define XFS_BUF_SET_START(bp) do { } while (0)
288 286
289#define XFS_BUF_PTR(bp) (xfs_caddr_t)((bp)->b_addr) 287#define XFS_BUF_PTR(bp) (xfs_caddr_t)((bp)->b_addr)
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index da399ac4411d..716ef095b13f 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -443,7 +443,7 @@ xfs_buf_item_unpin(
443 * Since the transaction no longer refers to the buffer, 443 * Since the transaction no longer refers to the buffer,
444 * the buffer should no longer refer to the transaction. 444 * the buffer should no longer refer to the transaction.
445 */ 445 */
446 XFS_BUF_SET_FSPRIVATE2(bp, NULL); 446 bp->b_transp = NULL;
447 } 447 }
448 448
449 /* 449 /*
@@ -525,7 +525,7 @@ xfs_buf_item_unlock(
525 uint hold; 525 uint hold;
526 526
527 /* Clear the buffer's association with this transaction. */ 527 /* Clear the buffer's association with this transaction. */
528 XFS_BUF_SET_FSPRIVATE2(bp, NULL); 528 bp->b_transp = NULL;
529 529
530 /* 530 /*
531 * If this is a transaction abort, don't return early. Instead, allow 531 * If this is a transaction abort, don't return early. Instead, allow
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 0ef5eb677383..82c797dd6520 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -876,8 +876,6 @@ xlog_iodone(xfs_buf_t *bp)
876 int aborted; 876 int aborted;
877 877
878 iclog = XFS_BUF_FSPRIVATE(bp, xlog_in_core_t *); 878 iclog = XFS_BUF_FSPRIVATE(bp, xlog_in_core_t *);
879 ASSERT(XFS_BUF_FSPRIVATE2(bp, unsigned long) == (unsigned long) 2);
880 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
881 aborted = 0; 879 aborted = 0;
882 l = iclog->ic_log; 880 l = iclog->ic_log;
883 881
@@ -1057,7 +1055,6 @@ xlog_alloc_log(xfs_mount_t *mp,
1057 if (!bp) 1055 if (!bp)
1058 goto out_free_log; 1056 goto out_free_log;
1059 XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone); 1057 XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
1060 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
1061 ASSERT(XFS_BUF_ISBUSY(bp)); 1058 ASSERT(XFS_BUF_ISBUSY(bp));
1062 ASSERT(xfs_buf_islocked(bp)); 1059 ASSERT(xfs_buf_islocked(bp));
1063 log->l_xbuf = bp; 1060 log->l_xbuf = bp;
@@ -1092,7 +1089,6 @@ xlog_alloc_log(xfs_mount_t *mp,
1092 goto out_free_iclog; 1089 goto out_free_iclog;
1093 1090
1094 XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone); 1091 XFS_BUF_SET_IODONE_FUNC(bp, xlog_iodone);
1095 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
1096 iclog->ic_bp = bp; 1092 iclog->ic_bp = bp;
1097 iclog->ic_data = bp->b_addr; 1093 iclog->ic_data = bp->b_addr;
1098#ifdef DEBUG 1094#ifdef DEBUG
@@ -1349,8 +1345,6 @@ xlog_sync(xlog_t *log,
1349 } 1345 }
1350 1346
1351 bp = iclog->ic_bp; 1347 bp = iclog->ic_bp;
1352 ASSERT(XFS_BUF_FSPRIVATE2(bp, unsigned long) == (unsigned long)1);
1353 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)2);
1354 XFS_BUF_SET_ADDR(bp, BLOCK_LSN(be64_to_cpu(iclog->ic_header.h_lsn))); 1348 XFS_BUF_SET_ADDR(bp, BLOCK_LSN(be64_to_cpu(iclog->ic_header.h_lsn)));
1355 1349
1356 XFS_STATS_ADD(xs_log_blocks, BTOBB(count)); 1350 XFS_STATS_ADD(xs_log_blocks, BTOBB(count));
@@ -1408,9 +1402,6 @@ xlog_sync(xlog_t *log,
1408 } 1402 }
1409 if (split) { 1403 if (split) {
1410 bp = iclog->ic_log->l_xbuf; 1404 bp = iclog->ic_log->l_xbuf;
1411 ASSERT(XFS_BUF_FSPRIVATE2(bp, unsigned long) ==
1412 (unsigned long)1);
1413 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)2);
1414 XFS_BUF_SET_ADDR(bp, 0); /* logical 0 */ 1405 XFS_BUF_SET_ADDR(bp, 0); /* logical 0 */
1415 XFS_BUF_SET_PTR(bp, (xfs_caddr_t)((__psint_t)&(iclog->ic_header)+ 1406 XFS_BUF_SET_PTR(bp, (xfs_caddr_t)((__psint_t)&(iclog->ic_header)+
1416 (__psint_t)count), split); 1407 (__psint_t)count), split);
diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
index bd5445787855..09a0468ef11a 100644
--- a/fs/xfs/xfs_trans_buf.c
+++ b/fs/xfs/xfs_trans_buf.c
@@ -81,7 +81,7 @@ _xfs_trans_bjoin(
81 struct xfs_buf_log_item *bip; 81 struct xfs_buf_log_item *bip;
82 82
83 ASSERT(XFS_BUF_ISBUSY(bp)); 83 ASSERT(XFS_BUF_ISBUSY(bp));
84 ASSERT(XFS_BUF_FSPRIVATE2(bp, void *) == NULL); 84 ASSERT(bp->b_transp == NULL);
85 85
86 /* 86 /*
87 * The xfs_buf_log_item pointer is stored in b_fsprivate. If 87 * The xfs_buf_log_item pointer is stored in b_fsprivate. If
@@ -110,7 +110,7 @@ _xfs_trans_bjoin(
110 * Initialize b_fsprivate2 so we can find it with incore_match() 110 * Initialize b_fsprivate2 so we can find it with incore_match()
111 * in xfs_trans_get_buf() and friends above. 111 * in xfs_trans_get_buf() and friends above.
112 */ 112 */
113 XFS_BUF_SET_FSPRIVATE2(bp, tp); 113 bp->b_transp = tp;
114 114
115} 115}
116 116
@@ -172,7 +172,7 @@ xfs_trans_get_buf(xfs_trans_t *tp,
172 else if (XFS_BUF_ISSTALE(bp)) 172 else if (XFS_BUF_ISSTALE(bp))
173 ASSERT(!XFS_BUF_ISDELAYWRITE(bp)); 173 ASSERT(!XFS_BUF_ISDELAYWRITE(bp));
174 174
175 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 175 ASSERT(bp->b_transp == tp);
176 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); 176 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
177 ASSERT(bip != NULL); 177 ASSERT(bip != NULL);
178 ASSERT(atomic_read(&bip->bli_refcount) > 0); 178 ASSERT(atomic_read(&bip->bli_refcount) > 0);
@@ -232,7 +232,7 @@ xfs_trans_getsb(xfs_trans_t *tp,
232 * recursion count and return the buffer to the caller. 232 * recursion count and return the buffer to the caller.
233 */ 233 */
234 bp = mp->m_sb_bp; 234 bp = mp->m_sb_bp;
235 if (XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp) { 235 if (bp->b_transp == tp) {
236 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t*); 236 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t*);
237 ASSERT(bip != NULL); 237 ASSERT(bip != NULL);
238 ASSERT(atomic_read(&bip->bli_refcount) > 0); 238 ASSERT(atomic_read(&bip->bli_refcount) > 0);
@@ -328,7 +328,7 @@ xfs_trans_read_buf(
328 bp = xfs_trans_buf_item_match(tp, target, blkno, len); 328 bp = xfs_trans_buf_item_match(tp, target, blkno, len);
329 if (bp != NULL) { 329 if (bp != NULL) {
330 ASSERT(xfs_buf_islocked(bp)); 330 ASSERT(xfs_buf_islocked(bp));
331 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 331 ASSERT(bp->b_transp == tp);
332 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 332 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
333 ASSERT((XFS_BUF_ISERROR(bp)) == 0); 333 ASSERT((XFS_BUF_ISERROR(bp)) == 0);
334 if (!(XFS_BUF_ISDONE(bp))) { 334 if (!(XFS_BUF_ISDONE(bp))) {
@@ -466,7 +466,7 @@ xfs_trans_brelse(xfs_trans_t *tp,
466 * Default to a normal brelse() call if the tp is NULL. 466 * Default to a normal brelse() call if the tp is NULL.
467 */ 467 */
468 if (tp == NULL) { 468 if (tp == NULL) {
469 ASSERT(XFS_BUF_FSPRIVATE2(bp, void *) == NULL); 469 ASSERT(bp->b_transp == NULL);
470 /* 470 /*
471 * If there's a buf log item attached to the buffer, 471 * If there's a buf log item attached to the buffer,
472 * then let the AIL know that the buffer is being 472 * then let the AIL know that the buffer is being
@@ -484,7 +484,7 @@ xfs_trans_brelse(xfs_trans_t *tp,
484 return; 484 return;
485 } 485 }
486 486
487 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 487 ASSERT(bp->b_transp == tp);
488 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); 488 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
489 ASSERT(bip->bli_item.li_type == XFS_LI_BUF); 489 ASSERT(bip->bli_item.li_type == XFS_LI_BUF);
490 ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 490 ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
@@ -556,7 +556,7 @@ xfs_trans_brelse(xfs_trans_t *tp,
556 xfs_buf_item_relse(bp); 556 xfs_buf_item_relse(bp);
557 bip = NULL; 557 bip = NULL;
558 } 558 }
559 XFS_BUF_SET_FSPRIVATE2(bp, NULL); 559 bp->b_transp = NULL;
560 560
561 /* 561 /*
562 * If we've still got a buf log item on the buffer, then 562 * If we've still got a buf log item on the buffer, then
@@ -584,7 +584,7 @@ xfs_trans_bhold(xfs_trans_t *tp,
584 xfs_buf_log_item_t *bip; 584 xfs_buf_log_item_t *bip;
585 585
586 ASSERT(XFS_BUF_ISBUSY(bp)); 586 ASSERT(XFS_BUF_ISBUSY(bp));
587 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 587 ASSERT(bp->b_transp == tp);
588 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 588 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
589 589
590 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); 590 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
@@ -606,7 +606,7 @@ xfs_trans_bhold_release(xfs_trans_t *tp,
606 xfs_buf_log_item_t *bip; 606 xfs_buf_log_item_t *bip;
607 607
608 ASSERT(XFS_BUF_ISBUSY(bp)); 608 ASSERT(XFS_BUF_ISBUSY(bp));
609 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 609 ASSERT(bp->b_transp == tp);
610 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 610 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
611 611
612 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); 612 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
@@ -637,7 +637,7 @@ xfs_trans_log_buf(xfs_trans_t *tp,
637 xfs_buf_log_item_t *bip; 637 xfs_buf_log_item_t *bip;
638 638
639 ASSERT(XFS_BUF_ISBUSY(bp)); 639 ASSERT(XFS_BUF_ISBUSY(bp));
640 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 640 ASSERT(bp->b_transp == tp);
641 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 641 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
642 ASSERT((first <= last) && (last < XFS_BUF_COUNT(bp))); 642 ASSERT((first <= last) && (last < XFS_BUF_COUNT(bp)));
643 ASSERT((XFS_BUF_IODONE_FUNC(bp) == NULL) || 643 ASSERT((XFS_BUF_IODONE_FUNC(bp) == NULL) ||
@@ -709,7 +709,7 @@ xfs_trans_binval(
709 xfs_buf_log_item_t *bip; 709 xfs_buf_log_item_t *bip;
710 710
711 ASSERT(XFS_BUF_ISBUSY(bp)); 711 ASSERT(XFS_BUF_ISBUSY(bp));
712 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 712 ASSERT(bp->b_transp == tp);
713 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 713 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
714 714
715 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); 715 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
@@ -783,7 +783,7 @@ xfs_trans_inode_buf(
783 xfs_buf_log_item_t *bip; 783 xfs_buf_log_item_t *bip;
784 784
785 ASSERT(XFS_BUF_ISBUSY(bp)); 785 ASSERT(XFS_BUF_ISBUSY(bp));
786 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 786 ASSERT(bp->b_transp == tp);
787 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 787 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
788 788
789 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); 789 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
@@ -809,7 +809,7 @@ xfs_trans_stale_inode_buf(
809 xfs_buf_log_item_t *bip; 809 xfs_buf_log_item_t *bip;
810 810
811 ASSERT(XFS_BUF_ISBUSY(bp)); 811 ASSERT(XFS_BUF_ISBUSY(bp));
812 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 812 ASSERT(bp->b_transp == tp);
813 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 813 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
814 814
815 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); 815 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
@@ -836,7 +836,7 @@ xfs_trans_inode_alloc_buf(
836 xfs_buf_log_item_t *bip; 836 xfs_buf_log_item_t *bip;
837 837
838 ASSERT(XFS_BUF_ISBUSY(bp)); 838 ASSERT(XFS_BUF_ISBUSY(bp));
839 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 839 ASSERT(bp->b_transp == tp);
840 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 840 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
841 841
842 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *); 842 bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t *);
@@ -866,7 +866,7 @@ xfs_trans_dquot_buf(
866 xfs_buf_log_item_t *bip; 866 xfs_buf_log_item_t *bip;
867 867
868 ASSERT(XFS_BUF_ISBUSY(bp)); 868 ASSERT(XFS_BUF_ISBUSY(bp));
869 ASSERT(XFS_BUF_FSPRIVATE2(bp, xfs_trans_t *) == tp); 869 ASSERT(bp->b_transp == tp);
870 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL); 870 ASSERT(XFS_BUF_FSPRIVATE(bp, void *) != NULL);
871 ASSERT(type == XFS_BLF_UDQUOT_BUF || 871 ASSERT(type == XFS_BLF_UDQUOT_BUF ||
872 type == XFS_BLF_PDQUOT_BUF || 872 type == XFS_BLF_PDQUOT_BUF ||