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-devel

[Xen-devel] [PATCH] remove use of get_gendisk in blkfront

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] remove use of get_gendisk in blkfront
From: Xiaofeng Ling <xiaofeng.ling@xxxxxxxxx>
Date: Fri, 02 Sep 2005 16:28:29 +0800
Delivery-date: Fri, 02 Sep 2005 08:32:58 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510
remove use of get_gendisk in blkfront
gen_gendisk is no long exported by 2.6 kernel. this patch remove the call of get_gendisk by saving the gd point in blkfront_info in vbd.c so that blkfront can be built as kerenl module.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@xxxxxxxxx>

diff -r 864434653dab linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
@@ -660,6 +651,7 @@
        info->vdevice = vdevice;
        info->connected = BLKIF_STATE_DISCONNECTED;
        info->mi = NULL;
+       info->gd = NULL;
        INIT_WORK(&info->work, blkif_restart_queue, (void *)info);
 
        info->shadow_free = 0;
diff -r 864434653dab linux-2.6-xen-sparse/drivers/xen/blkfront/block.h
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h 
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h
@@ -115,6 +115,7 @@
        /* We watch the backend */
        struct xenbus_watch watch;
        dev_t dev;
+       struct gendisk *gd;
        int vdevice;
        blkif_vdev_t handle;
        int connected;
diff -r 864434653dab linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
@@ -266,6 +257,7 @@
                gd->flags |= GENHD_FL_CD;
 
        add_disk(gd);
+       info->gd = gd;
 
        return 0;
 
@@ -298,23 +290,19 @@
 void
 xlvbd_del(struct blkfront_info *info)
 {
-       struct block_device *bd;
        struct gendisk *gd;
        int unused;
        request_queue_t *rq;
 
-       bd = bdget(info->dev);
-       if (bd == NULL)
+       gd = info->gd;
+       if (gd == NULL)
                return;
 
-       gd = get_gendisk(info->dev, &unused);
        rq = gd->queue;
-
        del_gendisk(gd);
        put_disk(gd);
        xlbd_put_major_info(info->mi);
        info->mi = NULL;
        blk_cleanup_queue(rq);
 
-       bdput(bd);
-}
+}
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] remove use of get_gendisk in blkfront, Xiaofeng Ling <=