linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: Remove should_sort judgement when flush blk_plug.
@ 2012-12-25  9:27 majianpeng
  2012-12-26 20:43 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2012-12-25  9:27 UTC (permalink / raw)
  To: axboe; +Cc: Shaohua Li, linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 2301 bytes --]

In commit 975927b942c932,it add blk_rq_pos to sort rq when flushing.
Although this commit was used for the situation which blk_plug handled
multi devices on the same time like md device.
I think there must be some situations like this but only single
device.
So remove the should_sort judgement.
Because the parameter should_sort is only for this purpose,it can delete
should_sort from blk_plug.

CC: Shaohua Li <shli@kernel.org>
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>
---
 block/blk-core.c       |   13 +------------
 include/linux/blkdev.h |    1 -
 2 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index c973249..aca5d82 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1548,13 +1548,6 @@ get_rq:
 		if (list_empty(&plug->list))
 			trace_block_plug(q);
 		else {
-			if (!plug->should_sort) {
-				struct request *__rq;
-
-				__rq = list_entry_rq(plug->list.prev);
-				if (__rq->q != q)
-					plug->should_sort = 1;
-			}
 			if (request_count >= BLK_MAX_REQUEST_COUNT) {
 				blk_flush_plug_list(plug, false);
 				trace_block_plug(q);
@@ -2888,7 +2881,6 @@ void blk_start_plug(struct blk_plug *plug)
 	plug->magic = PLUG_MAGIC;
 	INIT_LIST_HEAD(&plug->list);
 	INIT_LIST_HEAD(&plug->cb_list);
-	plug->should_sort = 0;
 
 	/*
 	 * If this is a nested plug, don't actually assign it. It will be
@@ -2990,10 +2982,7 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 
 	list_splice_init(&plug->list, &list);
 
-	if (plug->should_sort) {
-		list_sort(NULL, &list, plug_rq_cmp);
-		plug->should_sort = 0;
-	}
+	list_sort(NULL, &list, plug_rq_cmp);
 
 	q = NULL;
 	depth = 0;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index f94bc83..dbe7427 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -974,7 +974,6 @@ struct blk_plug {
 	unsigned long magic; /* detect uninitialized use-cases */
 	struct list_head list; /* requests */
 	struct list_head cb_list; /* md requires an unplug callback */
-	unsigned int should_sort; /* list to be sorted before flushing? */
 };
 #define BLK_MAX_REQUEST_COUNT 16
 
-- 
1.7.9.5
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH] block: Remove should_sort judgement when flush blk_plug.
  2012-12-25  9:27 [PATCH] block: Remove should_sort judgement when flush blk_plug majianpeng
@ 2012-12-26 20:43 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2012-12-26 20:43 UTC (permalink / raw)
  To: majianpeng; +Cc: Shaohua Li, linux-kernel

On 2012-12-25 10:27, majianpeng wrote:
> In commit 975927b942c932,it add blk_rq_pos to sort rq when flushing.
> Although this commit was used for the situation which blk_plug handled
> multi devices on the same time like md device.
> I think there must be some situations like this but only single
> device.
> So remove the should_sort judgement.
> Because the parameter should_sort is only for this purpose,it can delete
> should_sort from blk_plug.

Agree with the patch. It does not make sense to have ->should_sort and
not set it for all the conditions that the list_sort() compare now
checks for.

Applied for 3.9, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2012-12-26 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-25  9:27 [PATCH] block: Remove should_sort judgement when flush blk_plug majianpeng
2012-12-26 20:43 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).