From: "K. Y. Srinivasan" <kys@microsoft.com> Date: 2011-03-23 17:38:44
This is first in a series of patch-sets aimed at cleaning up the storage
drivers for Hyper-V. Before I get into the details of this patch-set, I think
it is useful to give a brief overview of the storage related front-end
drivers currently in the tree for Linux on Hyper-V:
On the host side, Windows emulates the standard PC hardware
to permit hosting of fully virtualized operating systems.
To enhance disk I/O performance, we support a virtual block driver.
This block driver currently handles disks that have been setup as IDE
disks for the guest - as specified in the guest configuration.
On the SCSI side, we emulate a SCSI HBA. Devices configured
under the SCSI controller for the guest are handled via this
emulated HBA (SCSI front-end). So, SCSI disks configured for
the guest are handled through native SCSI upper-level drivers.
If this SCSI front-end driver is not loaded, currently, the guest
cannot see devices that have been configured as SCSI devices.
So, while the virtual block driver described earlier could potentially
handle all block devices, the implementation choices made on the host
may not permit it. Also, the only SCSI device that can be currently
configured for the guest is a disk device.
Both the block device driver (hv_blkvsc) and the SCSI front-end
driver (hv_storvsc) communicate with the host via unique channels
that are implemented as bi-directional ring-buffers. Each
(storage) channel carries with it enough state to uniquely
identify the device on the host side. Microsoft has chosen to
use SCSI verbs for this storage channel communication.
In this patch-set I have addressed the following issues in the Hyper-V
storage drivers (virtual block and SCSI front-end):
1) Get rid of the inclusion of storvsc.c from blockvsc.c
2) Cleanup storvsc.c
3) Get rid of the file blkvsc.c
4) Cleanup the initialization sequence for both block and
SCSI front-end drivers.
Regards,
K. Y
From: "K. Y. Srinivasan" <kys@microsoft.com> Date: 2011-03-23 17:40:17
In preparation for getting rid of the inclusion of storvsc.c from
blkvsc.c, add inclusion guard to vstorage.h
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/vstorage.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
@@ -25,6 +25,9 @@/* to alert the user that structure sizes may be mismatched even though the *//* protocol versions match. */+#ifndef _VSTORAGE_H_+#define _VSTORAGE_H_+#define REVISION_STRING(REVISION_) #REVISION_#define FILL_VMSTOR_REVISION(RESULT_LVALUE_) \do{\
@@ -190,3 +193,5 @@ struct vstor_packet {/* This is the set of flags that the vsc can set in any packets it sends */#define VSC_LEGAL_FLAGS (REQUEST_COMPLETION_FLAG)++#endif /* _VSTORAGE_H_ */
From: "K. Y. Srinivasan" <kys@microsoft.com> Date: 2011-03-23 17:40:36
In preparation for getting rid of the inclusion of storvsc.c from
blkvsc.c, move the definition of struct storvsc_request_extension
from storvsc.c to storvsc_api.h.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/blkvsc.c | 1 +
drivers/staging/hv/storvsc.c | 13 -------------
drivers/staging/hv/storvsc_api.h | 12 ++++++++++++
3 files changed, 13 insertions(+), 13 deletions(-)
@@ -33,19 +33,6 @@#include"channel.h"-structstorvsc_request_extension{-/* LIST_ENTRY ListEntry; */--structhv_storvsc_request*request;-structhv_device*device;--/* Synchronize the request/response if needed */-intwait_condition;-wait_queue_head_twait_event;--structvstor_packetvstor_packet;-};-/* A storvsc device is a device object that contains a vmbus channel */structstorvsc_device{structhv_device*device;
From: "K. Y. Srinivasan" <kys@microsoft.com> Date: 2011-03-23 17:40:43
Since stor_vsc_initialize() is only used in storvs_drv.c, move this
function to storvsc_drv.c.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/storvsc.c | 64 --------------------------------------
drivers/staging/hv/storvsc_drv.c | 63 +++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 64 deletions(-)
@@ -711,55 +699,3 @@ void stor_vsc_on_cleanup(struct hv_driver *driver){}-/*-*stor_vsc_initialize-Mainentrypoint-*/-intstor_vsc_initialize(structhv_driver*driver)-{-structstorvsc_driver_object*stor_driver;--stor_driver=(structstorvsc_driver_object*)driver;--DPRINT_DBG(STORVSC,"sizeof(STORVSC_REQUEST)=%zd "-"sizeof(struct storvsc_request_extension)=%zd "-"sizeof(struct vstor_packet)=%zd, "-"sizeof(struct vmscsi_request)=%zd",-sizeof(structhv_storvsc_request),-sizeof(structstorvsc_request_extension),-sizeof(structvstor_packet),-sizeof(structvmscsi_request));--/* Make sure we are at least 2 pages since 1 page is used for control */--driver->name=g_driver_name;-memcpy(&driver->dev_type,&gStorVscDeviceType,-sizeof(structhv_guid));--stor_driver->request_ext_size=-sizeof(structstorvsc_request_extension);--/*-*Dividetheringbufferdatasize(whichis1pageless-*thantheringbuffersizesincethatpageisreservedfor-*theringbufferindices)bythemaxrequestsize(whichis-*vmbus_channel_packet_multipage_buffer+structvstor_packet+u64)-*/-stor_driver->max_outstanding_req_per_channel=-((stor_driver->ring_buffer_size-PAGE_SIZE)/-ALIGN(MAX_MULTIPAGE_BUFFER_PACKET+-sizeof(structvstor_packet)+sizeof(u64),-sizeof(u64)));--DPRINT_INFO(STORVSC,"max io %u, currently %u\n",-stor_driver->max_outstanding_req_per_channel,-STORVSC_MAX_IO_REQUESTS);--/* Setup the dispatch table */-stor_driver->base.dev_add=stor_vsc_on_device_add;-stor_driver->base.dev_rm=stor_vsc_on_device_remove;-stor_driver->base.cleanup=stor_vsc_on_cleanup;--stor_driver->on_io_request=stor_vsc_on_io_request;--return0;-}
@@ -38,6 +38,16 @@#include"storvsc_api.h"+staticconstchar*g_driver_name="storvsc";++/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */+staticconststructhv_guidgStorVscDeviceType={+.data={+0xd9,0x63,0x61,0xba,0xa1,0x04,0x29,0x4d,+0xb6,0x05,0x72,0xe2,0xff,0xb1,0xdc,0x7f+}+};+structhost_device_context{/* must be 1st field*FIXMEthisisabug*/
@@ -64,6 +74,59 @@ struct storvsc_cmd_request {};+/*+*stor_vsc_initialize-Mainentrypoint+*/+intstor_vsc_initialize(structhv_driver*driver)+{+structstorvsc_driver_object*stor_driver;++stor_driver=(structstorvsc_driver_object*)driver;++DPRINT_DBG(STORVSC,"sizeof(STORVSC_REQUEST)=%zd "+"sizeof(struct storvsc_request_extension)=%zd "+"sizeof(struct vstor_packet)=%zd, "+"sizeof(struct vmscsi_request)=%zd",+sizeof(structhv_storvsc_request),+sizeof(structstorvsc_request_extension),+sizeof(structvstor_packet),+sizeof(structvmscsi_request));++/* Make sure we are at least 2 pages since 1 page is used for control */++driver->name=g_driver_name;+memcpy(&driver->dev_type,&gStorVscDeviceType,+sizeof(structhv_guid));++stor_driver->request_ext_size=+sizeof(structstorvsc_request_extension);++/*+*Dividetheringbufferdatasize(whichis1pageless+*thantheringbuffersizesincethatpageisreservedfor+*theringbufferindices)bythemaxrequestsize(whichis+*vmbus_channel_packet_multipage_buffer+structvstor_packet+u64)+*/+stor_driver->max_outstanding_req_per_channel=+((stor_driver->ring_buffer_size-PAGE_SIZE)/+ALIGN(MAX_MULTIPAGE_BUFFER_PACKET++sizeof(structvstor_packet)+sizeof(u64),+sizeof(u64)));++DPRINT_INFO(STORVSC,"max io %u, currently %u\n",+stor_driver->max_outstanding_req_per_channel,+STORVSC_MAX_IO_REQUESTS);++/* Setup the dispatch table */+stor_driver->base.dev_add=stor_vsc_on_device_add;+stor_driver->base.dev_rm=stor_vsc_on_device_remove;+stor_driver->base.cleanup=stor_vsc_on_cleanup;++stor_driver->on_io_request=stor_vsc_on_io_request;++return0;+}+/* Static decl */staticintstorvsc_probe(structdevice*dev);staticintstorvsc_queuecommand(structScsi_Host*shost,structscsi_cmnd*scmnd);
From: "K. Y. Srinivasan" <kys@microsoft.com> Date: 2011-03-23 17:40:44
Now that all the structure definitions have been moved to a header file,
get rid of the inclusion of storvsc.c from blkvsc.c.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/Makefile | 2 +-
drivers/staging/hv/blkvsc.c | 2 +-
drivers/staging/hv/storvsc.c | 8 ++++----
drivers/staging/hv/storvsc_api.h | 9 +++++++++
4 files changed, 15 insertions(+), 6 deletions(-)
@@ -103,10 +102,8 @@ static inline void put_stor_device(struct hv_device *device)structstorvsc_device*stor_device;stor_device=(structstorvsc_device*)device->ext;-/* ASSERT(stor_device); */atomic_dec(&stor_device->ref_count);-/* ASSERT(atomic_read(&stor_device->ref_count)); */}/* Drop ref count to 1 to effectively disable get_stor_device() */
@@ -116,7 +113,6 @@ static inline struct storvsc_device *release_stor_device(structstorvsc_device*stor_device;stor_device=(structstorvsc_device*)device->ext;-/* ASSERT(stor_device); *//* Busy wait until the ref drop to 2, then set it to 1 */while(atomic_cmpxchg(&stor_device->ref_count,2,1)!=2)
@@ -132,7 +128,6 @@ static inline struct storvsc_device *final_release_stor_device(structstorvsc_device*stor_device;stor_device=(structstorvsc_device*)device->ext;-/* ASSERT(stor_device); *//* Busy wait until the ref drop to 1, then set it to 0 */while(atomic_cmpxchg(&stor_device->ref_count,1,0)!=1)
@@ -520,8 +497,6 @@ int stor_vsc_on_device_add(struct hv_device *device,}/* Save the channel properties to our storvsc channel */-/* props = (struct vmstorage_channel_properties *)-*channel->offerMsg.Offer.u.Standard.UserDefined;*//* FIXME: *//*
@@ -530,15 +505,10 @@ int stor_vsc_on_device_add(struct hv_device *device,*scsichannelpriortothebusscan*/-/* storChannel->PortNumber = 0;-storChannel->PathId=props->PathId;-storChannel->TargetId=props->TargetId;*/-stor_device->port_number=device_info->port_number;/* Send it back up */ret=stor_vsc_connect_to_vsp(device);-/* device_info->PortNumber = stor_device->PortNumber; */device_info->path_id=stor_device->path_id;device_info->target_id=stor_device->target_id;
@@ -762,7 +730,6 @@ int stor_vsc_initialize(struct hv_driver *driver)sizeof(structvmscsi_request));/* Make sure we are at least 2 pages since 1 page is used for control */-/* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */driver->name=g_driver_name;memcpy(&driver->dev_type,&gStorVscDeviceType,
From: "K. Y. Srinivasan" <kys@microsoft.com> Date: 2011-03-23 17:40:47
In preparation for getting rid of the inclusion of storvsc.c from
blkvsc.c, move the definition of struct storvsc_device
from storvsc.c to storvsc_api.h.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/storvsc.c | 26 --------------------------
drivers/staging/hv/storvsc_api.h | 26 ++++++++++++++++++++++++++
2 files changed, 26 insertions(+), 26 deletions(-)
@@ -33,32 +33,6 @@#include"channel.h"-/* A storvsc device is a device object that contains a vmbus channel */-structstorvsc_device{-structhv_device*device;--/* 0 indicates the device is being destroyed */-atomic_tref_count;--atomic_tnum_outstanding_req;--/*-*EachuniquePort/Path/Targetrepresents1channeliescsi-*controller.Inreality,thepathid,targetidisalways0-*andtheportissetbyus-*/-unsignedintport_number;-unsignedcharpath_id;-unsignedchartarget_id;--/* LIST_ENTRY OutstandingRequestList; */-/* HANDLE OutstandingRequestLock; */--/* Used for vsc/vsp channel reset process */-structstorvsc_request_extensioninit_request;-structstorvsc_request_extensionreset_request;-};-staticconstchar*g_driver_name="storvsc";
@@ -114,6 +114,32 @@ struct storvsc_request_extension {structvstor_packetvstor_packet;};+/* A storvsc device is a device object that contains a vmbus channel */+structstorvsc_device{+structhv_device*device;++/* 0 indicates the device is being destroyed */+atomic_tref_count;++atomic_tnum_outstanding_req;++/*+*EachuniquePort/Path/Targetrepresents1channeliescsi+*controller.Inreality,thepathid,targetidisalways0+*andtheportissetbyus+*/+unsignedintport_number;+unsignedcharpath_id;+unsignedchartarget_id;++/* LIST_ENTRY OutstandingRequestList; */+/* HANDLE OutstandingRequestLock; */++/* Used for vsc/vsp channel reset process */+structstorvsc_request_extensioninit_request;+structstorvsc_request_extensionreset_request;+};+/* Interface */intstor_vsc_initialize(structhv_driver*driver);intstor_vsc_on_host_reset(structhv_device*device);
@@ -200,7 +200,7 @@ static int storvsc_drv_init(int (*drv_init)(struct hv_driver *drv))storvsc_drv_obj->ring_buffer_size=storvsc_ringbuffer_size;/* Callback to client driver to complete the initialization */-drv_init(&storvsc_drv_obj->base);+stor_vsc_initialize(&storvsc_drv_obj->base);drv->priv=storvsc_drv_obj;
@@ -986,7 +986,7 @@ static int __init storvsc_init(void)intret;DPRINT_INFO(STORVSC_DRV,"Storvsc initializing....");-ret=storvsc_drv_init(stor_vsc_initialize);+ret=storvsc_drv_init();returnret;}
From: "K. Y. Srinivasan" <kys@microsoft.com> Date: 2011-03-23 17:40:49
In preparation for getting rid of the file blkvsc.c, move its contents
to the appropriate file.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/Makefile | 2 +-
drivers/staging/hv/blkvsc_drv.c | 79 +++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+), 1 deletions(-)
@@ -116,6 +116,85 @@ struct block_device_context {};+staticconstchar*g_blk_driver_name="blkvsc";++/* {32412632-86cb-44a2-9b5c-50d1417354f5} */+staticconststructhv_guidg_blk_device_type={+.data={+0x32,0x26,0x41,0x32,0xcb,0x86,0xa2,0x44,+0x9b,0x5c,0x50,0xd1,0x41,0x73,0x54,0xf5+}+};++staticintblk_vsc_on_device_add(structhv_device*device,+void*additional_info)+{+structstorvsc_device_info*device_info;+intret=0;++device_info=(structstorvsc_device_info*)additional_info;++ret=stor_vsc_on_device_add(device,additional_info);+if(ret!=0)+returnret;++/*+*Weneedtousethedeviceinstanceguidtosetthepathandtarget+*id.ForIDEdevices,thedeviceinstanceidisformattedas+*<busid>*-<deviceid>-8899-000000000000.+*/+device_info->path_id=device->dev_instance.data[3]<<24|+device->dev_instance.data[2]<<16|+device->dev_instance.data[1]<<8|+device->dev_instance.data[0];++device_info->target_id=device->dev_instance.data[5]<<8|+device->dev_instance.data[4];++returnret;+}+++intblk_vsc_initialize(structhv_driver*driver)+{+structstorvsc_driver_object*stor_driver;+intret=0;++stor_driver=(structstorvsc_driver_object*)driver;++/* Make sure we are at least 2 pages since 1 page is used for control */+/* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */++driver->name=g_blk_driver_name;+memcpy(&driver->dev_type,&g_blk_device_type,sizeof(structhv_guid));++stor_driver->request_ext_size=+sizeof(structstorvsc_request_extension);++/*+*Dividetheringbufferdatasize(whichis1pagelessthanthering+*buffersizesincethatpageisreservedfortheringbufferindices)+*bythemaxrequestsize(whichis+*vmbus_channel_packet_multipage_buffer+structvstor_packet+u64)+*/+stor_driver->max_outstanding_req_per_channel=+((stor_driver->ring_buffer_size-PAGE_SIZE)/+ALIGN(MAX_MULTIPAGE_BUFFER_PACKET++sizeof(structvstor_packet)+sizeof(u64),+sizeof(u64)));++DPRINT_INFO(BLKVSC,"max io outstd %u",+stor_driver->max_outstanding_req_per_channel);++/* Setup the dispatch table */+stor_driver->base.dev_add=blk_vsc_on_device_add;+stor_driver->base.dev_rm=stor_vsc_on_device_remove;+stor_driver->base.cleanup=stor_vsc_on_cleanup;+stor_driver->on_io_request=stor_vsc_on_io_request;++returnret;+}+/* Static decl */staticDEFINE_MUTEX(blkvsc_mutex);staticintblkvsc_probe(structdevice*dev);
@@ -254,7 +254,7 @@ static int blkvsc_drv_init(int (*drv_init)(struct hv_driver *drv))drv->priv=storvsc_drv_obj;/* Callback to client driver to complete the initialization */-drv_init(&storvsc_drv_obj->base);+blk_vsc_initialize(&storvsc_drv_obj->base);drv->driver.name=storvsc_drv_obj->base.name;
@@ -1552,7 +1552,7 @@ static int __init blkvsc_init(void)DPRINT_INFO(BLKVSC_DRV,"Blkvsc initializing....");-ret=blkvsc_drv_init(blk_vsc_initialize);+ret=blkvsc_drv_init();returnret;}
From: "K. Y. Srinivasan" <kys@microsoft.com> Date: 2011-03-23 17:42:37
In preparation for further cleaning up storvsc.c move the definition
of the inline function get_stor_device() from storvsc.c to
storvsc_api.h.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/storvsc.c | 14 --------------
drivers/staging/hv/storvsc_api.h | 15 +++++++++++++++
2 files changed, 15 insertions(+), 14 deletions(-)
@@ -56,20 +56,6 @@ static inline void free_stor_device(struct storvsc_device *device)kfree(device);}-/* Get the stordevice object iff exists and its refcount > 1 */-staticinlinestructstorvsc_device*get_stor_device(structhv_device*device)-{-structstorvsc_device*stor_device;--stor_device=(structstorvsc_device*)device->ext;-if(stor_device&&atomic_read(&stor_device->ref_count)>1)-atomic_inc(&stor_device->ref_count);-else-stor_device=NULL;--returnstor_device;-}-/* Get the stordevice object iff exists and its refcount > 0 */staticinlinestructstorvsc_device*must_get_stor_device(structhv_device*device)
@@ -1,103 +0,0 @@-/*- *- * Copyright (c) 2009, Microsoft Corporation.- *- * This program is free software; you can redistribute it and/or modify it- * under the terms and conditions of the GNU General Public License,- * version 2, as published by the Free Software Foundation.- *- * This program is distributed in the hope it will be useful, but WITHOUT- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for- * more details.- *- * You should have received a copy of the GNU General Public License along with- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple- * Place - Suite 330, Boston, MA 02111-1307 USA.- *- * Authors:- * Haiyang Zhang <haiyangz@microsoft.com>- * Hank Janssen <hjanssen@microsoft.com>- *- */-#include <linux/kernel.h>-#include <linux/mm.h>-#include "logging.h"-#include "hv_api.h"-#include "storvsc_api.h"--static const char *g_blk_driver_name = "blkvsc";--/* {32412632-86cb-44a2-9b5c-50d1417354f5} */-static const struct hv_guid g_blk_device_type = {- .data = {- 0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44,- 0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5- }-};--static int blk_vsc_on_device_add(struct hv_device *device, void *additional_info)-{- struct storvsc_device_info *device_info;- int ret = 0;-- device_info = (struct storvsc_device_info *)additional_info;-- ret = stor_vsc_on_device_add(device, additional_info);- if (ret != 0)- return ret;-- /*- * We need to use the device instance guid to set the path and target- * id. For IDE devices, the device instance id is formatted as- * <bus id> * - <device id> - 8899 - 000000000000.- */- device_info->path_id = device->dev_instance.data[3] << 24 |- device->dev_instance.data[2] << 16 |- device->dev_instance.data[1] << 8 |- device->dev_instance.data[0];-- device_info->target_id = device->dev_instance.data[5] << 8 |- device->dev_instance.data[4];-- return ret;-}--int blk_vsc_initialize(struct hv_driver *driver)-{- struct storvsc_driver_object *stor_driver;- int ret = 0;-- stor_driver = (struct storvsc_driver_object *)driver;-- /* Make sure we are at least 2 pages since 1 page is used for control */- /* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */-- driver->name = g_blk_driver_name;- memcpy(&driver->dev_type, &g_blk_device_type, sizeof(struct hv_guid));-- stor_driver->request_ext_size = sizeof(struct storvsc_request_extension);-- /*- * Divide the ring buffer data size (which is 1 page less than the ring- * buffer size since that page is reserved for the ring buffer indices)- * by the max request size (which is- * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)- */- stor_driver->max_outstanding_req_per_channel =- ((stor_driver->ring_buffer_size - PAGE_SIZE) /- ALIGN(MAX_MULTIPAGE_BUFFER_PACKET +- sizeof(struct vstor_packet) + sizeof(u64),- sizeof(u64)));-- DPRINT_INFO(BLKVSC, "max io outstd %u",- stor_driver->max_outstanding_req_per_channel);-- /* Setup the dispatch table */- stor_driver->base.dev_add = blk_vsc_on_device_add;- stor_driver->base.dev_rm = stor_vsc_on_device_remove;- stor_driver->base.cleanup = stor_vsc_on_cleanup;- stor_driver->on_io_request = stor_vsc_on_io_request;-- return ret;-}
From: "K. Y. Srinivasan" <kys@microsoft.com> Date: 2011-03-23 18:12:08
stor_vsc_on_host_reset() function is only used in storvsc_drv.c.
Move this function from storvsc.c to storvsc_drv.c
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/storvsc.c | 56 ------------------------------------
drivers/staging/hv/storvsc_drv.c | 59 ++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 56 deletions(-)
@@ -522,62 +522,6 @@ int stor_vsc_on_device_remove(struct hv_device *device)return0;}-intstor_vsc_on_host_reset(structhv_device*device)-{-structstorvsc_device*stor_device;-structstorvsc_request_extension*request;-structvstor_packet*vstor_packet;-intret;--DPRINT_INFO(STORVSC,"resetting host adapter...");--stor_device=get_stor_device(device);-if(!stor_device){-DPRINT_ERR(STORVSC,"unable to get stor device..."-"device being destroyed?");-return-1;-}--request=&stor_device->reset_request;-vstor_packet=&request->vstor_packet;--init_waitqueue_head(&request->wait_event);--vstor_packet->operation=VSTOR_OPERATION_RESET_BUS;-vstor_packet->flags=REQUEST_COMPLETION_FLAG;-vstor_packet->vm_srb.path_id=stor_device->path_id;--request->wait_condition=0;-ret=vmbus_sendpacket(device->channel,vstor_packet,-sizeof(structvstor_packet),-(unsignedlong)&stor_device->reset_request,-VM_PKT_DATA_INBAND,-VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);-if(ret!=0){-DPRINT_ERR(STORVSC,"Unable to send reset packet %p ret %d",-vstor_packet,ret);-gotocleanup;-}--wait_event_timeout(request->wait_event,request->wait_condition,-msecs_to_jiffies(1000));-if(request->wait_condition==0){-ret=-ETIMEDOUT;-gotocleanup;-}--DPRINT_INFO(STORVSC,"host adapter reset completed");--/*-*Atthispoint,alloutstandingrequestsintheadapter-*shouldhavebeenflushedoutandreturntous-*/--cleanup:-put_stor_device(device);-returnret;-}-/**stor_vsc_on_io_request-CallbacktoinitiateanI/Orequest*/
@@ -230,6 +232,63 @@ static int storvsc_drv_init(void)returnret;}++intstor_vsc_on_host_reset(structhv_device*device)+{+structstorvsc_device*stor_device;+structstorvsc_request_extension*request;+structvstor_packet*vstor_packet;+intret;++DPRINT_INFO(STORVSC,"resetting host adapter...");++stor_device=get_stor_device(device);+if(!stor_device){+DPRINT_ERR(STORVSC,"unable to get stor device..."+"device being destroyed?");+return-1;+}++request=&stor_device->reset_request;+vstor_packet=&request->vstor_packet;++init_waitqueue_head(&request->wait_event);++vstor_packet->operation=VSTOR_OPERATION_RESET_BUS;+vstor_packet->flags=REQUEST_COMPLETION_FLAG;+vstor_packet->vm_srb.path_id=stor_device->path_id;++request->wait_condition=0;+ret=vmbus_sendpacket(device->channel,vstor_packet,+sizeof(structvstor_packet),+(unsignedlong)&stor_device->reset_request,+VM_PKT_DATA_INBAND,+VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);+if(ret!=0){+DPRINT_ERR(STORVSC,"Unable to send reset packet %p ret %d",+vstor_packet,ret);+gotocleanup;+}++wait_event_timeout(request->wait_event,request->wait_condition,+msecs_to_jiffies(1000));+if(request->wait_condition==0){+ret=-ETIMEDOUT;+gotocleanup;+}++DPRINT_INFO(STORVSC,"host adapter reset completed");++/*+*Atthispoint,alloutstandingrequestsintheadapter+*shouldhavebeenflushedoutandreturntous+*/++cleanup:+put_stor_device(device);+returnret;+}+staticintstorvsc_drv_exit_cb(structdevice*dev,void*data){structdevice**curr=(structdevice**)data;
From: "K. Y. Srinivasan" <kys@microsoft.com> Date: 2011-03-23 18:12:09
In preparation for further cleaning up storvsc.c move the definition
of the inline function put_stor_device() from storvsc.c to
storvsc_api.h.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/storvsc.c | 9 ---------
drivers/staging/hv/storvsc_api.h | 10 ++++++++++
2 files changed, 10 insertions(+), 9 deletions(-)
On Wed, Mar 23, 2011 at 10:50:19AM -0700, K. Y. Srinivasan wrote:
quoted hunk
In preparation for getting rid of the inclusion of storvsc.c from
blkvsc.c, add inclusion guard to vstorage.h
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/vstorage.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
@@ -25,6 +25,9 @@/* to alert the user that structure sizes may be mismatched even though the *//* protocol versions match. */+#ifndef _VSTORAGE_H_+#define _VSTORAGE_H_
What's with the trailing '_'?
Traditionally we've used __FOO_H for internal kernel header files.
thanks,
greg k-h
On Mon, Apr 04, 2011 at 09:28:05PM -0700, Greg KH wrote:
On Wed, Mar 23, 2011 at 10:50:19AM -0700, K. Y. Srinivasan wrote:
quoted
In preparation for getting rid of the inclusion of storvsc.c from
blkvsc.c, add inclusion guard to vstorage.h
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <redacted>
---
drivers/staging/hv/vstorage.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
@@ -25,6 +25,9 @@/* to alert the user that structure sizes may be mismatched even though the *//* protocol versions match. */+#ifndef _VSTORAGE_H_+#define _VSTORAGE_H_
What's with the trailing '_'?
Traditionally we've used __FOO_H for internal kernel header files.
Oh nevermind, I see that's how the other .h files in this directory
work, it's ok for now.
thanks,
greg k-h