aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2012-04-23 01:58:54 -0400
committerBen Myers <bpm@sgi.com>2012-05-14 17:20:50 -0400
commita8acad70731e7d0585f25f33f8a009176f001f70 (patch)
tree07a14f8bde89e7947f56df7203530b7713b186ac /fs/xfs/xfs_buf.c
parent795cac72e902496adac399389f9affe5d1ab821a (diff)
xfs: kill XBF_LOCK
Buffers are always returned locked from the lookup routines. Hence we don't need to tell the lookup routines to return locked buffers, on to try and lock them. Remove XBF_LOCK from all the callers and from internal buffer cache usage. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r--fs/xfs/xfs_buf.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 942cf5051ab..8366348aa1f 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -185,7 +185,7 @@ xfs_buf_alloc(
185 /* 185 /*
186 * We don't want certain flags to appear in b_flags. 186 * We don't want certain flags to appear in b_flags.
187 */ 187 */
188 flags &= ~(XBF_LOCK|XBF_MAPPED|XBF_DONT_BLOCK|XBF_READ_AHEAD); 188 flags &= ~(XBF_MAPPED|XBF_DONT_BLOCK|XBF_READ_AHEAD);
189 189
190 atomic_set(&bp->b_hold, 1); 190 atomic_set(&bp->b_hold, 1);
191 atomic_set(&bp->b_lru_ref, 1); 191 atomic_set(&bp->b_lru_ref, 1);
@@ -584,19 +584,14 @@ found:
584 if (unlikely(error)) { 584 if (unlikely(error)) {
585 xfs_warn(target->bt_mount, 585 xfs_warn(target->bt_mount,
586 "%s: failed to map pages\n", __func__); 586 "%s: failed to map pages\n", __func__);
587 goto no_buffer; 587 xfs_buf_relse(bp);
588 return NULL;
588 } 589 }
589 } 590 }
590 591
591 XFS_STATS_INC(xb_get); 592 XFS_STATS_INC(xb_get);
592 trace_xfs_buf_get(bp, flags, _RET_IP_); 593 trace_xfs_buf_get(bp, flags, _RET_IP_);
593 return bp; 594 return bp;
594
595no_buffer:
596 if (flags & (XBF_LOCK | XBF_TRYLOCK))
597 xfs_buf_unlock(bp);
598 xfs_buf_rele(bp);
599 return NULL;
600} 595}
601 596
602STATIC int 597STATIC int
@@ -639,7 +634,8 @@ xfs_buf_read(
639 * Read ahead call which is already satisfied, 634 * Read ahead call which is already satisfied,
640 * drop the buffer 635 * drop the buffer
641 */ 636 */
642 goto no_buffer; 637 xfs_buf_relse(bp);
638 return NULL;
643 } else { 639 } else {
644 /* We do not want read in the flags */ 640 /* We do not want read in the flags */
645 bp->b_flags &= ~XBF_READ; 641 bp->b_flags &= ~XBF_READ;
@@ -647,12 +643,6 @@ xfs_buf_read(
647 } 643 }
648 644
649 return bp; 645 return bp;
650
651 no_buffer:
652 if (flags & (XBF_LOCK | XBF_TRYLOCK))
653 xfs_buf_unlock(bp);
654 xfs_buf_rele(bp);
655 return NULL;
656} 646}
657 647
658/* 648/*