Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249112
b: refs/heads/master
c: 8c09004
h: refs/heads/master
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Apr 25, 2011
1 parent e68e4e7 commit 80317a7
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 66 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f60f2138a9423432063df0d07dfadbf3decb29ac
refs/heads/master: 8c090044683fd5ddf8565438535d88bb9f3ecff1
130 changes: 65 additions & 65 deletions trunk/drivers/staging/hv/blkvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,73 @@ static int blkvsc_cancel_pending_reqs(struct block_device_context *blkdev)
return ret;
}


/*
* blkvsc_remove() - Callback when our device is removed
*/
static int blkvsc_remove(struct device *device)
{
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct storvsc_driver_object *storvsc_drv_obj =
drv->priv;
struct hv_device *device_obj = device_to_hv_device(device);
struct block_device_context *blkdev = dev_get_drvdata(device);
unsigned long flags;
int ret;

DPRINT_DBG(BLKVSC_DRV, "blkvsc_remove()\n");

if (!storvsc_drv_obj->base.dev_rm)
return -1;

/*
* Call to the vsc driver to let it know that the device is being
* removed
*/
ret = storvsc_drv_obj->base.dev_rm(device_obj);
if (ret != 0) {
/* TODO: */
DPRINT_ERR(BLKVSC_DRV,
"unable to remove blkvsc device (ret %d)", ret);
}

/* Get to a known state */
spin_lock_irqsave(&blkdev->lock, flags);

blkdev->shutting_down = 1;

blk_stop_queue(blkdev->gd->queue);

spin_unlock_irqrestore(&blkdev->lock, flags);

while (blkdev->num_outstanding_reqs) {
DPRINT_INFO(STORVSC, "waiting for %d requests to complete...",
blkdev->num_outstanding_reqs);
udelay(100);
}

blkvsc_do_flush(blkdev);

spin_lock_irqsave(&blkdev->lock, flags);

blkvsc_cancel_pending_reqs(blkdev);

spin_unlock_irqrestore(&blkdev->lock, flags);

blk_cleanup_queue(blkdev->gd->queue);

del_gendisk(blkdev->gd);

kmem_cache_destroy(blkdev->request_pool);

kfree(blkdev);

return ret;
}

/* Static decl */
static int blkvsc_probe(struct device *dev);
static int blkvsc_remove(struct device *device);
static void blkvsc_shutdown(struct device *device);

static int blkvsc_release(struct gendisk *disk, fmode_t mode);
Expand Down Expand Up @@ -1110,70 +1174,6 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
return 0;
}

/*
* blkvsc_remove() - Callback when our device is removed
*/
static int blkvsc_remove(struct device *device)
{
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct storvsc_driver_object *storvsc_drv_obj =
drv->priv;
struct hv_device *device_obj = device_to_hv_device(device);
struct block_device_context *blkdev = dev_get_drvdata(device);
unsigned long flags;
int ret;

DPRINT_DBG(BLKVSC_DRV, "blkvsc_remove()\n");

if (!storvsc_drv_obj->base.dev_rm)
return -1;

/*
* Call to the vsc driver to let it know that the device is being
* removed
*/
ret = storvsc_drv_obj->base.dev_rm(device_obj);
if (ret != 0) {
/* TODO: */
DPRINT_ERR(BLKVSC_DRV,
"unable to remove blkvsc device (ret %d)", ret);
}

/* Get to a known state */
spin_lock_irqsave(&blkdev->lock, flags);

blkdev->shutting_down = 1;

blk_stop_queue(blkdev->gd->queue);

spin_unlock_irqrestore(&blkdev->lock, flags);

while (blkdev->num_outstanding_reqs) {
DPRINT_INFO(STORVSC, "waiting for %d requests to complete...",
blkdev->num_outstanding_reqs);
udelay(100);
}

blkvsc_do_flush(blkdev);

spin_lock_irqsave(&blkdev->lock, flags);

blkvsc_cancel_pending_reqs(blkdev);

spin_unlock_irqrestore(&blkdev->lock, flags);

blk_cleanup_queue(blkdev->gd->queue);

del_gendisk(blkdev->gd);

kmem_cache_destroy(blkdev->request_pool);

kfree(blkdev);

return ret;
}

/*
* We break the request into 1 or more blkvsc_requests and submit
* them. If we can't submit them all, we put them on the
Expand Down

0 comments on commit 80317a7

Please sign in to comment.