Skip to contentSkip to conversation

block: Fix not tracing all device plug-operation.

PATCH In review Jianpeng Ma 2 participants 3 messages Aug 10, 2012 – Sep 15, 2012 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 block: Fix not tracing all device plug-operation.

If process handled two or more devices,there will not be trace some devices plug-operation.

---
 block/blk-core.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
block/blk-core.c +15 -1
index 7a3abc6..034f186 100644
@@ -1521,11 +1521,25 @@ get_rq:
 				struct request *__rq;
 
 				__rq = list_entry_rq(plug->list.prev);
-				if (__rq->q != q)
+				if (__rq->q != q) {
 					plug->should_sort = 1;
+					trace_block_plug(q);
+				}
+			} else {
+				struct request *__rq;
+				list_for_each_entry_reverse(__rq, &plug->list,
+					queuelist) {
+					if (__rq->q == q) {
+						list_add_tail(&req->queuelist,
+							&__rq->queuelist);
+						goto stat_acct;
+					}
+				}
+				trace_block_plug(q);
 			}
 		}
 		list_add_tail(&req->queuelist, &plug->list);
+stat_acct:
 		drive_stat_acct(req, 1);
 	} else {
 		spin_lock_irq(q->queue_lock);
Signature · 2 lines
1.7.9.5
�翳簕.n�+壏煯壄�+%娝�遍荻w�簕.n�+壏{炳G珴�妠ay�蕠跈�,jf"穐殢飦�戧鐉_璁(殠娸"濟�m���G珴�⒏?櫒璀�&x忈秈O曟瑉窔v豝�m����鹅�⒏?朓�
#1 lore raw
Quoted 19 lines · Jianpeng Ma

If process handled two or more devices,there will not be trace some devices plug-operation.

---
 block/blk-core.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
block/blk-core.c +1 -1
index 7a3abc6..034f186 100644
@@ -1521,11 +1521,25 @@ get_rq:
 				struct request *__rq;
 
 				__rq = list_entry_rq(plug->list.prev);
-				if (__rq->q != q)
+				if (__rq->q != q) {
 					plug->should_sort = 1;

block/blk-core.c get_rq: · line 1535

Quoted 10 lines
block/blk-core.c +10 -0
+					trace_block_plug(q);
+				}
+			} else {
+				struct request *__rq;
+				list_for_each_entry_reverse(__rq, &plug->list,
+					queuelist) {
+					if (__rq->q == q) {
+						list_add_tail(&req->queuelist,
+							&__rq->queuelist);
+						goto stat_acct;

Did you verify this? It doesn't look right to me. You browse the list in reverse, which means __rq is the first one that has a matching q. Then you add the new req IN FRONT of that. You would want list_add() here instead, adding it as the last member of that q string, not in the middle.

Signature · 1 line
Jens Axboe
#2 lore raw

On 2012-08-10 21:09 Jens Axboe <[email protected]> Wrote:

Quoted 28 lines · Jianpeng Ma
Quoted 27 lines

If process handled two or more devices,there will not be trace some devices plug-operation.

---
 block/blk-core.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
block/blk-core.c +9 -1
index 7a3abc6..034f186 100644
@@ -1521,11 +1521,25 @@ get_rq:
 				struct request *__rq;
 
 				__rq = list_entry_rq(plug->list.prev);
-				if (__rq->q != q)
+				if (__rq->q != q) {
 					plug->should_sort = 1;
+					trace_block_plug(q);
+				}
+			} else {
+				struct request *__rq;
+				list_for_each_entry_reverse(__rq, &plug->list,
+					queuelist) {
+					if (__rq->q == q) {
+						list_add_tail(&req->queuelist,
Quoted 12 lines

block/blk-core.c get_rq: · line 1535

Quoted 2 lines
block/blk-core.c +2 -0
+							&__rq->queuelist);
+						goto stat_acct;

Did you verify this? It doesn't look right to me. You browse the list in reverse, which means __rq is the first one that has a matching q. Then you add the new req IN FRONT of that. You would want list_add() here instead, adding it as the last member of that q string, not in the middle.

Signature · 1 line
Jens Axboe

Hi all:
How about those patches? Ok or wrong?
Thanks!�翳簕.n�+壏煯壄�+%娝�遍荻w�簕.n�+壏{炳G珴�妠ay�蕠跈�,jf"穐殢飦�戧鐉_璁(殠娸"濟�m���G珴�⒏?櫒璀�&x忈秈O曟瑉窔v豝�m��� �鹅�⒏?朓�