aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2010-01-11 06:49:59 -0500
committerAlex Elder <aelder@sgi.com>2010-01-15 16:32:54 -0500
commitc9c129714e71c890bed1bd5b61697a896c3c2d54 (patch)
tree8eff8e5ba534feb20dae7b143ea42bf0b0c24725 /fs
parent453eac8a9aa417878a38bdfbccafd5f7ce4e8e4e (diff)
xfs: Don't wake xfsbufd when idle
The xfsbufd wakes every xfsbufd_centisecs (once per second by default) for each filesystem even when the filesystem is idle. If the xfsbufd has nothing to do, put it into a long term sleep and only wake it up when there is work pending (i.e. dirty buffers to flush soon). This will make laptop power misers happy. Signed-off-by: Dave Chinner <david@fromorbit.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 77b8be81c769..18ae3ba8f78a 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1595,6 +1595,11 @@ xfs_buf_delwri_queue(
1595 list_del(&bp->b_list); 1595 list_del(&bp->b_list);
1596 } 1596 }
1597 1597
1598 if (list_empty(dwq)) {
1599 /* start xfsbufd as it is about to have something to do */
1600 wake_up_process(bp->b_target->bt_task);
1601 }
1602
1598 bp->b_flags |= _XBF_DELWRI_Q; 1603 bp->b_flags |= _XBF_DELWRI_Q;
1599 list_add_tail(&bp->b_list, dwq); 1604 list_add_tail(&bp->b_list, dwq);
1600 bp->b_queuetime = jiffies; 1605 bp->b_queuetime = jiffies;
@@ -1644,6 +1649,8 @@ xfsbufd_wakeup(
1644 list_for_each_entry(btp, &xfs_buftarg_list, bt_list) { 1649 list_for_each_entry(btp, &xfs_buftarg_list, bt_list) {
1645 if (test_bit(XBT_FORCE_SLEEP, &btp->bt_flags)) 1650 if (test_bit(XBT_FORCE_SLEEP, &btp->bt_flags))
1646 continue; 1651 continue;
1652 if (list_empty(&btp->bt_delwrite_queue))
1653 continue;
1647 set_bit(XBT_FORCE_FLUSH, &btp->bt_flags); 1654 set_bit(XBT_FORCE_FLUSH, &btp->bt_flags);
1648 wake_up_process(btp->bt_task); 1655 wake_up_process(btp->bt_task);
1649 } 1656 }
@@ -1708,6 +1715,9 @@ xfsbufd(
1708 set_freezable(); 1715 set_freezable();
1709 1716
1710 do { 1717 do {
1718 long age = xfs_buf_age_centisecs * msecs_to_jiffies(10);
1719 long tout = xfs_buf_timer_centisecs * msecs_to_jiffies(10);
1720
1711 if (unlikely(freezing(current))) { 1721 if (unlikely(freezing(current))) {
1712 set_bit(XBT_FORCE_SLEEP, &target->bt_flags); 1722 set_bit(XBT_FORCE_SLEEP, &target->bt_flags);
1713 refrigerator(); 1723 refrigerator();
@@ -1715,12 +1725,12 @@ xfsbufd(
1715 clear_bit(XBT_FORCE_SLEEP, &target->bt_flags); 1725 clear_bit(XBT_FORCE_SLEEP, &target->bt_flags);
1716 } 1726 }
1717 1727
1718 schedule_timeout_interruptible( 1728 /* sleep for a long time if there is nothing to do. */
1719 xfs_buf_timer_centisecs * msecs_to_jiffies(10)); 1729 if (list_empty(&target->bt_delwrite_queue))
1720 1730 tout = MAX_SCHEDULE_TIMEOUT;
1721 xfs_buf_delwri_split(target, &tmp, 1731 schedule_timeout_interruptible(tout);
1722 xfs_buf_age_centisecs * msecs_to_jiffies(10));
1723 1732
1733 xfs_buf_delwri_split(target, &tmp, age);
1724 count = 0; 1734 count = 0;
1725 while (!list_empty(&tmp)) { 1735 while (!list_empty(&tmp)) {
1726 bp = list_entry(tmp.next, xfs_buf_t, b_list); 1736 bp = list_entry(tmp.next, xfs_buf_t, b_list);