]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
block: stack unplug
authorShaohua Li <shli@kernel.org>
Thu, 19 Jul 2012 10:49:56 +0000 (20:49 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 19 Jul 2012 10:49:56 +0000 (20:49 +1000)
MD raid1 prepares to dispatch request in unplug callback. If make_request in
low level queue also uses unplug callback to dispatch request, the low level
queue's unplug callback will not be called. Recheck the callback list helps
this case.

Signed-off-by: Shaohua Li <shli@fusionio.com>
Signed-off-by: NeilBrown <neilb@suse.de>
block/blk-core.c

index 7296d3d8dca30a290e2ebc5872969091878169ef..bf38a5b7dd0e575ea60bd774368727e300b96c09 100644 (file)
@@ -2900,17 +2900,16 @@ static void flush_plug_callbacks(struct blk_plug *plug)
 {
        LIST_HEAD(callbacks);
 
-       if (list_empty(&plug->cb_list))
-               return;
-
-       list_splice_init(&plug->cb_list, &callbacks);
+       while (!list_empty(&plug->cb_list)) {
+               list_splice_init(&plug->cb_list, &callbacks);
 
-       while (!list_empty(&callbacks)) {
-               struct blk_plug_cb *cb = list_first_entry(&callbacks,
+               while (!list_empty(&callbacks)) {
+                       struct blk_plug_cb *cb = list_first_entry(&callbacks,
                                                          struct blk_plug_cb,
                                                          list);
-               list_del(&cb->list);
-               cb->callback(cb);
+                       list_del(&cb->list);
+                       cb->callback(cb);
+               }
        }
 }