[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Clean up block-device hotplug routines in xenlinux.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 36cf47cfea4e3c0197db6b8822398da4a3f624b3
# Parent  68915c4893ee3184ca955b90e221dd8e69772a46
Clean up block-device hotplug routines in xenlinux.

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

diff -r 68915c4893ee -r 36cf47cfea4e 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Mar 13 
12:03:51 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Mar 13 
14:06:58 2006
@@ -352,11 +352,7 @@
 
        DPRINTK("blkfront_closing: %s removed\n", dev->nodename);
 
-       if (info->mi) {
-               DPRINTK("Calling xlvbd_del\n");
-               xlvbd_del(info);
-               info->mi = NULL;
-       }
+       xlvbd_del(info);
 
        xenbus_switch_state(dev, XBT_NULL, XenbusStateClosed);
 }
diff -r 68915c4893ee -r 36cf47cfea4e 
linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Mon Mar 13 12:03:51 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c   Mon Mar 13 14:06:58 2006
@@ -216,6 +216,10 @@
        int nr_minors = 1;
        int err = -ENODEV;
 
+       BUG_ON(info->gd != NULL);
+       BUG_ON(info->mi != NULL);
+       BUG_ON(info->rq != NULL);
+
        mi = xlbd_get_major_info(vdevice);
        if (mi == NULL)
                goto out;
@@ -268,6 +272,7 @@
  out:
        if (mi)
                xlbd_put_major_info(mi);
+       info->mi = NULL;
        return err;
 }
 
@@ -294,22 +299,20 @@
 void
 xlvbd_del(struct blkfront_info *info)
 {
-       struct block_device *bd;
-
-       bd = bdget(info->dev);
-       if (bd == NULL)
+       if (info->mi == NULL)
                return;
 
-       if (info->gd == NULL)
-               return;
-
+       BUG_ON(info->gd == NULL);
        del_gendisk(info->gd);
        put_disk(info->gd);
+       info->gd = NULL;
+
        xlbd_put_major_info(info->mi);
        info->mi = NULL;
+
+       BUG_ON(info->rq == NULL);
        blk_cleanup_queue(info->rq);
-
-       bdput(bd);
+       info->rq = NULL;
 }
 
 /*

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.