public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: use proper interfaces for on-stack plugging
@ 2011-03-30 11:05 Christoph Hellwig
  2011-03-30 11:17 ` Jens Axboe
  2011-04-04 21:12 ` Alex Elder
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2011-03-30 11:05 UTC (permalink / raw)
  To: xfs; +Cc: jaxboe

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>

Index: xfs/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- xfs.orig/fs/xfs/linux-2.6/xfs_buf.c	2011-03-29 21:55:12.863724557 +0200
+++ xfs/fs/xfs/linux-2.6/xfs_buf.c	2011-03-29 21:58:39.028224204 +0200
@@ -919,8 +919,6 @@ xfs_buf_lock(
 
 	if (atomic_read(&bp->b_pin_count) && (bp->b_flags & XBF_STALE))
 		xfs_log_force(bp->b_target->bt_mount, 0);
-	if (atomic_read(&bp->b_io_remaining))
-		blk_flush_plug(current);
 	down(&bp->b_sema);
 	XB_SET_OWNER(bp);
 
@@ -1309,8 +1307,6 @@ xfs_buf_iowait(
 {
 	trace_xfs_buf_iowait(bp, _RET_IP_);
 
-	if (atomic_read(&bp->b_io_remaining))
-		blk_flush_plug(current);
 	wait_for_completion(&bp->b_iowait);
 
 	trace_xfs_buf_iowait_done(bp, _RET_IP_);
@@ -1747,8 +1743,8 @@ xfsbufd(
 	do {
 		long	age = xfs_buf_age_centisecs * msecs_to_jiffies(10);
 		long	tout = xfs_buf_timer_centisecs * msecs_to_jiffies(10);
-		int	count = 0;
 		struct list_head tmp;
+		struct blk_plug plug;
 
 		if (unlikely(freezing(current))) {
 			set_bit(XBT_FORCE_SLEEP, &target->bt_flags);
@@ -1764,16 +1760,15 @@ xfsbufd(
 
 		xfs_buf_delwri_split(target, &tmp, age);
 		list_sort(NULL, &tmp, xfs_buf_cmp);
+
+		blk_start_plug(&plug);
 		while (!list_empty(&tmp)) {
 			struct xfs_buf *bp;
 			bp = list_first_entry(&tmp, struct xfs_buf, b_list);
 			list_del_init(&bp->b_list);
 			xfs_bdstrat_cb(bp);
-			count++;
 		}
-		if (count)
-			blk_flush_plug(current);
-
+		blk_finish_plug(&plug);
 	} while (!kthread_should_stop());
 
 	return 0;
@@ -1793,6 +1788,7 @@ xfs_flush_buftarg(
 	int		pincount = 0;
 	LIST_HEAD(tmp_list);
 	LIST_HEAD(wait_list);
+	struct blk_plug plug;
 
 	xfs_buf_runall_queues(xfsconvertd_workqueue);
 	xfs_buf_runall_queues(xfsdatad_workqueue);
@@ -1807,6 +1803,8 @@ xfs_flush_buftarg(
 	 * we do that after issuing all the IO.
 	 */
 	list_sort(NULL, &tmp_list, xfs_buf_cmp);
+
+	blk_start_plug(&plug);
 	while (!list_empty(&tmp_list)) {
 		bp = list_first_entry(&tmp_list, struct xfs_buf, b_list);
 		ASSERT(target == bp->b_target);
@@ -1817,10 +1815,10 @@ xfs_flush_buftarg(
 		}
 		xfs_bdstrat_cb(bp);
 	}
+	blk_finish_plug(&plug);
 
 	if (wait) {
-		/* Expedite and wait for IO to complete. */
-		blk_flush_plug(current);
+		/* Wait for IO to complete. */
 		while (!list_empty(&wait_list)) {
 			bp = list_first_entry(&wait_list, struct xfs_buf, b_list);
 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: use proper interfaces for on-stack plugging
  2011-03-30 11:05 [PATCH] xfs: use proper interfaces for on-stack plugging Christoph Hellwig
@ 2011-03-30 11:17 ` Jens Axboe
  2011-04-04 21:12 ` Alex Elder
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2011-03-30 11:17 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs@oss.sgi.com

On 2011-03-30 13:05, Christoph Hellwig wrote:
> 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.

Looks much better, thanks for doing that.

Acked-by: Jens Axboe <jaxboe@fusionio.com>


-- 
Jens Axboe

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: use proper interfaces for on-stack plugging
  2011-03-30 11:05 [PATCH] xfs: use proper interfaces for on-stack plugging Christoph Hellwig
  2011-03-30 11:17 ` Jens Axboe
@ 2011-04-04 21:12 ` Alex Elder
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Elder @ 2011-04-04 21:12 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: jaxboe, xfs

On Wed, 2011-03-30 at 07:05 -0400, Christoph Hellwig wrote:
> 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>

Looks good.

Reviewed-by: Alex Elder <aelder@sgi.com>



_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-04-04 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-30 11:05 [PATCH] xfs: use proper interfaces for on-stack plugging Christoph Hellwig
2011-03-30 11:17 ` Jens Axboe
2011-04-04 21:12 ` Alex Elder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox