WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Fix the blkif_schedule() kthread loop. Much simpler; mu

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Fix the blkif_schedule() kthread loop. Much simpler; much more correct.
From: Xen patchbot -3.0-testing <patchbot-3.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 06 Apr 2006 12:36:17 +0000
Delivery-date: Thu, 06 Apr 2006 05:37:19 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 6908c5236e5d7d48ffee00d40887d5be519f01f5
# Parent  8cb9c4eb41bacd90967d0d167ad9a7ad16d0309b
Fix the blkif_schedule() kthread loop. Much simpler; much more correct.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 8cb9c4eb41ba -r 6908c5236e5d 
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Thu Apr  6 
08:48:51 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Thu Apr  6 
09:21:04 2006
@@ -215,49 +215,20 @@
 
 int blkif_schedule(void *arg)
 {
-       blkif_t          *blkif = arg;
+       blkif_t *blkif = arg;
 
        blkif_get(blkif);
+
        if (debug_lvl)
                printk(KERN_DEBUG "%s: started\n", current->comm);
-       for (;;) {
-               if (kthread_should_stop()) {
-                       /* asked to quit? */
-                       if (!atomic_read(&blkif->io_pending))
-                               break;
-                       if (debug_lvl)
-                               printk(KERN_DEBUG "%s: I/O pending, "
-                                      "delaying exit\n", current->comm);
-               }
-
-               if (!atomic_read(&blkif->io_pending)) {
-                       /* Wait for work to do. */
-                       wait_event_interruptible(
-                               blkif->wq,
-                               (atomic_read(&blkif->io_pending) ||
-                                kthread_should_stop()));
-               } else if (list_empty(&pending_free)) {
-                       /* Wait for pending_req becoming available. */
-                       wait_event_interruptible(
-                               pending_free_wq,
-                               !list_empty(&pending_free));
-               }
-
-               if (blkif->status != CONNECTED) {
-                       /* make sure we are connected */
-                       if (debug_lvl)
-                               printk(KERN_DEBUG "%s: not connected "
-                                      "(%d pending)\n",
-                                      current->comm,
-                                      atomic_read(&blkif->io_pending));
-                       wait_event_interruptible(
-                               blkif->wq,
-                               (blkif->status == CONNECTED ||
-                                kthread_should_stop()));
-                       continue;
-               }
-
-               /* Schedule I/O */
+
+       while (!kthread_should_stop()) {
+               wait_event_interruptible(
+                       blkif->wq,
+                       (atomic_read(&blkif->io_pending) &&
+                        !list_empty(&pending_free)) ||
+                       kthread_should_stop());
+
                atomic_set(&blkif->io_pending, 0);
                if (do_block_io_op(blkif))
                        atomic_inc(&blkif->io_pending);
@@ -271,8 +242,10 @@
                print_stats(blkif);
        if (debug_lvl)
                printk(KERN_DEBUG "%s: exiting\n", current->comm);
+
        blkif->xenblkd = NULL;
        blkif_put(blkif);
+
        return 0;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>