Commit 9d645820 authored by K. Y. Srinivasan's avatar K. Y. Srinivasan Committed by Greg Kroah-Hartman

Staging: hv: Get rid of the forward declaration of blkvsc_do_flush()

Get rid of the forward declaration of blkvsc_do_flush() by moving the code
around.
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarAbhishek Kane <v-abkane@microsoft.com>
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 795d30bb
...@@ -457,6 +457,41 @@ static void blkvsc_cmd_completion(struct hv_storvsc_request *request) ...@@ -457,6 +457,41 @@ static void blkvsc_cmd_completion(struct hv_storvsc_request *request)
complete(&blkvsc_req->request.wait_event); complete(&blkvsc_req->request.wait_event);
} }
static int blkvsc_do_flush(struct block_device_context *blkdev)
{
struct blkvsc_request *blkvsc_req;
DPRINT_DBG(BLKVSC_DRV, "blkvsc_do_flush()\n");
if (blkdev->device_type != HARDDISK_TYPE)
return 0;
blkvsc_req = kmem_cache_zalloc(blkdev->request_pool, GFP_KERNEL);
if (!blkvsc_req)
return -ENOMEM;
memset(blkvsc_req, 0, sizeof(struct blkvsc_request));
init_completion(&blkvsc_req->request.wait_event);
blkvsc_req->dev = blkdev;
blkvsc_req->req = NULL;
blkvsc_req->write = 0;
blkvsc_req->request.data_buffer.pfn_array[0] = 0;
blkvsc_req->request.data_buffer.offset = 0;
blkvsc_req->request.data_buffer.len = 0;
blkvsc_req->cmnd[0] = SYNCHRONIZE_CACHE;
blkvsc_req->cmd_len = 10;
blkvsc_submit_request(blkvsc_req, blkvsc_cmd_completion);
wait_for_completion_interruptible(&blkvsc_req->request.wait_event);
kmem_cache_free(blkvsc_req->dev->request_pool, blkvsc_req);
return 0;
}
/* Static decl */ /* Static decl */
static int blkvsc_probe(struct device *dev); static int blkvsc_probe(struct device *dev);
...@@ -472,7 +507,6 @@ static int blkvsc_do_request(struct block_device_context *blkdev, ...@@ -472,7 +507,6 @@ static int blkvsc_do_request(struct block_device_context *blkdev,
static int blkvsc_do_inquiry(struct block_device_context *blkdev); static int blkvsc_do_inquiry(struct block_device_context *blkdev);
static int blkvsc_do_read_capacity(struct block_device_context *blkdev); static int blkvsc_do_read_capacity(struct block_device_context *blkdev);
static int blkvsc_do_read_capacity16(struct block_device_context *blkdev); static int blkvsc_do_read_capacity16(struct block_device_context *blkdev);
static int blkvsc_do_flush(struct block_device_context *blkdev);
static int blkvsc_cancel_pending_reqs(struct block_device_context *blkdev); static int blkvsc_cancel_pending_reqs(struct block_device_context *blkdev);
static int blkvsc_do_pending_reqs(struct block_device_context *blkdev); static int blkvsc_do_pending_reqs(struct block_device_context *blkdev);
...@@ -762,41 +796,6 @@ static void blkvsc_shutdown(struct device *device) ...@@ -762,41 +796,6 @@ static void blkvsc_shutdown(struct device *device)
spin_unlock_irqrestore(&blkdev->lock, flags); spin_unlock_irqrestore(&blkdev->lock, flags);
} }
static int blkvsc_do_flush(struct block_device_context *blkdev)
{
struct blkvsc_request *blkvsc_req;
DPRINT_DBG(BLKVSC_DRV, "blkvsc_do_flush()\n");
if (blkdev->device_type != HARDDISK_TYPE)
return 0;
blkvsc_req = kmem_cache_zalloc(blkdev->request_pool, GFP_KERNEL);
if (!blkvsc_req)
return -ENOMEM;
memset(blkvsc_req, 0, sizeof(struct blkvsc_request));
init_completion(&blkvsc_req->request.wait_event);
blkvsc_req->dev = blkdev;
blkvsc_req->req = NULL;
blkvsc_req->write = 0;
blkvsc_req->request.data_buffer.pfn_array[0] = 0;
blkvsc_req->request.data_buffer.offset = 0;
blkvsc_req->request.data_buffer.len = 0;
blkvsc_req->cmnd[0] = SYNCHRONIZE_CACHE;
blkvsc_req->cmd_len = 10;
blkvsc_submit_request(blkvsc_req, blkvsc_cmd_completion);
wait_for_completion_interruptible(&blkvsc_req->request.wait_event);
kmem_cache_free(blkvsc_req->dev->request_pool, blkvsc_req);
return 0;
}
/* Do a scsi INQUIRY cmd here to get the device type (ie disk or dvd) */ /* Do a scsi INQUIRY cmd here to get the device type (ie disk or dvd) */
static int blkvsc_do_inquiry(struct block_device_context *blkdev) static int blkvsc_do_inquiry(struct block_device_context *blkdev)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment