direct-io.hg

changeset 7709:6b62605e77b5

Remove use of get_gendisk in blkfront gen_gendisk is no long exported
by 2.6 kernel. Now blkfront can be built as a kernel module.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
Signed-off-by: Jeremy Katz <katzj@redhat.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Nov 09 14:41:14 2005 +0100 (2005-11-09)
parents 356c175366a1
children 83ec10103067
files linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/blkfront/block.h linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Nov 09 14:39:32 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Nov 09 14:41:14 2005 +0100
     1.3 @@ -641,6 +641,7 @@ static int blkfront_probe(struct xenbus_
     1.4  	info->vdevice = vdevice;
     1.5  	info->connected = BLKIF_STATE_DISCONNECTED;
     1.6  	info->mi = NULL;
     1.7 + 	info->gd = NULL;
     1.8  	INIT_WORK(&info->work, blkif_restart_queue, (void *)info);
     1.9  
    1.10  	info->shadow_free = 0;
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h	Wed Nov 09 14:39:32 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h	Wed Nov 09 14:41:14 2005 +0100
     2.3 @@ -116,6 +116,7 @@ struct blkfront_info
     2.4  	/* We watch the backend */
     2.5  	struct xenbus_watch watch;
     2.6  	dev_t dev;
     2.7 + 	struct gendisk *gd;
     2.8  	int vdevice;
     2.9  	blkif_vdev_t handle;
    2.10  	int connected;
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Wed Nov 09 14:39:32 2005 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Wed Nov 09 14:41:14 2005 +0100
     3.3 @@ -259,6 +259,7 @@ xlvbd_alloc_gendisk(int minor, blkif_sec
     3.4  		gd->flags |= GENHD_FL_CD;
     3.5  
     3.6  	add_disk(gd);
     3.7 +	info->gd = gd;
     3.8  
     3.9  	return 0;
    3.10  
    3.11 @@ -292,22 +293,19 @@ void
    3.12  xlvbd_del(struct blkfront_info *info)
    3.13  {
    3.14  	struct block_device *bd;
    3.15 -	struct gendisk *gd;
    3.16 -	int unused;
    3.17 -	request_queue_t *rq;
    3.18  
    3.19  	bd = bdget(info->dev);
    3.20  	if (bd == NULL)
    3.21  		return;
    3.22  
    3.23 -	gd = get_gendisk(info->dev, &unused);
    3.24 -	rq = gd->queue;
    3.25 +	if (info->gd == NULL)
    3.26 +		return;
    3.27  
    3.28 -	del_gendisk(gd);
    3.29 -	put_disk(gd);
    3.30 +	del_gendisk(info->gd);
    3.31 +	put_disk(info->gd);
    3.32  	xlbd_put_major_info(info->mi);
    3.33  	info->mi = NULL;
    3.34 -	blk_cleanup_queue(rq);
    3.35 +	blk_cleanup_queue(info->rq);
    3.36  
    3.37  	bdput(bd);
    3.38  }