Skip to contentSkip to conversation

block: Fix not tracing all device plug-operation.

PATCH New Jianpeng Ma 1 participant 1 message Aug 11, 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.

V0-->V1
Fix a bug when insert a req to plug-list which already had the same request-queue, it should used list_add not list_add_tail.

---
 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(&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����鹅�⒏?朓�