/* Handle the change of state of the backend to Closing. We must delete our device-layer structures now, to ensure that writes are flushed through to the backend. Once is this done, we can switch to Closed in acknowledgement.  */
static void blkfront_closing(struct xenbus_device *dev)
/* Handle the change of state of the backend to Closing. We must delete our device-layer structures now, to ensure that writes are flushed through to the backend. Once is this done, we can switch to Closed in acknowledgement.  */
static void blkfront_closing(struct xenbus_device *dev)
{
	struct blkfront_info *info = dev_get_drvdata(&dev->dev);
	unsigned long flags;
	dev_dbg(&dev->dev, "blkfront_closing: %s removed\n", dev->nodename);
	if (info->rq == NULL)
		goto out;
	spin_lock_irqsave(&blkif_io_lock, flags);
	blk_stop_queue(info->rq);
	gnttab_cancel_free_callback(&info->callback);
	spin_unlock_irqrestore(&blkif_io_lock, flags);
	flush_scheduled_work();
	blk_cleanup_queue(info->rq);
	info->rq = NULL;
	del_gendisk(info->gd);
 out:
	xenbus_frontend_closed(dev);
}