Commit a1b7ea5d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
parent 957935dc
...@@ -915,8 +915,6 @@ xfs_buf_lock( ...@@ -915,8 +915,6 @@ xfs_buf_lock(
if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE)) if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE))
xfs_log_force(bp->b_target->bt_mount, 0); xfs_log_force(bp->b_target->bt_mount, 0);
if (atomic_read(&bp->b_io_remaining))
blk_flush_plug(current);
down(&bp->b_sema); down(&bp->b_sema);
XB_SET_OWNER(bp); XB_SET_OWNER(bp);
...@@ -1305,8 +1303,6 @@ xfs_buf_iowait( ...@@ -1305,8 +1303,6 @@ xfs_buf_iowait(
{ {
trace_xfs_buf_iowait(bp, _RET_IP_); trace_xfs_buf_iowait(bp, _RET_IP_);
if (atomic_read(&bp->b_io_remaining))
blk_flush_plug(current);
wait_for_completion(&bp->b_iowait); wait_for_completion(&bp->b_iowait);
trace_xfs_buf_iowait_done(bp, _RET_IP_); trace_xfs_buf_iowait_done(bp, _RET_IP_);
...@@ -1743,8 +1739,8 @@ xfsbufd( ...@@ -1743,8 +1739,8 @@ xfsbufd(
do { do {
long age = xfs_buf_age_centisecs * msecs_to_jiffies(10); long age = xfs_buf_age_centisecs * msecs_to_jiffies(10);
long tout = xfs_buf_timer_centisecs * msecs_to_jiffies(10); long tout = xfs_buf_timer_centisecs * msecs_to_jiffies(10);
int count = 0;
struct list_head tmp; struct list_head tmp;
struct blk_plug plug;
if (unlikely(freezing(current))) { if (unlikely(freezing(current))) {
set_bit(XBT_FORCE_SLEEP, &target->bt_flags); set_bit(XBT_FORCE_SLEEP, &target->bt_flags);
...@@ -1760,16 +1756,15 @@ xfsbufd( ...@@ -1760,16 +1756,15 @@ xfsbufd(
xfs_buf_delwri_split(target, &tmp, age); xfs_buf_delwri_split(target, &tmp, age);
list_sort(NULL, &tmp, xfs_buf_cmp); list_sort(NULL, &tmp, xfs_buf_cmp);
blk_start_plug(&plug);
while (!list_empty(&tmp)) { while (!list_empty(&tmp)) {
struct xfs_buf *bp; struct xfs_buf *bp;
bp = list_first_entry(&tmp, struct xfs_buf, b_list); bp = list_first_entry(&tmp, struct xfs_buf, b_list);
list_del_init(&bp->b_list); list_del_init(&bp->b_list);
xfs_bdstrat_cb(bp); xfs_bdstrat_cb(bp);
count++;
} }
if (count) blk_finish_plug(&plug);
blk_flush_plug(current);
} while (!kthread_should_stop()); } while (!kthread_should_stop());
return 0; return 0;
...@@ -1789,6 +1784,7 @@ xfs_flush_buftarg( ...@@ -1789,6 +1784,7 @@ xfs_flush_buftarg(
int pincount = 0; int pincount = 0;
LIST_HEAD(tmp_list); LIST_HEAD(tmp_list);
LIST_HEAD(wait_list); LIST_HEAD(wait_list);
struct blk_plug plug;
xfs_buf_runall_queues(xfsconvertd_workqueue); xfs_buf_runall_queues(xfsconvertd_workqueue);
xfs_buf_runall_queues(xfsdatad_workqueue); xfs_buf_runall_queues(xfsdatad_workqueue);
...@@ -1803,6 +1799,8 @@ xfs_flush_buftarg( ...@@ -1803,6 +1799,8 @@ xfs_flush_buftarg(
* we do that after issuing all the IO. * we do that after issuing all the IO.
*/ */
list_sort(NULL, &tmp_list, xfs_buf_cmp); list_sort(NULL, &tmp_list, xfs_buf_cmp);
blk_start_plug(&plug);
while (!list_empty(&tmp_list)) { while (!list_empty(&tmp_list)) {
bp = list_first_entry(&tmp_list, struct xfs_buf, b_list); bp = list_first_entry(&tmp_list, struct xfs_buf, b_list);
ASSERT(target == bp->b_target); ASSERT(target == bp->b_target);
...@@ -1813,10 +1811,10 @@ xfs_flush_buftarg( ...@@ -1813,10 +1811,10 @@ xfs_flush_buftarg(
} }
xfs_bdstrat_cb(bp); xfs_bdstrat_cb(bp);
} }
blk_finish_plug(&plug);
if (wait) { if (wait) {
/* Expedite and wait for IO to complete. */ /* Wait for IO to complete. */
blk_flush_plug(current);
while (!list_empty(&wait_list)) { while (!list_empty(&wait_list)) {
bp = list_first_entry(&wait_list, struct xfs_buf, b_list); bp = list_first_entry(&wait_list, struct xfs_buf, b_list);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment