aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_buf.c
diff options
context:
space:
mode:
authorDavid Chinner <dgc@sgi.com>2007-02-10 02:34:49 -0500
committerTim Shimmin <tes@sgi.com>2007-02-10 02:34:49 -0500
commit5e6a07dfe404cd4d8494d842b54706cb007fa04b (patch)
tree46cb354cfaedf75afb956036b5238a12f6c75f1d /fs/xfs/linux-2.6/xfs_buf.c
parentdc74eaad8cda9f12a885639b4f2513c99e9b483a (diff)
[XFS] Current usage of buftarg flags is incorrect.
The {test,set,clear}_bit() operations take a bit index for the bit to operate on. The XBT_* flags are defined as bit fields which is incorrect, not to mention the way the bit fields are enumerated is broken too. This was only working by chance. Fix the definitions of the flags and make the code using them use the {test,set,clear}_bit() operations correctly. SGI-PV: 958639 SGI-Modid: xfs-linux-melb:xfs-kern:27565a Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_buf.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_buf.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c
index 946b00bf3841..168eecd8127e 100644
--- a/fs/xfs/linux-2.6/xfs_buf.c
+++ b/fs/xfs/linux-2.6/xfs_buf.c
@@ -1687,14 +1687,15 @@ STATIC int
1687xfs_buf_delwri_split( 1687xfs_buf_delwri_split(
1688 xfs_buftarg_t *target, 1688 xfs_buftarg_t *target,
1689 struct list_head *list, 1689 struct list_head *list,
1690 unsigned long age, 1690 unsigned long age)
1691 int flags)
1692{ 1691{
1693 xfs_buf_t *bp, *n; 1692 xfs_buf_t *bp, *n;
1694 struct list_head *dwq = &target->bt_delwrite_queue; 1693 struct list_head *dwq = &target->bt_delwrite_queue;
1695 spinlock_t *dwlk = &target->bt_delwrite_lock; 1694 spinlock_t *dwlk = &target->bt_delwrite_lock;
1696 int skipped = 0; 1695 int skipped = 0;
1696 int force;
1697 1697
1698 force = test_and_clear_bit(XBT_FORCE_FLUSH, &target->bt_flags);
1698 INIT_LIST_HEAD(list); 1699 INIT_LIST_HEAD(list);
1699 spin_lock(dwlk); 1700 spin_lock(dwlk);
1700 list_for_each_entry_safe(bp, n, dwq, b_list) { 1701 list_for_each_entry_safe(bp, n, dwq, b_list) {
@@ -1702,7 +1703,7 @@ xfs_buf_delwri_split(
1702 ASSERT(bp->b_flags & XBF_DELWRI); 1703 ASSERT(bp->b_flags & XBF_DELWRI);
1703 1704
1704 if (!xfs_buf_ispin(bp) && !xfs_buf_cond_lock(bp)) { 1705 if (!xfs_buf_ispin(bp) && !xfs_buf_cond_lock(bp)) {
1705 if (!(flags & XBT_FORCE_FLUSH) && 1706 if (!force &&
1706 time_before(jiffies, bp->b_queuetime + age)) { 1707 time_before(jiffies, bp->b_queuetime + age)) {
1707 xfs_buf_unlock(bp); 1708 xfs_buf_unlock(bp);
1708 break; 1709 break;
@@ -1744,9 +1745,7 @@ xfsbufd(
1744 xfs_buf_timer_centisecs * msecs_to_jiffies(10)); 1745 xfs_buf_timer_centisecs * msecs_to_jiffies(10));
1745 1746
1746 xfs_buf_delwri_split(target, &tmp, 1747 xfs_buf_delwri_split(target, &tmp,
1747 xfs_buf_age_centisecs * msecs_to_jiffies(10), 1748 xfs_buf_age_centisecs * msecs_to_jiffies(10));
1748 test_bit(XBT_FORCE_FLUSH, &target->bt_flags)
1749 ? XBT_FORCE_FLUSH : 0);
1750 1749
1751 count = 0; 1750 count = 0;
1752 while (!list_empty(&tmp)) { 1751 while (!list_empty(&tmp)) {
@@ -1763,7 +1762,6 @@ xfsbufd(
1763 if (count) 1762 if (count)
1764 blk_run_address_space(target->bt_mapping); 1763 blk_run_address_space(target->bt_mapping);
1765 1764
1766 clear_bit(XBT_FORCE_FLUSH, &target->bt_flags);
1767 } while (!kthread_should_stop()); 1765 } while (!kthread_should_stop());
1768 1766
1769 return 0; 1767 return 0;
@@ -1786,7 +1784,8 @@ xfs_flush_buftarg(
1786 xfs_buf_runall_queues(xfsdatad_workqueue); 1784 xfs_buf_runall_queues(xfsdatad_workqueue);
1787 xfs_buf_runall_queues(xfslogd_workqueue); 1785 xfs_buf_runall_queues(xfslogd_workqueue);
1788 1786
1789 pincount = xfs_buf_delwri_split(target, &tmp, 0, XBT_FORCE_FLUSH); 1787 set_bit(XBT_FORCE_FLUSH, &target->bt_flags);
1788 pincount = xfs_buf_delwri_split(target, &tmp, 0);
1790 1789
1791 /* 1790 /*
1792 * Dropped the delayed write list lock, now walk the temporary list 1791 * Dropped the delayed write list lock, now walk the temporary list