[PATCH 2/3 V1] 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. Signed-off-by: Jianpeng Ma Signed-off-by: Jens Axboe --- block/blk-core.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 7a3abc6..034f186 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -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, >list, + queuelist) { + if (__rq->q == q) { + list_add(>queuelist, + &__rq->queuelist); + goto stat_acct; + } + } + trace_block_plug(q); } } list_add_tail(>queuelist, >list); +stat_acct: drive_stat_acct(req, 1); } else { spin_lock_irq(q->queue_lock); -- 1.7.9.5 N�Р骒r��yb�X�肚�v�^�)藓{.n�+�伐�{��赙zXФ�≤�}��财�z�:+v�����赙zZ+��+zf"�h���~i���z��wア�?�ㄨ��&�)撷f��^j谦y�m��@A�a囤� 0鹅h���i
[PATCH 2/3 V1] 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. Signed-off-by: Jianpeng Ma majianp...@gmail.com Signed-off-by: Jens Axboe ax...@kernel.dk --- block/blk-core.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index 7a3abc6..034f186 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -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); -- 1.7.9.5 N�Р骒r��yb�X�肚�v�^�)藓{.n�+�伐�{��赙zXФ�≤�}��财�z�j:+v�����赙zZ+��+zf"�h���~i���z��wア�?�ㄨ���)撷f��^j谦y�m��@A�a囤� 0鹅h���i