From: Jeremy Katz Subject: Re: [PATCH] remove use of get_gendisk in blkfront Date: Tue, 08 Nov 2005 22:53:42 -0500 Message-ID: <1131508423.3533.41.camel@bree.local.net> References: <43180D2D.8000503@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-uh2ZJRhOKPgSY5GQXW8Q" Return-path: In-Reply-To: <43180D2D.8000503@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" Cc: Ian Pratt List-Id: xen-devel@lists.xenproject.org --=-uh2ZJRhOKPgSY5GQXW8Q Content-Type: text/plain Content-Transfer-Encoding: 7bit On Fri, 2005-09-02 at 16:28 +0800, Xiaofeng Ling wrote: > 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 This looks correct to me and helps in building blkfront as a module. Any chance of getting it committed? I've gone ahead and rediffed against the current tip and cleaned up the warnings. Attached here. Signed-off-by: Jeremy Katz Jeremy --=-uh2ZJRhOKPgSY5GQXW8Q Content-Disposition: attachment; filename=xen-get-gendisk.patch Content-Type: text/x-patch; name=xen-get-gendisk.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit diff -r abbe3df33774 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Tue Nov 8 17:39:58 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Tue Nov 8 22:49:53 2005 @@ -641,6 +641,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 abbe3df33774 linux-2.6-xen-sparse/drivers/xen/blkfront/block.h --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Tue Nov 8 17:39:58 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/block.h Tue Nov 8 22:49:53 2005 @@ -116,6 +116,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 abbe3df33774 linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c Tue Nov 8 17:39:58 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c Tue Nov 8 22:49:53 2005 @@ -259,6 +259,7 @@ gd->flags |= GENHD_FL_CD; add_disk(gd); + info->gd = gd; return 0; @@ -292,22 +293,19 @@ 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) return; - gd = get_gendisk(info->dev, &unused); - rq = gd->queue; - - del_gendisk(gd); - put_disk(gd); + if (info->gd == NULL) + return; + + del_gendisk(info->gd); + put_disk(info->gd); xlbd_put_major_info(info->mi); info->mi = NULL; - blk_cleanup_queue(rq); + blk_cleanup_queue(info->rq); bdput(bd); } --=-uh2ZJRhOKPgSY5GQXW8Q Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-uh2ZJRhOKPgSY5GQXW8Q--