aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf_item.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-06-23 04:11:15 -0400
committerAlex Elder <aelder@sgi.com>2010-07-26 14:16:36 -0400
commit4d16e9246fc3b3cf7bc95609eff66929a39daa06 (patch)
treed3e1cb33c3394b7cb95f390a85acb48c80fd5f54 /fs/xfs/xfs_buf_item.c
parentca30b2a7b7ac899ac4da6030ccbebf2f137b8e6d (diff)
xfs: simplify buffer pinning
Get rid of the xfs_buf_pin/xfs_buf_unpin/xfs_buf_ispin helpers and opencode them in their only callers, just like we did for the inode pinning a while ago. Also remove duplicate trace points - the bufitem tracepoints cover all the information that is present in a buffer tracepoint. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_buf_item.c')
-rw-r--r--fs/xfs/xfs_buf_item.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 60e063d96f8d..f53327a19e0d 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -359,14 +359,13 @@ xfs_buf_item_format(
359 359
360/* 360/*
361 * This is called to pin the buffer associated with the buf log item in memory 361 * This is called to pin the buffer associated with the buf log item in memory
362 * so it cannot be written out. Simply call bpin() on the buffer to do this. 362 * so it cannot be written out.
363 * 363 *
364 * We also always take a reference to the buffer log item here so that the bli 364 * We also always take a reference to the buffer log item here so that the bli
365 * is held while the item is pinned in memory. This means that we can 365 * is held while the item is pinned in memory. This means that we can
366 * unconditionally drop the reference count a transaction holds when the 366 * unconditionally drop the reference count a transaction holds when the
367 * transaction is completed. 367 * transaction is completed.
368 */ 368 */
369
370STATIC void 369STATIC void
371xfs_buf_item_pin( 370xfs_buf_item_pin(
372 struct xfs_log_item *lip) 371 struct xfs_log_item *lip)
@@ -378,15 +377,15 @@ xfs_buf_item_pin(
378 ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || 377 ASSERT((bip->bli_flags & XFS_BLI_LOGGED) ||
379 (bip->bli_flags & XFS_BLI_STALE)); 378 (bip->bli_flags & XFS_BLI_STALE));
380 379
381 atomic_inc(&bip->bli_refcount);
382 trace_xfs_buf_item_pin(bip); 380 trace_xfs_buf_item_pin(bip);
383 xfs_bpin(bip->bli_buf); 381
382 atomic_inc(&bip->bli_refcount);
383 atomic_inc(&bip->bli_buf->b_pin_count);
384} 384}
385 385
386/* 386/*
387 * This is called to unpin the buffer associated with the buf log 387 * This is called to unpin the buffer associated with the buf log
388 * item which was previously pinned with a call to xfs_buf_item_pin(). 388 * item which was previously pinned with a call to xfs_buf_item_pin().
389 * Just call bunpin() on the buffer to do this.
390 * 389 *
391 * Also drop the reference to the buf item for the current transaction. 390 * Also drop the reference to the buf item for the current transaction.
392 * If the XFS_BLI_STALE flag is set and we are the last reference, 391 * If the XFS_BLI_STALE flag is set and we are the last reference,
@@ -414,7 +413,9 @@ xfs_buf_item_unpin(
414 trace_xfs_buf_item_unpin(bip); 413 trace_xfs_buf_item_unpin(bip);
415 414
416 freed = atomic_dec_and_test(&bip->bli_refcount); 415 freed = atomic_dec_and_test(&bip->bli_refcount);
417 xfs_bunpin(bp); 416
417 if (atomic_dec_and_test(&bp->b_pin_count))
418 wake_up_all(&bp->b_waiters);
418 419
419 if (freed && stale) { 420 if (freed && stale) {
420 ASSERT(bip->bli_flags & XFS_BLI_STALE); 421 ASSERT(bip->bli_flags & XFS_BLI_STALE);