* [PATCH 02/16] Staging: hv: Move the definition of struct storvsc_request_extension
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 03/16] Staging: hv: Move the definition of struct storvsc_device K. Y. Srinivasan
` (14 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
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 <hjanssen@microsoft.com>
---
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(-)
diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index 7c8729b..88d6e3c 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -24,6 +24,7 @@
#include <linux/mm.h>
#include "hv_api.h"
#include "storvsc.c"
+#include "storvsc_api.h"
static const char *g_blk_driver_name = "blkvsc";
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index e2ad729..56f3cc9 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -33,19 +33,6 @@
#include "channel.h"
-struct storvsc_request_extension {
- /* LIST_ENTRY ListEntry; */
-
- struct hv_storvsc_request *request;
- struct hv_device *device;
-
- /* Synchronize the request/response if needed */
- int wait_condition;
- wait_queue_head_t wait_event;
-
- struct vstor_packet vstor_packet;
-};
-
/* A storvsc device is a device object that contains a vmbus channel */
struct storvsc_device {
struct hv_device *device;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index fbf5755..629144c 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -25,6 +25,7 @@
#ifndef _STORVSC_API_H_
#define _STORVSC_API_H_
+#include "vstorage.h"
#include "vmbus_api.h"
/* Defines */
@@ -102,6 +103,17 @@ struct storvsc_device_info {
unsigned char target_id;
};
+struct storvsc_request_extension {
+ struct hv_storvsc_request *request;
+ struct hv_device *device;
+
+ /* Synchronize the request/response if needed */
+ int wait_condition;
+ wait_queue_head_t wait_event;
+
+ struct vstor_packet vstor_packet;
+};
+
/* Interface */
int stor_vsc_initialize(struct hv_driver *driver);
int stor_vsc_on_host_reset(struct hv_device *device);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 03/16] Staging: hv: Move the definition of struct storvsc_device
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 02/16] Staging: hv: Move the definition of struct storvsc_request_extension K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 04/16] Staging: hv: Cleanup " K. Y. Srinivasan
` (13 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
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 <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc.c | 26 --------------------------
drivers/staging/hv/storvsc_api.h | 26 ++++++++++++++++++++++++++
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 56f3cc9..be1c77a 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -33,32 +33,6 @@
#include "channel.h"
-/* A storvsc device is a device object that contains a vmbus channel */
-struct storvsc_device {
- struct hv_device *device;
-
- /* 0 indicates the device is being destroyed */
- atomic_t ref_count;
-
- atomic_t num_outstanding_req;
-
- /*
- * Each unique Port/Path/Target represents 1 channel ie scsi
- * controller. In reality, the pathid, targetid is always 0
- * and the port is set by us
- */
- unsigned int port_number;
- unsigned char path_id;
- unsigned char target_id;
-
- /* LIST_ENTRY OutstandingRequestList; */
- /* HANDLE OutstandingRequestLock; */
-
- /* Used for vsc/vsp channel reset process */
- struct storvsc_request_extension init_request;
- struct storvsc_request_extension reset_request;
-};
-
static const char *g_driver_name = "storvsc";
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 629144c..2b814bd 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -114,6 +114,32 @@ struct storvsc_request_extension {
struct vstor_packet vstor_packet;
};
+/* A storvsc device is a device object that contains a vmbus channel */
+struct storvsc_device {
+ struct hv_device *device;
+
+ /* 0 indicates the device is being destroyed */
+ atomic_t ref_count;
+
+ atomic_t num_outstanding_req;
+
+ /*
+ * Each unique Port/Path/Target represents 1 channel ie scsi
+ * controller. In reality, the pathid, targetid is always 0
+ * and the port is set by us
+ */
+ unsigned int port_number;
+ unsigned char path_id;
+ unsigned char target_id;
+
+ /* LIST_ENTRY OutstandingRequestList; */
+ /* HANDLE OutstandingRequestLock; */
+
+ /* Used for vsc/vsp channel reset process */
+ struct storvsc_request_extension init_request;
+ struct storvsc_request_extension reset_request;
+};
+
/* Interface */
int stor_vsc_initialize(struct hv_driver *driver);
int stor_vsc_on_host_reset(struct hv_device *device);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 04/16] Staging: hv: Cleanup struct storvsc_device
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 02/16] Staging: hv: Move the definition of struct storvsc_request_extension K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 03/16] Staging: hv: Move the definition of struct storvsc_device K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 05/16] Staging: hv: Get rid of the include of storvsc.c from blkvsc.c K. Y. Srinivasan
` (12 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
Get rid of some dated comments from struct storvsc_device.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc_api.h | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 2b814bd..7f780c5 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -132,9 +132,6 @@ struct storvsc_device {
unsigned char path_id;
unsigned char target_id;
- /* LIST_ENTRY OutstandingRequestList; */
- /* HANDLE OutstandingRequestLock; */
-
/* Used for vsc/vsp channel reset process */
struct storvsc_request_extension init_request;
struct storvsc_request_extension reset_request;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 05/16] Staging: hv: Get rid of the include of storvsc.c from blkvsc.c
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (2 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 04/16] Staging: hv: Cleanup " K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 06/16] Staging: hv: Get rid of dead code in storvsc.c K. Y. Srinivasan
` (11 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
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 <hjanssen@microsoft.com>
---
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(-)
diff --git a/drivers/staging/hv/Makefile b/drivers/staging/hv/Makefile
index abeb2f7..a733154 100644
--- a/drivers/staging/hv/Makefile
+++ b/drivers/staging/hv/Makefile
@@ -9,6 +9,6 @@ hv_vmbus-y := vmbus_drv.o \
hv.o connection.o channel.o \
channel_mgmt.o ring_buffer.o
hv_storvsc-y := storvsc_drv.o storvsc.o
-hv_blkvsc-y := blkvsc_drv.o blkvsc.o
+hv_blkvsc-y := blkvsc_drv.o blkvsc.o storvsc.o
hv_netvsc-y := netvsc_drv.o netvsc.o rndis_filter.o
hv_utils-y := hv_util.o hv_kvp.o
diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index 88d6e3c..ebe511a 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -22,8 +22,8 @@
*/
#include <linux/kernel.h>
#include <linux/mm.h>
+#include "logging.h"
#include "hv_api.h"
-#include "storvsc.c"
#include "storvsc_api.h"
static const char *g_blk_driver_name = "blkvsc";
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index be1c77a..c8d7ff7 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -504,7 +504,7 @@ static int stor_vsc_connect_to_vsp(struct hv_device *device)
* stor_vsc_on_device_add - Callback when the device belonging to this driver
* is added
*/
-static int stor_vsc_on_device_add(struct hv_device *device,
+int stor_vsc_on_device_add(struct hv_device *device,
void *additional_info)
{
struct storvsc_device *stor_device;
@@ -553,7 +553,7 @@ cleanup:
/*
* stor_vsc_on_device_remove - Callback when the our device is being removed
*/
-static int stor_vsc_on_device_remove(struct hv_device *device)
+int stor_vsc_on_device_remove(struct hv_device *device)
{
struct storvsc_device *stor_device;
@@ -646,7 +646,7 @@ cleanup:
/*
* stor_vsc_on_io_request - Callback to initiate an I/O request
*/
-static int stor_vsc_on_io_request(struct hv_device *device,
+int stor_vsc_on_io_request(struct hv_device *device,
struct hv_storvsc_request *request)
{
struct storvsc_device *stor_device;
@@ -739,7 +739,7 @@ static int stor_vsc_on_io_request(struct hv_device *device,
/*
* stor_vsc_on_cleanup - Perform any cleanup when the driver is removed
*/
-static void stor_vsc_on_cleanup(struct hv_driver *driver)
+void stor_vsc_on_cleanup(struct hv_driver *driver)
{
}
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 7f780c5..141b8fd 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -142,4 +142,13 @@ int stor_vsc_initialize(struct hv_driver *driver);
int stor_vsc_on_host_reset(struct hv_device *device);
int blk_vsc_initialize(struct hv_driver *driver);
+int stor_vsc_on_device_add(struct hv_device *device,
+ void *additional_info);
+int stor_vsc_on_device_remove(struct hv_device *device);
+
+int stor_vsc_on_io_request(struct hv_device *device,
+ struct hv_storvsc_request *request);
+void stor_vsc_on_cleanup(struct hv_driver *driver);
+
+
#endif /* _STORVSC_API_H_ */
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 06/16] Staging: hv: Get rid of dead code in storvsc.c
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (3 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 05/16] Staging: hv: Get rid of the include of storvsc.c from blkvsc.c K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 07/16] Staging: hv: Move the definition of stor_vsc_initialize() K. Y. Srinivasan
` (10 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
Get rid of some "dead code" from storvsc.c
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc.c | 33 ---------------------------------
1 files changed, 0 insertions(+), 33 deletions(-)
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index c8d7ff7..1f05aa6 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -65,7 +65,6 @@ static inline struct storvsc_device *alloc_stor_device(struct hv_device *device)
static inline void free_stor_device(struct storvsc_device *device)
{
- /* ASSERT(atomic_read(&device->ref_count) == 0); */
kfree(device);
}
@@ -103,10 +102,8 @@ static inline void put_stor_device(struct hv_device *device)
struct storvsc_device *stor_device;
stor_device = (struct storvsc_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(
struct storvsc_device *stor_device;
stor_device = (struct storvsc_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(
struct storvsc_device *stor_device;
stor_device = (struct storvsc_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)
@@ -341,12 +336,8 @@ static void stor_vsc_on_io_completion(struct hv_device *device,
"completed bytes xfer %u", request_ext,
vstor_packet->vm_srb.data_transfer_length);
- /* ASSERT(request_ext != NULL); */
- /* ASSERT(request_ext->request != NULL); */
-
request = request_ext->request;
- /* ASSERT(request->OnIOCompletion != NULL); */
/* Copy over the status...etc */
request->status = vstor_packet->vm_srb.scsi_status;
@@ -366,8 +357,6 @@ static void stor_vsc_on_io_completion(struct hv_device *device,
"valid - len %d\n", request_ext,
vstor_packet->vm_srb.sense_info_length);
- /* ASSERT(vstor_packet->vm_srb.sense_info_length <= */
- /* request->SenseBufferSize); */
memcpy(request->sense_buffer,
vstor_packet->vm_srb.sense_data,
vstor_packet->vm_srb.sense_info_length);
@@ -418,7 +407,6 @@ static void stor_vsc_on_channel_callback(void *context)
struct storvsc_request_extension *request;
int ret;
- /* ASSERT(device); */
stor_device = must_get_stor_device(device);
if (!stor_device) {
@@ -435,21 +423,12 @@ static void stor_vsc_on_channel_callback(void *context)
DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx",
bytes_recvd, request_id);
- /* ASSERT(bytes_recvd ==
- sizeof(struct vstor_packet)); */
request = (struct storvsc_request_extension *)
(unsigned long)request_id;
- /* ASSERT(request);c */
- /* if (vstor_packet.Flags & SYNTHETIC_FLAG) */
if ((request == &stor_device->init_request) ||
(request == &stor_device->reset_request)) {
- /* DPRINT_INFO(STORVSC,
- * "reset completion - operation "
- * "%u status %u",
- * vstor_packet.Operation,
- * vstor_packet.Status); */
memcpy(&request->vstor_packet, packet,
sizeof(struct vstor_packet));
@@ -461,7 +440,6 @@ static void stor_vsc_on_channel_callback(void *context)
request);
}
} else {
- /* DPRINT_DBG(STORVSC, "nothing else to read..."); */
break;
}
} while (1);
@@ -508,7 +486,6 @@ int stor_vsc_on_device_add(struct hv_device *device,
void *additional_info)
{
struct storvsc_device *stor_device;
- /* struct vmstorage_channel_properties *props; */
struct storvsc_device_info *device_info;
int ret = 0;
@@ -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,
* scsi channel prior to the bus scan
*/
- /* 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;
@@ -673,8 +643,6 @@ int stor_vsc_on_io_request(struct hv_device *device,
return -2;
}
- /* print_hex_dump_bytes("", DUMP_PREFIX_NONE, request->Cdb,
- * request->CdbLen); */
request_extension->request = request;
request_extension->device = device;
@@ -762,7 +730,6 @@ int stor_vsc_initialize(struct hv_driver *driver)
sizeof(struct vmscsi_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,
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 07/16] Staging: hv: Move the definition of stor_vsc_initialize()
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (4 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 06/16] Staging: hv: Get rid of dead code in storvsc.c K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 08/16] Staging: hv: Make the function stor_vsc_initialize() static K. Y. Srinivasan
` (9 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
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 <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc.c | 64 --------------------------------------
drivers/staging/hv/storvsc_drv.c | 63 +++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 64 deletions(-)
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 1f05aa6..83d012b 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -33,18 +33,6 @@
#include "channel.h"
-
-static const char *g_driver_name = "storvsc";
-
-/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */
-static const struct hv_guid gStorVscDeviceType = {
- .data = {
- 0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d,
- 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f
- }
-};
-
-
static inline struct storvsc_device *alloc_stor_device(struct hv_device *device)
{
struct storvsc_device *stor_device;
@@ -711,55 +699,3 @@ void stor_vsc_on_cleanup(struct hv_driver *driver)
{
}
-/*
- * stor_vsc_initialize - Main entry point
- */
-int stor_vsc_initialize(struct hv_driver *driver)
-{
- struct storvsc_driver_object *stor_driver;
-
- stor_driver = (struct storvsc_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(struct hv_storvsc_request),
- sizeof(struct storvsc_request_extension),
- sizeof(struct vstor_packet),
- sizeof(struct vmscsi_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(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(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;
-
- return 0;
-}
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index e6462a2..5ea09da 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -38,6 +38,16 @@
#include "storvsc_api.h"
+static const char *g_driver_name = "storvsc";
+
+/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */
+static const struct hv_guid gStorVscDeviceType = {
+ .data = {
+ 0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d,
+ 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f
+ }
+};
+
struct host_device_context {
/* must be 1st field
* FIXME this is a bug */
@@ -64,6 +74,59 @@ struct storvsc_cmd_request {
};
+/*
+ * stor_vsc_initialize - Main entry point
+ */
+int stor_vsc_initialize(struct hv_driver *driver)
+{
+ struct storvsc_driver_object *stor_driver;
+
+ stor_driver = (struct storvsc_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(struct hv_storvsc_request),
+ sizeof(struct storvsc_request_extension),
+ sizeof(struct vstor_packet),
+ sizeof(struct vmscsi_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(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(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;
+
+ return 0;
+}
+
/* Static decl */
static int storvsc_probe(struct device *dev);
static int storvsc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *scmnd);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 08/16] Staging: hv: Make the function stor_vsc_initialize() static
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (5 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 07/16] Staging: hv: Move the definition of stor_vsc_initialize() K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 09/16] Staging: hv: Cleanup the initialization of storvsc driver K. Y. Srinivasan
` (8 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
Make the function stor_vsc_initialize() a static function.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc_api.h | 1 -
drivers/staging/hv/storvsc_drv.c | 2 +-
2 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 141b8fd..9a452f2 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -138,7 +138,6 @@ struct storvsc_device {
};
/* Interface */
-int stor_vsc_initialize(struct hv_driver *driver);
int stor_vsc_on_host_reset(struct hv_device *device);
int blk_vsc_initialize(struct hv_driver *driver);
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 5ea09da..af6a37d 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -77,7 +77,7 @@ struct storvsc_cmd_request {
/*
* stor_vsc_initialize - Main entry point
*/
-int stor_vsc_initialize(struct hv_driver *driver)
+static int stor_vsc_initialize(struct hv_driver *driver)
{
struct storvsc_driver_object *stor_driver;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 09/16] Staging: hv: Cleanup the initialization of storvsc driver
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (6 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 08/16] Staging: hv: Make the function stor_vsc_initialize() static K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 10/16] Staging: hv: Move the contents of blkvsc.c to blkvsc_drv.c K. Y. Srinivasan
` (7 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
Cleanup the initialization sequence for the storvsc driver.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc_drv.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index af6a37d..2c51a07 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -191,7 +191,7 @@ static struct scsi_host_template scsi_driver = {
/*
* storvsc_drv_init - StorVsc driver initialization.
*/
-static int storvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
+static int storvsc_drv_init(void)
{
int ret;
struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv;
@@ -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)
int ret;
DPRINT_INFO(STORVSC_DRV, "Storvsc initializing....");
- ret = storvsc_drv_init(stor_vsc_initialize);
+ ret = storvsc_drv_init();
return ret;
}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 10/16] Staging: hv: Move the contents of blkvsc.c to blkvsc_drv.c
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (7 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 09/16] Staging: hv: Cleanup the initialization of storvsc driver K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 11/16] Staging: hv: Get rid of the file blkvsc.c K. Y. Srinivasan
` (6 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
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 <hjanssen@microsoft.com>
---
drivers/staging/hv/Makefile | 2 +-
drivers/staging/hv/blkvsc_drv.c | 79 +++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+), 1 deletions(-)
diff --git a/drivers/staging/hv/Makefile b/drivers/staging/hv/Makefile
index a733154..3004674 100644
--- a/drivers/staging/hv/Makefile
+++ b/drivers/staging/hv/Makefile
@@ -9,6 +9,6 @@ hv_vmbus-y := vmbus_drv.o \
hv.o connection.o channel.o \
channel_mgmt.o ring_buffer.o
hv_storvsc-y := storvsc_drv.o storvsc.o
-hv_blkvsc-y := blkvsc_drv.o blkvsc.o storvsc.o
+hv_blkvsc-y := blkvsc_drv.o storvsc.o
hv_netvsc-y := netvsc_drv.o netvsc.o rndis_filter.o
hv_utils-y := hv_util.o hv_kvp.o
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 6e02f1b..1d602a1 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -116,6 +116,85 @@ struct block_device_context {
};
+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;
+}
+
/* Static decl */
static DEFINE_MUTEX(blkvsc_mutex);
static int blkvsc_probe(struct device *dev);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 11/16] Staging: hv: Get rid of the file blkvsc.c
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (8 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 10/16] Staging: hv: Move the contents of blkvsc.c to blkvsc_drv.c K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 12/16] Staging: hv: Cleanup initialization of blkvsc driver K. Y. Srinivasan
` (5 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
Now delete the file.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/blkvsc.c | 103 -------------------------------------------
1 files changed, 0 insertions(+), 103 deletions(-)
delete mode 100644 drivers/staging/hv/blkvsc.c
diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
deleted file mode 100644
index ebe511a..0000000
--- a/drivers/staging/hv/blkvsc.c
+++ /dev/null
@@ -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;
-}
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 12/16] Staging: hv: Cleanup initialization of blkvsc driver
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (9 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 11/16] Staging: hv: Get rid of the file blkvsc.c K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 13/16] Staging: hv: Move the definition of the function get_stor_device() K. Y. Srinivasan
` (4 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
Cleanup the initialization sequence for the block driver.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/blkvsc_drv.c | 8 ++++----
drivers/staging/hv/storvsc_api.h | 1 -
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 1d602a1..824080d 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -155,7 +155,7 @@ static int blk_vsc_on_device_add(struct hv_device *device,
}
-int blk_vsc_initialize(struct hv_driver *driver)
+static int blk_vsc_initialize(struct hv_driver *driver)
{
struct storvsc_driver_object *stor_driver;
int ret = 0;
@@ -243,7 +243,7 @@ static const struct block_device_operations block_ops = {
/*
* blkvsc_drv_init - BlkVsc driver initialization.
*/
-static int blkvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
+static int blkvsc_drv_init(void)
{
struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv;
struct hv_driver *drv = &g_blkvsc_drv.base;
@@ -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();
return ret;
}
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 9a452f2..d985bbf 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -139,7 +139,6 @@ struct storvsc_device {
/* Interface */
int stor_vsc_on_host_reset(struct hv_device *device);
-int blk_vsc_initialize(struct hv_driver *driver);
int stor_vsc_on_device_add(struct hv_device *device,
void *additional_info);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 13/16] Staging: hv: Move the definition of the function get_stor_device()
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (10 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 12/16] Staging: hv: Cleanup initialization of blkvsc driver K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 14/16] Staging: hv: Move the definition of the function put_stor_device() K. Y. Srinivasan
` (3 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
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 <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc.c | 14 --------------
drivers/staging/hv/storvsc_api.h | 15 +++++++++++++++
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 83d012b..357f5dd 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -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 */
-static inline struct storvsc_device *get_stor_device(struct hv_device *device)
-{
- struct storvsc_device *stor_device;
-
- stor_device = (struct storvsc_device *)device->ext;
- if (stor_device && atomic_read(&stor_device->ref_count) > 1)
- atomic_inc(&stor_device->ref_count);
- else
- stor_device = NULL;
-
- return stor_device;
-}
-
/* Get the stordevice object iff exists and its refcount > 0 */
static inline struct storvsc_device *must_get_stor_device(
struct hv_device *device)
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index d985bbf..4e66507 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -137,6 +137,21 @@ struct storvsc_device {
struct storvsc_request_extension reset_request;
};
+
+/* Get the stordevice object iff exists and its refcount > 1 */
+static inline struct storvsc_device *get_stor_device(struct hv_device *device)
+{
+ struct storvsc_device *stor_device;
+
+ stor_device = (struct storvsc_device *)device->ext;
+ if (stor_device && atomic_read(&stor_device->ref_count) > 1)
+ atomic_inc(&stor_device->ref_count);
+ else
+ stor_device = NULL;
+
+ return stor_device;
+}
+
/* Interface */
int stor_vsc_on_host_reset(struct hv_device *device);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 14/16] Staging: hv: Move the definition of the function put_stor_device()
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (11 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 13/16] Staging: hv: Move the definition of the function get_stor_device() K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 15/16] Staging: hv: Move the definition of the function stor_vsc_on_host_reset() K. Y. Srinivasan
` (2 subsequent siblings)
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
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 <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc.c | 9 ---------
drivers/staging/hv/storvsc_api.h | 10 ++++++++++
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 357f5dd..c576e7b 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -71,15 +71,6 @@ static inline struct storvsc_device *must_get_stor_device(
return stor_device;
}
-static inline void put_stor_device(struct hv_device *device)
-{
- struct storvsc_device *stor_device;
-
- stor_device = (struct storvsc_device *)device->ext;
-
- atomic_dec(&stor_device->ref_count);
-}
-
/* Drop ref count to 1 to effectively disable get_stor_device() */
static inline struct storvsc_device *release_stor_device(
struct hv_device *device)
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 4e66507..d46b4de 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -152,6 +152,16 @@ static inline struct storvsc_device *get_stor_device(struct hv_device *device)
return stor_device;
}
+
+static inline void put_stor_device(struct hv_device *device)
+{
+ struct storvsc_device *stor_device;
+
+ stor_device = (struct storvsc_device *)device->ext;
+
+ atomic_dec(&stor_device->ref_count);
+}
+
/* Interface */
int stor_vsc_on_host_reset(struct hv_device *device);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 15/16] Staging: hv: Move the definition of the function stor_vsc_on_host_reset()
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (12 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 14/16] Staging: hv: Move the definition of the function put_stor_device() K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-03-23 17:50 ` [PATCH 16/16] Staging: hv: Make the function stor_vsc_on_host_reset() static K. Y. Srinivasan
2011-04-05 4:28 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h Greg KH
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
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 <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc.c | 56 ------------------------------------
drivers/staging/hv/storvsc_drv.c | 59 ++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 56 deletions(-)
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index c576e7b..6801e37 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -522,62 +522,6 @@ int stor_vsc_on_device_remove(struct hv_device *device)
return 0;
}
-int stor_vsc_on_host_reset(struct hv_device *device)
-{
- struct storvsc_device *stor_device;
- struct storvsc_request_extension *request;
- struct vstor_packet *vstor_packet;
- int ret;
-
- 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(struct vstor_packet),
- (unsigned long)&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);
- goto cleanup;
- }
-
- wait_event_timeout(request->wait_event, request->wait_condition,
- msecs_to_jiffies(1000));
- if (request->wait_condition == 0) {
- ret = -ETIMEDOUT;
- goto cleanup;
- }
-
- DPRINT_INFO(STORVSC, "host adapter reset completed");
-
- /*
- * At this point, all outstanding requests in the adapter
- * should have been flushed out and return to us
- */
-
-cleanup:
- put_stor_device(device);
- return ret;
-}
-
/*
* stor_vsc_on_io_request - Callback to initiate an I/O request
*/
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 2c51a07..e0a1195 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -36,6 +36,8 @@
#include "version_info.h"
#include "vmbus.h"
#include "storvsc_api.h"
+#include "vstorage.h"
+#include "channel.h"
static const char *g_driver_name = "storvsc";
@@ -230,6 +232,63 @@ static int storvsc_drv_init(void)
return ret;
}
+
+int stor_vsc_on_host_reset(struct hv_device *device)
+{
+ struct storvsc_device *stor_device;
+ struct storvsc_request_extension *request;
+ struct vstor_packet *vstor_packet;
+ int ret;
+
+ 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(struct vstor_packet),
+ (unsigned long)&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);
+ goto cleanup;
+ }
+
+ wait_event_timeout(request->wait_event, request->wait_condition,
+ msecs_to_jiffies(1000));
+ if (request->wait_condition == 0) {
+ ret = -ETIMEDOUT;
+ goto cleanup;
+ }
+
+ DPRINT_INFO(STORVSC, "host adapter reset completed");
+
+ /*
+ * At this point, all outstanding requests in the adapter
+ * should have been flushed out and return to us
+ */
+
+cleanup:
+ put_stor_device(device);
+ return ret;
+}
+
static int storvsc_drv_exit_cb(struct device *dev, void *data)
{
struct device **curr = (struct device **)data;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 16/16] Staging: hv: Make the function stor_vsc_on_host_reset() static
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (13 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 15/16] Staging: hv: Move the definition of the function stor_vsc_on_host_reset() K. Y. Srinivasan
@ 2011-03-23 17:50 ` K. Y. Srinivasan
2011-04-05 4:28 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h Greg KH
15 siblings, 0 replies; 19+ messages in thread
From: K. Y. Srinivasan @ 2011-03-23 17:50 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
Make stor_vsc_on_host_reset() a static function.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc_api.h | 1 -
drivers/staging/hv/storvsc_drv.c | 2 +-
2 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index d46b4de..5f41ef6 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -163,7 +163,6 @@ static inline void put_stor_device(struct hv_device *device)
}
/* Interface */
-int stor_vsc_on_host_reset(struct hv_device *device);
int stor_vsc_on_device_add(struct hv_device *device,
void *additional_info);
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index e0a1195..127d122 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -233,7 +233,7 @@ static int storvsc_drv_init(void)
}
-int stor_vsc_on_host_reset(struct hv_device *device)
+static int stor_vsc_on_host_reset(struct hv_device *device)
{
struct storvsc_device *stor_device;
struct storvsc_request_extension *request;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h
2011-03-23 17:50 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h K. Y. Srinivasan
` (14 preceding siblings ...)
2011-03-23 17:50 ` [PATCH 16/16] Staging: hv: Make the function stor_vsc_on_host_reset() static K. Y. Srinivasan
@ 2011-04-05 4:28 ` Greg KH
2011-04-05 4:29 ` Greg KH
15 siblings, 1 reply; 19+ messages in thread
From: Greg KH @ 2011-04-05 4:28 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang, Hank Janssen
On Wed, Mar 23, 2011 at 10:50:19AM -0700, K. Y. Srinivasan wrote:
> 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 <hjanssen@microsoft.com>
> ---
> drivers/staging/hv/vstorage.h | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/staging/hv/vstorage.h b/drivers/staging/hv/vstorage.h
> index ebb4d67..83060cd 100644
> --- a/drivers/staging/hv/vstorage.h
> +++ b/drivers/staging/hv/vstorage.h
> @@ -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
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h
2011-04-05 4:28 ` [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h Greg KH
@ 2011-04-05 4:29 ` Greg KH
0 siblings, 0 replies; 19+ messages in thread
From: Greg KH @ 2011-04-05 4:29 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang, Hank Janssen
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:
> > 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 <hjanssen@microsoft.com>
> > ---
> > drivers/staging/hv/vstorage.h | 5 +++++
> > 1 files changed, 5 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/staging/hv/vstorage.h b/drivers/staging/hv/vstorage.h
> > index ebb4d67..83060cd 100644
> > --- a/drivers/staging/hv/vstorage.h
> > +++ b/drivers/staging/hv/vstorage.h
> > @@ -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
^ permalink raw reply [flat|nested] 19+ messages in thread