aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_buf.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-08-23 04:28:08 -0400
committerAlex Elder <aelder@sgi.com>2011-10-11 22:15:00 -0400
commitc4e1c098ee8a72ea563a697a2b175868be86fdc9 (patch)
treec584856c23fe1dee09021d93eb8f9ddf88c5dddd /fs/xfs/xfs_buf.c
parentc2b006c1da1602551def200e4661535f02b82488 (diff)
xfs: use the "delwri" terminology consistently
And also remove the strange local lock and delwri list pointers in a few functions. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r--fs/xfs/xfs_buf.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index 63dbeb9efc49..d3c2b58d7d70 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1489,12 +1489,12 @@ xfs_setsize_buftarg(
1489} 1489}
1490 1490
1491STATIC int 1491STATIC int
1492xfs_alloc_delwrite_queue( 1492xfs_alloc_delwri_queue(
1493 xfs_buftarg_t *btp, 1493 xfs_buftarg_t *btp,
1494 const char *fsname) 1494 const char *fsname)
1495{ 1495{
1496 INIT_LIST_HEAD(&btp->bt_delwrite_queue); 1496 INIT_LIST_HEAD(&btp->bt_delwri_queue);
1497 spin_lock_init(&btp->bt_delwrite_lock); 1497 spin_lock_init(&btp->bt_delwri_lock);
1498 btp->bt_flags = 0; 1498 btp->bt_flags = 0;
1499 btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd/%s", fsname); 1499 btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd/%s", fsname);
1500 if (IS_ERR(btp->bt_task)) 1500 if (IS_ERR(btp->bt_task))
@@ -1524,7 +1524,7 @@ xfs_alloc_buftarg(
1524 spin_lock_init(&btp->bt_lru_lock); 1524 spin_lock_init(&btp->bt_lru_lock);
1525 if (xfs_setsize_buftarg_early(btp, bdev)) 1525 if (xfs_setsize_buftarg_early(btp, bdev))
1526 goto error; 1526 goto error;
1527 if (xfs_alloc_delwrite_queue(btp, fsname)) 1527 if (xfs_alloc_delwri_queue(btp, fsname))
1528 goto error; 1528 goto error;
1529 btp->bt_shrinker.shrink = xfs_buftarg_shrink; 1529 btp->bt_shrinker.shrink = xfs_buftarg_shrink;
1530 btp->bt_shrinker.seeks = DEFAULT_SEEKS; 1530 btp->bt_shrinker.seeks = DEFAULT_SEEKS;
@@ -1544,46 +1544,44 @@ void
1544xfs_buf_delwri_queue( 1544xfs_buf_delwri_queue(
1545 xfs_buf_t *bp) 1545 xfs_buf_t *bp)
1546{ 1546{
1547 struct list_head *dwq = &bp->b_target->bt_delwrite_queue; 1547 struct xfs_buftarg *btp = bp->b_target;
1548 spinlock_t *dwlk = &bp->b_target->bt_delwrite_lock;
1549 1548
1550 trace_xfs_buf_delwri_queue(bp, _RET_IP_); 1549 trace_xfs_buf_delwri_queue(bp, _RET_IP_);
1551 1550
1552 ASSERT(!(bp->b_flags & XBF_READ)); 1551 ASSERT(!(bp->b_flags & XBF_READ));
1553 1552
1554 spin_lock(dwlk); 1553 spin_lock(&btp->bt_delwri_lock);
1555 if (!list_empty(&bp->b_list)) { 1554 if (!list_empty(&bp->b_list)) {
1556 /* if already in the queue, move it to the tail */ 1555 /* if already in the queue, move it to the tail */
1557 ASSERT(bp->b_flags & _XBF_DELWRI_Q); 1556 ASSERT(bp->b_flags & _XBF_DELWRI_Q);
1558 list_move_tail(&bp->b_list, dwq); 1557 list_move_tail(&bp->b_list, &btp->bt_delwri_queue);
1559 } else { 1558 } else {
1560 /* start xfsbufd as it is about to have something to do */ 1559 /* start xfsbufd as it is about to have something to do */
1561 if (list_empty(dwq)) 1560 if (list_empty(&btp->bt_delwri_queue))
1562 wake_up_process(bp->b_target->bt_task); 1561 wake_up_process(bp->b_target->bt_task);
1563 1562
1564 atomic_inc(&bp->b_hold); 1563 atomic_inc(&bp->b_hold);
1565 bp->b_flags |= XBF_DELWRI | _XBF_DELWRI_Q | XBF_ASYNC; 1564 bp->b_flags |= XBF_DELWRI | _XBF_DELWRI_Q | XBF_ASYNC;
1566 list_add_tail(&bp->b_list, dwq); 1565 list_add_tail(&bp->b_list, &btp->bt_delwri_queue);
1567 } 1566 }
1568 bp->b_queuetime = jiffies; 1567 bp->b_queuetime = jiffies;
1569 spin_unlock(dwlk); 1568 spin_unlock(&btp->bt_delwri_lock);
1570} 1569}
1571 1570
1572void 1571void
1573xfs_buf_delwri_dequeue( 1572xfs_buf_delwri_dequeue(
1574 xfs_buf_t *bp) 1573 xfs_buf_t *bp)
1575{ 1574{
1576 spinlock_t *dwlk = &bp->b_target->bt_delwrite_lock;
1577 int dequeued = 0; 1575 int dequeued = 0;
1578 1576
1579 spin_lock(dwlk); 1577 spin_lock(&bp->b_target->bt_delwri_lock);
1580 if ((bp->b_flags & XBF_DELWRI) && !list_empty(&bp->b_list)) { 1578 if ((bp->b_flags & XBF_DELWRI) && !list_empty(&bp->b_list)) {
1581 ASSERT(bp->b_flags & _XBF_DELWRI_Q); 1579 ASSERT(bp->b_flags & _XBF_DELWRI_Q);
1582 list_del_init(&bp->b_list); 1580 list_del_init(&bp->b_list);
1583 dequeued = 1; 1581 dequeued = 1;
1584 } 1582 }
1585 bp->b_flags &= ~(XBF_DELWRI|_XBF_DELWRI_Q); 1583 bp->b_flags &= ~(XBF_DELWRI|_XBF_DELWRI_Q);
1586 spin_unlock(dwlk); 1584 spin_unlock(&bp->b_target->bt_delwri_lock);
1587 1585
1588 if (dequeued) 1586 if (dequeued)
1589 xfs_buf_rele(bp); 1587 xfs_buf_rele(bp);
@@ -1615,9 +1613,9 @@ xfs_buf_delwri_promote(
1615 if (bp->b_queuetime < jiffies - age) 1613 if (bp->b_queuetime < jiffies - age)
1616 return; 1614 return;
1617 bp->b_queuetime = jiffies - age; 1615 bp->b_queuetime = jiffies - age;
1618 spin_lock(&btp->bt_delwrite_lock); 1616 spin_lock(&btp->bt_delwri_lock);
1619 list_move(&bp->b_list, &btp->bt_delwrite_queue); 1617 list_move(&bp->b_list, &btp->bt_delwri_queue);
1620 spin_unlock(&btp->bt_delwrite_lock); 1618 spin_unlock(&btp->bt_delwri_lock);
1621} 1619}
1622 1620
1623STATIC void 1621STATIC void
@@ -1638,15 +1636,13 @@ xfs_buf_delwri_split(
1638 unsigned long age) 1636 unsigned long age)
1639{ 1637{
1640 xfs_buf_t *bp, *n; 1638 xfs_buf_t *bp, *n;
1641 struct list_head *dwq = &target->bt_delwrite_queue;
1642 spinlock_t *dwlk = &target->bt_delwrite_lock;
1643 int skipped = 0; 1639 int skipped = 0;
1644 int force; 1640 int force;
1645 1641
1646 force = test_and_clear_bit(XBT_FORCE_FLUSH, &target->bt_flags); 1642 force = test_and_clear_bit(XBT_FORCE_FLUSH, &target->bt_flags);
1647 INIT_LIST_HEAD(list); 1643 INIT_LIST_HEAD(list);
1648 spin_lock(dwlk); 1644 spin_lock(&target->bt_delwri_lock);
1649 list_for_each_entry_safe(bp, n, dwq, b_list) { 1645 list_for_each_entry_safe(bp, n, &target->bt_delwri_queue, b_list) {
1650 ASSERT(bp->b_flags & XBF_DELWRI); 1646 ASSERT(bp->b_flags & XBF_DELWRI);
1651 1647
1652 if (!xfs_buf_ispinned(bp) && xfs_buf_trylock(bp)) { 1648 if (!xfs_buf_ispinned(bp) && xfs_buf_trylock(bp)) {
@@ -1663,10 +1659,9 @@ xfs_buf_delwri_split(
1663 } else 1659 } else
1664 skipped++; 1660 skipped++;
1665 } 1661 }
1666 spin_unlock(dwlk);
1667 1662
1663 spin_unlock(&target->bt_delwri_lock);
1668 return skipped; 1664 return skipped;
1669
1670} 1665}
1671 1666
1672/* 1667/*
@@ -1716,7 +1711,7 @@ xfsbufd(
1716 } 1711 }
1717 1712
1718 /* sleep for a long time if there is nothing to do. */ 1713 /* sleep for a long time if there is nothing to do. */
1719 if (list_empty(&target->bt_delwrite_queue)) 1714 if (list_empty(&target->bt_delwri_queue))
1720 tout = MAX_SCHEDULE_TIMEOUT; 1715 tout = MAX_SCHEDULE_TIMEOUT;
1721 schedule_timeout_interruptible(tout); 1716 schedule_timeout_interruptible(tout);
1722 1717