Skip to content

Commit a1b7ea5

Browse files
Christoph HellwigAlex Elder
Christoph Hellwig
authored and
Alex Elder
committed
xfs: use proper interfaces for on-stack plugging
Add proper blk_start_plug/blk_finish_plug pairs for the two places where we issue buffer I/O, and remove the blk_flush_plug in xfs_buf_lock and xfs_buf_iowait, given that context switches already flush the per-process plugging lists. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Alex Elder <aelder@sgi.com>
1 parent 957935d commit a1b7ea5

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

fs/xfs/linux-2.6/xfs_buf.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,6 @@ xfs_buf_lock(
915915

916916
if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE))
917917
xfs_log_force(bp->b_target->bt_mount, 0);
918-
if (atomic_read(&bp->b_io_remaining))
919-
blk_flush_plug(current);
920918
down(&bp->b_sema);
921919
XB_SET_OWNER(bp);
922920

@@ -1305,8 +1303,6 @@ xfs_buf_iowait(
13051303
{
13061304
trace_xfs_buf_iowait(bp, _RET_IP_);
13071305

1308-
if (atomic_read(&bp->b_io_remaining))
1309-
blk_flush_plug(current);
13101306
wait_for_completion(&bp->b_iowait);
13111307

13121308
trace_xfs_buf_iowait_done(bp, _RET_IP_);
@@ -1743,8 +1739,8 @@ xfsbufd(
17431739
do {
17441740
long age = xfs_buf_age_centisecs * msecs_to_jiffies(10);
17451741
long tout = xfs_buf_timer_centisecs * msecs_to_jiffies(10);
1746-
int count = 0;
17471742
struct list_head tmp;
1743+
struct blk_plug plug;
17481744

17491745
if (unlikely(freezing(current))) {
17501746
set_bit(XBT_FORCE_SLEEP, &target->bt_flags);
@@ -1760,16 +1756,15 @@ xfsbufd(
17601756

17611757
xfs_buf_delwri_split(target, &tmp, age);
17621758
list_sort(NULL, &tmp, xfs_buf_cmp);
1759+
1760+
blk_start_plug(&plug);
17631761
while (!list_empty(&tmp)) {
17641762
struct xfs_buf *bp;
17651763
bp = list_first_entry(&tmp, struct xfs_buf, b_list);
17661764
list_del_init(&bp->b_list);
17671765
xfs_bdstrat_cb(bp);
1768-
count++;
17691766
}
1770-
if (count)
1771-
blk_flush_plug(current);
1772-
1767+
blk_finish_plug(&plug);
17731768
} while (!kthread_should_stop());
17741769

17751770
return 0;
@@ -1789,6 +1784,7 @@ xfs_flush_buftarg(
17891784
int pincount = 0;
17901785
LIST_HEAD(tmp_list);
17911786
LIST_HEAD(wait_list);
1787+
struct blk_plug plug;
17921788

17931789
xfs_buf_runall_queues(xfsconvertd_workqueue);
17941790
xfs_buf_runall_queues(xfsdatad_workqueue);
@@ -1803,6 +1799,8 @@ xfs_flush_buftarg(
18031799
* we do that after issuing all the IO.
18041800
*/
18051801
list_sort(NULL, &tmp_list, xfs_buf_cmp);
1802+
1803+
blk_start_plug(&plug);
18061804
while (!list_empty(&tmp_list)) {
18071805
bp = list_first_entry(&tmp_list, struct xfs_buf, b_list);
18081806
ASSERT(target == bp->b_target);
@@ -1813,10 +1811,10 @@ xfs_flush_buftarg(
18131811
}
18141812
xfs_bdstrat_cb(bp);
18151813
}
1814+
blk_finish_plug(&plug);
18161815

18171816
if (wait) {
1818-
/* Expedite and wait for IO to complete. */
1819-
blk_flush_plug(current);
1817+
/* Wait for IO to complete. */
18201818
while (!list_empty(&wait_list)) {
18211819
bp = list_first_entry(&wait_list, struct xfs_buf, b_list);
18221820

0 commit comments

Comments
 (0)