* [PATCH 02/22] Staging: hv: Embed struct storvsc_request_extension into hv_storvsc_request
From: K. Y. Srinivasan @ 2011-04-05 14:04 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1302012306-21277-1-git-send-email-kys@microsoft.com>
Embed struct storvsc_request_extension into hv_storvsc_request.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/blkvsc_drv.c | 8 --------
drivers/staging/hv/storvsc.c | 3 +--
drivers/staging/hv/storvsc_api.h | 3 +--
drivers/staging/hv/storvsc_drv.c | 6 ------
4 files changed, 2 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 824080d..9ceaa99 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -84,12 +84,6 @@ struct blkvsc_request {
unsigned char cmnd[MAX_COMMAND_SIZE];
struct hv_storvsc_request request;
- /*
- * !!!DO NOT ADD ANYTHING BELOW HERE!!! Otherwise, memory can overlap,
- * because - The extension buffer falls right here and is pointed to by
- * request.Extension;
- * Which sounds like a horrible idea, who designed this?
- */
};
/* Per device structure */
@@ -942,8 +936,6 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
#endif
storvsc_req = &blkvsc_req->request;
- storvsc_req->extension = (void *)((unsigned long)blkvsc_req +
- sizeof(struct blkvsc_request));
storvsc_req->type = blkvsc_req->write ? WRITE_TYPE : READ_TYPE;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 6801e37..5cea331 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -533,8 +533,7 @@ int stor_vsc_on_io_request(struct hv_device *device,
struct vstor_packet *vstor_packet;
int ret = 0;
- request_extension =
- (struct storvsc_request_extension *)request->extension;
+ request_extension = &request->extension;
vstor_packet = &request_extension->vstor_packet;
stor_device = get_stor_device(device);
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 800ebbf..e41b68b 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -83,8 +83,7 @@ struct hv_storvsc_request {
void (*on_io_completion)(struct hv_storvsc_request *request);
- /* This points to the memory after DataBuffer */
- void *extension;
+ struct storvsc_request_extension extension;
struct hv_multipage_buffer data_buffer;
};
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 127d122..58d12e0 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -69,10 +69,6 @@ struct storvsc_cmd_request {
struct scatterlist *bounce_sgl;
struct hv_storvsc_request request;
- /* !!!DO NOT ADD ANYTHING BELOW HERE!!! */
- /* The extension buffer falls right here and is pointed to by
- * request.Extension;
- * Which sounds like a very bad design... */
};
@@ -763,8 +759,6 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
request = &cmd_request->request;
- request->extension =
- (void *)((unsigned long)cmd_request + request_size);
DPRINT_DBG(STORVSC_DRV, "req %p size %d ext %d", request, request_size,
storvsc_drv_obj->request_ext_size);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 01/22] Staging: hv: Move the definition of struct storvsc_request_extension
From: K. Y. Srinivasan @ 2011-04-05 14:04 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1302012261-21236-1-git-send-email-kys@microsoft.com>
In preperation for embedding struct storvsc_request_extension into
struct hv_storvsc_request, move the definition of
struct storvsc_request_extension.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/storvsc_api.h | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 5f41ef6..800ebbf 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -53,6 +53,18 @@ enum storvsc_request_type{
UNKNOWN_TYPE,
};
+
+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;
+};
+
struct hv_storvsc_request {
enum storvsc_request_type type;
u32 host;
@@ -103,17 +115,6 @@ 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;
-};
-
/* A storvsc device is a device object that contains a vmbus channel */
struct storvsc_device {
struct hv_device *device;
--
1.7.4.1
^ permalink raw reply related
* [RESEND PATCH 00/22] Staging: hv: Cleanup-storage-drivers-phase-II
From: K. Y. Srinivasan @ 2011-04-05 14:04 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: K. Y. Srinivasan
This patch-set restructures and cleans up struct hv_storvsc_request.
In the current code, two data structures: struct hv_storvsc_request
and struct storvsc_request_extension together are used to carry
the I/O state and there are many issues with this current
architecture:
1) The memory for extension data structure
is allocatted just after the data buffer
field in struct hv_storvsc_request resulting in comments
such as this in struct blkvsc_request (blkvsc_drv.c):
/*
* !!!DO NOT ADD ANYTHING BELOW HERE!!! Otherwise, memory can overlap,
* because - The extension buffer falls right here and is pointed to by
* request.Extension;
* Which sounds like a horrible idea, who designed this?
*/
2) State is unnecessarily replicated in both struct hv_storvsc_request
and the struct vstor_packet that is embedded in
struct storvsc_request_extension.
This patch-set addresses the above issues by geting rid of replicated
state and consolidating all necessary state into a single data structure.
We also deal with a range of other cleanups in this patch-set:
1) Use completion primitives to wait for completion.
2) Get rid of the synch primitive in struct blkvsc_request
3) Get rid of the need for struct hv_device to be the first
element of struct host_device_context.
Regards,
K. Y
^ permalink raw reply
* RE: [PATCH 00/22] Staging: hv: Cleanup-storage-drivers-phase-III
From: KY Srinivasan @ 2011-04-05 13:58 UTC (permalink / raw)
To: Greg KH
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org
In-Reply-To: <20110405045904.GA4635@kroah.com>
Sorry for the confusion Greg. I reworked some patches in Phase-II cleanup and I was meaning to resend them before you began applying the patches, That is the reason for the problem you are encountering. I just resent the Phase II series. If you can back out the phase II that you have applied and apply the ones I resent, everything should apply cleanly. Once again, I sorry for creating additional work for you.
Regards,
K. Y
> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: Tuesday, April 05, 2011 12:59 AM
> To: KY Srinivasan
> Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org
> Subject: Re: [PATCH 00/22] Staging: hv: Cleanup-storage-drivers-phase-III
>
> On Mon, Mar 28, 2011 at 10:00:15AM -0700, K. Y. Srinivasan wrote:
> > This patch-set deals with some of the style isues in blkvsc_drv.c. We also
> > get rid most of the "dead code" in this file:
> >
> > 1) Get rid of most of the forward declarations in this file.
> > The only remaining forward declarations are to deal with
> > circular dependencies.
> >
> > 2) Get rid of most of the dead code in the file. Some of
> > the functions in this file are place holders - they are not
> > fuly implementedi yet (blkvsc_ioctl(), blkvsc_media_changed().
> > We have retained some comments/dead code, to help us in the
> > final implementation.
>
> For some reason, this patch series fails to apply after the first one.
> So I've not applied any of them, care to resync and resend?
>
> thanks,
>
> greg k-h
^ permalink raw reply
* Re: [PATCH] virtio: decrement dev_index when device is unregistered
From: Stefan Hajnoczi @ 2011-04-05 6:21 UTC (permalink / raw)
To: Takuma Umeya; +Cc: Stephen Hemminger, linux-kernel, virtualization
In-Reply-To: <66015840.659833.1301978966706.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
On Tue, Apr 5, 2011 at 5:49 AM, Takuma Umeya <tumeya@redhat.com> wrote:
> When virtio device is removed, dev_index does not get decremented.
> The next device hotplug event results in consuming the next pci to
> the one that is suppose to be available.
>
> Signed-off-by: Takuma Umeya <tumeya@redhat.com>
>
> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> index efb35aa..67fe71d 100644
> --- a/drivers/virtio/virtio.c
> +++ b/drivers/virtio/virtio.c
> @@ -216,6 +216,7 @@ EXPORT_SYMBOL_GPL(register_virtio_device);
> void unregister_virtio_device(struct virtio_device *dev)
> {
> device_unregister(&dev->dev);
> + dev_index--;
I don't think there is any guarantee that virtio devices are
added/removed in first-in-last-out order.
That means I could add a virtio-net device (index 0) followed by a
virtio-blk device (index 1). Now I remove the virtio-net device
(index 0) which causes me to decrement dev_index and hand index 1 out
again to the next device. This leaves us with virtio-blk (index 1)
and the new device with index 1, which is not unique.
Perhaps I missed a constraint which prevents this from occurring?
Stefan
^ permalink raw reply
* KVM Forum 2011 - Save the Date
From: KVM Forum 2011 Program Committee @ 2011-04-05 5:15 UTC (permalink / raw)
To: kvm, qemu-devel, virtualization, libvir-list; +Cc: KVM-Forum-2011-PC
KVM Forum 2011 - Save the Date
Conference: August 15 - 16, 2011
Location: Hyatt Regency Vancouver - Vancouver, Canada
KVM is an industry leading open source hypervisor that provides an ideal
platform for datacenter virtualization, virtual desktop infrastructure,
and cloud computing. Once again, it's time to bring together the
community of developers and users that define the KVM ecosystem for
our annual technical conference. We will discuss the current state of
affairs and plan for the future of KVM, its surrounding infrastructure,
and management tools. So mark your calendar and join us in advancing KVM.
We are colocated with The Linux Foundation's LinuxCon again this year.
Details regarding registration and proposal submission will be coming
later this week.
Thanks,
your KVM Forum 2011 Program Commitee
^ permalink raw reply
* Re: [PATCH] virtio_blk: decrement index when blockdevice is removed
From: Jens Axboe @ 2011-04-05 5:08 UTC (permalink / raw)
To: Takuma Umeya
Cc: john cooper, linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org, Tejun Heo,
Christoph Hellwig
In-Reply-To: <1969774563.659835.1301978981017.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
On 2011-04-05 06:49, Takuma Umeya wrote:
> When virtio block device is removed, index does not get decremented. When
> another virtio disk is attached it uses the next device letter to the
> one that is suppose to be available.
>
> Signed-off-by: Takuma Umeya <tumeya@redhat.com>
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 6ecf89c..730e7af 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -489,6 +489,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
> mempool_destroy(vblk->pool);
> vdev->config->del_vqs(vdev);
> kfree(vblk);
> + index--;
> }
>
> static const struct virtio_device_id id_table[] = {
What happens when you delete a device that isn't the last one?
--
Jens Axboe
^ permalink raw reply
* Re: [PATCH 07/07] Replaced printk with pr_info in hv_timesource
From: Greg KH @ 2011-04-05 5:00 UTC (permalink / raw)
To: Hank Janssen; +Cc: haiyangz, gregkh, linux-kernel, virtualization, devel
In-Reply-To: <1301432330-1705-8-git-send-email-hjanssen@microsoft.com>
On Tue, Mar 29, 2011 at 01:58:50PM -0700, Hank Janssen wrote:
> Replaced printk in hv_timesource with pr_ calls
>
> Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
>
> ---
> drivers/staging/hv/hv_timesource.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/staging/hv/hv_timesource.c b/drivers/staging/hv/hv_timesource.c
> index a7ee533..0efb049 100644
> --- a/drivers/staging/hv/hv_timesource.c
> +++ b/drivers/staging/hv/hv_timesource.c
> @@ -20,6 +20,7 @@
> * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
> *
> */
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>
> #include <linux/version.h>
> #include <linux/clocksource.h>
> @@ -91,7 +92,7 @@ static int __init init_hv_clocksource(void)
> if (!dmi_check_system(hv_timesource_dmi_table))
> return -ENODEV;
>
> - printk(KERN_INFO "Registering HyperV clock source\n");
> + pr_info("Registering HyperV clock source\n");
Why is this line even needed at all? Please remove it in future
patches.
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH 00/22] Staging: hv: Cleanup-storage-drivers-phase-III
From: Greg KH @ 2011-04-05 4:59 UTC (permalink / raw)
To: K. Y. Srinivasan; +Cc: devel, gregkh, linux-kernel, virtualization
In-Reply-To: <1301331615-26226-1-git-send-email-kys@microsoft.com>
On Mon, Mar 28, 2011 at 10:00:15AM -0700, K. Y. Srinivasan wrote:
> This patch-set deals with some of the style isues in blkvsc_drv.c. We also
> get rid most of the "dead code" in this file:
>
> 1) Get rid of most of the forward declarations in this file.
> The only remaining forward declarations are to deal with
> circular dependencies.
>
> 2) Get rid of most of the dead code in the file. Some of
> the functions in this file are place holders - they are not
> fuly implementedi yet (blkvsc_ioctl(), blkvsc_media_changed().
> We have retained some comments/dead code, to help us in the
> final implementation.
For some reason, this patch series fails to apply after the first one.
So I've not applied any of them, care to resync and resend?
thanks,
greg k-h
^ permalink raw reply
* [PATCH] virtio_blk: decrement index when blockdevice is removed
From: Takuma Umeya @ 2011-04-05 4:49 UTC (permalink / raw)
To: virtualization
Cc: john cooper, Jens Axboe, linux-kernel, Tejun Heo,
Christoph Hellwig
In-Reply-To: <1099995365.641718.1301903899721.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
When virtio block device is removed, index does not get decremented. When
another virtio disk is attached it uses the next device letter to the
one that is suppose to be available.
Signed-off-by: Takuma Umeya <tumeya@redhat.com>
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 6ecf89c..730e7af 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -489,6 +489,7 @@ static void __devexit virtblk_remove(struct virtio_device *vdev)
mempool_destroy(vblk->pool);
vdev->config->del_vqs(vdev);
kfree(vblk);
+ index--;
}
static const struct virtio_device_id id_table[] = {
--
Umeya, Takuma
Technical Account Manager
Red Hat GSS APAC
+81.3.5798.8584 (direct)
tumeya@redhat.com
^ permalink raw reply related
* [PATCH] virtio: decrement dev_index when device is unregistered
From: Takuma Umeya @ 2011-04-05 4:49 UTC (permalink / raw)
To: virtualization; +Cc: Stephen Hemminger, linux-kernel
In-Reply-To: <1457566934.641329.1301903526622.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com>
When virtio device is removed, dev_index does not get decremented.
The next device hotplug event results in consuming the next pci to
the one that is suppose to be available.
Signed-off-by: Takuma Umeya <tumeya@redhat.com>
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index efb35aa..67fe71d 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -216,6 +216,7 @@ EXPORT_SYMBOL_GPL(register_virtio_device);
void unregister_virtio_device(struct virtio_device *dev)
{
device_unregister(&dev->dev);
+ dev_index--;
}
EXPORT_SYMBOL_GPL(unregister_virtio_device);
--
Umeya, Takuma
Technical Account Manager
Red Hat GSS APAC
+81.3.5798.8584 (direct)
tumeya@redhat.com
^ permalink raw reply related
* Re: [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h
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
In-Reply-To: <20110405042805.GD8090@kroah.com>
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
* Re: [PATCH 01/16] Staging: hv: Add the inclusion guard for vstorage.h
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
In-Reply-To: <1300902635-1347-1-git-send-email-kys@microsoft.com>
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
* Re: [PATCH 04/12] Staging: hv: Rename vmbus_driver_context structure
From: Greg KH @ 2011-04-05 4:22 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang,
Mike Sterling, Abhishek Kane
In-Reply-To: <1300226624-27004-4-git-send-email-kys@microsoft.com>
On Tue, Mar 15, 2011 at 03:03:35PM -0700, K. Y. Srinivasan wrote:
> Now that struct vmbus_driver_context is properly
> cleaned up, rename this structure appropriately and
> cleanup the code.
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> ---
> drivers/staging/hv/vmbus_drv.c | 32 +++++++++++++++-----------------
> 1 files changed, 15 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> index 239b91c..f292b03 100644
> --- a/drivers/staging/hv/vmbus_drv.c
> +++ b/drivers/staging/hv/vmbus_drv.c
> @@ -41,7 +41,7 @@
> struct pci_dev *hv_pci_dev;
>
> /* Main vmbus driver data structure */
> -struct vmbus_driver_context {
> +struct hv_bus {
> struct bus_type bus;
> struct tasklet_struct msg_dpc;
> struct tasklet_struct event_dpc;
> @@ -99,7 +99,7 @@ static struct device_attribute vmbus_device_attrs[] = {
> };
>
> /* The one and only one */
> -static struct vmbus_driver_context vmbus_drv = {
> +static struct hv_bus hv_bus = {
2 spaces?
> .bus.name = "vmbus",
> .bus.match = vmbus_match,
> .bus.shutdown = vmbus_shutdown,
Wait, why is a bus_type embedded within another structure? That
is going to get pulled out later, right?
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH 03/12] Staging: hv: Cleanup irq management
From: Greg KH @ 2011-04-05 4:19 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang,
Mike Sterling, Abhishek Kane
In-Reply-To: <1300226624-27004-3-git-send-email-kys@microsoft.com>
On Tue, Mar 15, 2011 at 03:03:34PM -0700, K. Y. Srinivasan wrote:
> Now that vmbus_driver is a pci driver,
> cleanup the irq allocation mess by using the standard
> irq allocation mechanisms.
>
> Note that this patch generates an error when the checkpatch
> script is run because of the IRQF_SAMPLE_RANDOM flag used in
> request_irq() function. This interrupt may be the only
> external event this VM will get and consequently if this
> flag (IRQF_SAMPLE_RANDOM) is not specified, experimentally
> we have shown that the entropy in the VM will very very low.
>
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> ---
> drivers/staging/hv/vmbus_drv.c | 28 +++++++++++++---------------
> 1 files changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> index 3d2789b..239b91c 100644
> --- a/drivers/staging/hv/vmbus_drv.c
> +++ b/drivers/staging/hv/vmbus_drv.c
> @@ -17,6 +17,8 @@
> * Authors:
> * Haiyang Zhang <haiyangz@microsoft.com>
> * Hank Janssen <hjanssen@microsoft.com>
> + *
> + * 3/9/2011: K. Y. Srinivasan - Significant restructuring and cleanup
Changelog comments never belong in the file itself. If you consider
yourself an author of the file now, then put your name in it with the
others.
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH 01/12] Staging: hv: Make vmbus driver a pci driver
From: Greg KH @ 2011-04-05 4:16 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: Abhishek Kane, Haiyang Zhang, gregkh, linux-kernel,
virtualization, Mike Sterling, devel
In-Reply-To: <1300226624-27004-1-git-send-email-kys@microsoft.com>
On Tue, Mar 15, 2011 at 03:03:32PM -0700, K. Y. Srinivasan wrote:
> Make vmbus driver a pci driver. This is
> in preparation to cleaning up the root device
> management as well as the irq allocation for this
> driver.
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> ---
> drivers/staging/hv/vmbus_drv.c | 63 +++++++++++++++++++++++-----------------
> 1 files changed, 36 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> index b473f46..1ef2f0f 100644
> --- a/drivers/staging/hv/vmbus_drv.c
> +++ b/drivers/staging/hv/vmbus_drv.c
> @@ -40,6 +40,8 @@
> #define VMBUS_IRQ 0x5
> #define VMBUS_IRQ_VECTOR IRQ5_VECTOR
>
> +struct pci_dev *hv_pci_dev;
Why is this global?
Have you forgot to run 'sparse' on your changes?
thanks,
greg k-h
^ permalink raw reply
* [PATCH 22/22] Staging: hv: Get rid of IDE details from blkvsc_drv.c
From: K. Y. Srinivasan @ 2011-04-04 22:48 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
In-Reply-To: <1301957291-8035-1-git-send-email-kys@microsoft.com>
Now get rid of IDE details from blkvsc_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/blkvsc_drv.c | 56 ++++++++++++---------------------------
drivers/staging/hv/storvsc.c | 18 ++++++------
2 files changed, 26 insertions(+), 48 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 8874654..ca71cf5 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -952,11 +952,8 @@ static int blkvsc_probe(struct device *device)
struct block_device_context *blkdev = NULL;
struct storvsc_device_info device_info;
- int major = 0;
- int devnum = 0;
+ struct storvsc_major_info major_info;
int ret = 0;
- static int ide0_registered;
- static int ide1_registered;
blkdev = kzalloc(sizeof(struct block_device_context), GFP_KERNEL);
@@ -993,43 +990,23 @@ static int blkvsc_probe(struct device *device)
dev_set_drvdata(device, blkdev);
- /* Calculate the major and device num */
- if (blkdev->path == 0) {
- major = IDE0_MAJOR;
- devnum = blkdev->path + blkdev->target; /* 0 or 1 */
-
- if (!ide0_registered) {
- ret = register_blkdev(major, "ide");
- if (ret != 0) {
- DPRINT_ERR(BLKVSC_DRV,
- "register_blkdev() failed! ret %d",
- ret);
- goto remove;
- }
+ ret = stor_vsc_get_major_info(&device_info, &major_info);
- ide0_registered = 1;
- }
- } else if (blkdev->path == 1) {
- major = IDE1_MAJOR;
- devnum = blkdev->path + blkdev->target + 1; /* 2 or 3 */
-
- if (!ide1_registered) {
- ret = register_blkdev(major, "ide");
- if (ret != 0) {
- DPRINT_ERR(BLKVSC_DRV,
- "register_blkdev() failed! ret %d",
- ret);
- goto remove;
- }
+ if (ret)
+ goto cleanup;
+
+ if (major_info.do_register) {
+ ret = register_blkdev(major_info.major, major_info.devname);
- ide1_registered = 1;
+ if (ret != 0) {
+ DPRINT_ERR(BLKVSC_DRV,
+ "register_blkdev() failed! ret %d", ret);
+ goto remove;
}
- } else {
- ret = -1;
- goto cleanup;
}
- DPRINT_INFO(BLKVSC_DRV, "blkvsc registered for major %d!!", major);
+ DPRINT_INFO(BLKVSC_DRV, "blkvsc registered for major %d!!",
+ major_info.major);
blkdev->gd = alloc_disk(BLKVSC_MINORS);
if (!blkdev->gd) {
@@ -1045,15 +1022,16 @@ static int blkvsc_probe(struct device *device)
blk_queue_bounce_limit(blkdev->gd->queue, BLK_BOUNCE_ANY);
blk_queue_dma_alignment(blkdev->gd->queue, 511);
- blkdev->gd->major = major;
- if (devnum == 1 || devnum == 3)
+ blkdev->gd->major = major_info.major;
+
+ if (major_info.index == 1 || major_info.index == 3)
blkdev->gd->first_minor = BLKVSC_MINORS;
else
blkdev->gd->first_minor = 0;
blkdev->gd->fops = &block_ops;
blkdev->gd->private_data = blkdev;
blkdev->gd->driverfs_dev = &(blkdev->device_ctx->device);
- sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum);
+ sprintf(blkdev->gd->disk_name, "hd%c", 'a' + major_info.index);
blkvsc_do_operation(blkdev, DO_INQUIRY);
blkvsc_do_operation(blkdev, DO_CAPACITY);
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index e2b3410..85bae5a 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -629,26 +629,26 @@ int stor_vsc_get_major_info(struct storvsc_device_info *device_info,
if (device_info->path_id) {
major_info->major = 22;
- if (!ide1_registered)
+ if (!ide1_registered) {
major_info->do_register = true;
- else {
- major_info->do_register = false;
ide1_registered = true;
- }
+ } else
+ major_info->do_register = false;
+
if (device_info->target_id)
major_info->index = 3;
- else
+ else
major_info->index = 2;
return 0;
} else {
major_info->major = 3;
- if (!ide0_registered)
+ if (!ide0_registered) {
major_info->do_register = true;
- else {
- major_info->do_register = false;
ide0_registered = true;
- }
+ } else
+ major_info->do_register = false;
+
if (device_info->target_id)
major_info->index = 1;
else
--
1.7.4.1
^ permalink raw reply related
* [PATCH 21/22] Staging: hv: Introduce a function to map channel properties onto block device info
From: K. Y. Srinivasan @ 2011-04-04 22:48 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang
In-Reply-To: <1301957291-8035-1-git-send-email-kys@microsoft.com>
In preparation for removing the IDE details from the block driver, implement
a function that maps channel properties to block device information.
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 | 68 ++++++++++++++++++++++++++++++++++++++
drivers/staging/hv/storvsc_api.h | 10 +++++
2 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index d7ce393..e2b3410 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -17,6 +17,8 @@
* Authors:
* Haiyang Zhang <haiyangz@microsoft.com>
* Hank Janssen <hjanssen@microsoft.com>
+ *
+ * 4/3/2011: K. Y. Srinivasan - Significant restructuring and cleanup.
*/
#include <linux/kernel.h>
#include <linux/sched.h>
@@ -593,6 +595,72 @@ int stor_vsc_on_io_request(struct hv_device *device,
}
/*
+ * The channel properties uniquely specify how the device is to be
+ * presented to the guest. Map this information for use by the block
+ * driver. For Linux guests on Hyper-V, we emulate a scsi HBA in the guest
+ * (storvsc_drv) and so scsi devices in the guest are handled by
+ * native upper level Linux drivers. Consequently, Hyper-V
+ * block driver, while being a generic block driver, presently does not
+ * deal with anything other than devices that would need to be presented
+ * to the guest as an IDE disk.
+ *
+ * This function maps the channel properties as embedded in the input
+ * parameter device_info onto information necessary to register the
+ * corresponding block device.
+ *
+ * Currently, there is no way to stop the emulation of the block device
+ * on the host side. And so, to prevent the native IDE drivers in Linux
+ * from taking over these devices (to be managedby Hyper-V block
+ * driver), we will take over if need be the major of the IDE controllers.
+ *
+ */
+
+int stor_vsc_get_major_info(struct storvsc_device_info *device_info,
+ struct storvsc_major_info *major_info)
+{
+ static bool ide0_registered;
+ static bool ide1_registered;
+
+ /*
+ * For now we only support IDE disks.
+ */
+ major_info->devname = "ide";
+ major_info->diskname = "hd";
+
+ if (device_info->path_id) {
+ major_info->major = 22;
+ if (!ide1_registered)
+ major_info->do_register = true;
+ else {
+ major_info->do_register = false;
+ ide1_registered = true;
+ }
+ if (device_info->target_id)
+ major_info->index = 3;
+ else
+ major_info->index = 2;
+
+ return 0;
+ } else {
+ major_info->major = 3;
+ if (!ide0_registered)
+ major_info->do_register = true;
+ else {
+ major_info->do_register = false;
+ ide0_registered = true;
+ }
+ if (device_info->target_id)
+ major_info->index = 1;
+ else
+ major_info->index = 0;
+
+ return 0;
+ }
+
+ return -ENODEV;
+}
+
+/*
* stor_vsc_on_cleanup - Perform any cleanup when the driver is removed
*/
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 f6b7cde..630710d 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -91,6 +91,14 @@ struct storvsc_device_info {
unsigned char target_id;
};
+struct storvsc_major_info {
+ int major;
+ int index;
+ bool do_register;
+ char *devname;
+ char *diskname;
+};
+
/* A storvsc device is a device object that contains a vmbus channel */
struct storvsc_device {
struct hv_device *device;
@@ -154,5 +162,7 @@ int stor_vsc_on_io_request(struct hv_device *device,
struct hv_storvsc_request *request);
void stor_vsc_on_cleanup(struct hv_driver *driver);
+int stor_vsc_get_major_info(struct storvsc_device_info *device_info,
+ struct storvsc_major_info *major_info);
#endif /* _STORVSC_API_H_ */
--
1.7.4.1
^ permalink raw reply related
* [PATCH 20/22] Staging: hv: Fix a jump label (Remove) in blkvsc_drv.c
From: K. Y. Srinivasan @ 2011-04-04 22:48 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization
Cc: K. Y. Srinivasan, Haiyang Zhang, Hank Janssen
In-Reply-To: <1301957291-8035-1-git-send-email-kys@microsoft.com>
One of the jump labels was named Remove; change it to remove.
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 | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 0891bc2..8874654 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -1004,7 +1004,7 @@ static int blkvsc_probe(struct device *device)
DPRINT_ERR(BLKVSC_DRV,
"register_blkdev() failed! ret %d",
ret);
- goto Remove;
+ goto remove;
}
ide0_registered = 1;
@@ -1019,7 +1019,7 @@ static int blkvsc_probe(struct device *device)
DPRINT_ERR(BLKVSC_DRV,
"register_blkdev() failed! ret %d",
ret);
- goto Remove;
+ goto remove;
}
ide1_registered = 1;
@@ -1069,7 +1069,7 @@ static int blkvsc_probe(struct device *device)
return ret;
-Remove:
+remove:
storvsc_drv_obj->base.dev_rm(device_obj);
cleanup:
--
1.7.4.1
^ permalink raw reply related
* [PATCH 19/22] Staging: hv: Fix a jump label (Cleanup) in blkvsc_drv
From: K. Y. Srinivasan @ 2011-04-04 22:48 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang
In-Reply-To: <1301957291-8035-1-git-send-email-kys@microsoft.com>
One of the goto labels was named Cleanup; change it to cleanup.
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 | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 05a0e87..0891bc2 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -962,7 +962,7 @@ static int blkvsc_probe(struct device *device)
blkdev = kzalloc(sizeof(struct block_device_context), GFP_KERNEL);
if (!blkdev) {
ret = -ENOMEM;
- goto Cleanup;
+ goto cleanup;
}
INIT_LIST_HEAD(&blkdev->pending_list);
@@ -976,14 +976,14 @@ static int blkvsc_probe(struct device *device)
SLAB_HWCACHE_ALIGN, NULL);
if (!blkdev->request_pool) {
ret = -ENOMEM;
- goto Cleanup;
+ goto cleanup;
}
/* Call to the vsc driver to add the device */
ret = storvsc_drv_obj->base.dev_add(device_obj, &device_info);
if (ret != 0)
- goto Cleanup;
+ goto cleanup;
blkdev->device_ctx = device_obj;
/* this identified the device 0 or 1 */
@@ -1026,7 +1026,7 @@ static int blkvsc_probe(struct device *device)
}
} else {
ret = -1;
- goto Cleanup;
+ goto cleanup;
}
DPRINT_INFO(BLKVSC_DRV, "blkvsc registered for major %d!!", major);
@@ -1034,7 +1034,7 @@ static int blkvsc_probe(struct device *device)
blkdev->gd = alloc_disk(BLKVSC_MINORS);
if (!blkdev->gd) {
ret = -1;
- goto Cleanup;
+ goto cleanup;
}
blkdev->gd->queue = blk_init_queue(blkvsc_request, &blkdev->lock);
@@ -1072,7 +1072,7 @@ static int blkvsc_probe(struct device *device)
Remove:
storvsc_drv_obj->base.dev_rm(device_obj);
-Cleanup:
+cleanup:
if (blkdev) {
if (blkdev->request_pool) {
kmem_cache_destroy(blkdev->request_pool);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 18/22] Staging: hv: Cleanup blkvsc_open()
From: K. Y. Srinivasan @ 2011-04-04 22:48 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang
In-Reply-To: <1301957291-8035-1-git-send-email-kys@microsoft.com>
Given that we don't support removable media, cleanup blkvsc_open()
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 | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 7f511ee..05a0e87 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -254,20 +254,12 @@ static int blkvsc_open(struct block_device *bdev, fmode_t mode)
{
struct block_device_context *blkdev = bdev->bd_disk->private_data;
-
- mutex_lock(&blkvsc_mutex);
spin_lock(&blkdev->lock);
- if (!blkdev->users && blkdev->device_type == DVD_TYPE) {
- spin_unlock(&blkdev->lock);
- check_disk_change(bdev);
- spin_lock(&blkdev->lock);
- }
-
blkdev->users++;
spin_unlock(&blkdev->lock);
- mutex_unlock(&blkvsc_mutex);
+
return 0;
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 17/22] Staging: hv: Get rid of an unnecessary check in blkvsc_probe()
From: K. Y. Srinivasan @ 2011-04-04 22:48 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang
In-Reply-To: <1301957291-8035-1-git-send-email-kys@microsoft.com>
It is never the case that the dev_add function pointer will not be set
(we set it in this code!). Get rid of this meaningless check.
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 | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index aff6356..7f511ee 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -967,11 +967,6 @@ static int blkvsc_probe(struct device *device)
static int ide1_registered;
- if (!storvsc_drv_obj->base.dev_add) {
- ret = -1;
- goto Cleanup;
- }
-
blkdev = kzalloc(sizeof(struct block_device_context), GFP_KERNEL);
if (!blkdev) {
ret = -ENOMEM;
--
1.7.4.1
^ permalink raw reply related
* [PATCH 16/22] Staging: hv: Get rid of some DPRINT_ERR() calls
From: K. Y. Srinivasan @ 2011-04-04 22:48 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang
In-Reply-To: <1301957291-8035-1-git-send-email-kys@microsoft.com>
Get rid of some DPRINT_ERR() calls.
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 | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 03aebfc..aff6356 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -17,6 +17,8 @@
* Authors:
* Haiyang Zhang <haiyangz@microsoft.com>
* Hank Janssen <hjanssen@microsoft.com>
+ *
+ * 4/3/2011: K. Y. Srinivasan - Significant restructuring and cleanup.
*/
#include <linux/init.h>
#include <linux/module.h>
@@ -966,7 +968,6 @@ static int blkvsc_probe(struct device *device)
if (!storvsc_drv_obj->base.dev_add) {
- DPRINT_ERR(BLKVSC_DRV, "OnDeviceAdd() not set");
ret = -1;
goto Cleanup;
}
@@ -994,10 +995,8 @@ static int blkvsc_probe(struct device *device)
/* Call to the vsc driver to add the device */
ret = storvsc_drv_obj->base.dev_add(device_obj, &device_info);
- if (ret != 0) {
- DPRINT_ERR(BLKVSC_DRV, "unable to add blkvsc device");
+ if (ret != 0)
goto Cleanup;
- }
blkdev->device_ctx = device_obj;
/* this identified the device 0 or 1 */
@@ -1039,7 +1038,6 @@ static int blkvsc_probe(struct device *device)
ide1_registered = 1;
}
} else {
- DPRINT_ERR(BLKVSC_DRV, "invalid pathid");
ret = -1;
goto Cleanup;
}
@@ -1048,7 +1046,6 @@ static int blkvsc_probe(struct device *device)
blkdev->gd = alloc_disk(BLKVSC_MINORS);
if (!blkdev->gd) {
- DPRINT_ERR(BLKVSC_DRV, "register_blkdev() failed! ret %d", ret);
ret = -1;
goto Cleanup;
}
--
1.7.4.1
^ permalink raw reply related
* [PATCH 15/22] Staging: hv: Get rid of the code to manage removable media
From: K. Y. Srinivasan @ 2011-04-04 22:48 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang
In-Reply-To: <1301957291-8035-1-git-send-email-kys@microsoft.com>
The Hyper-V block driver does not handle removable media.
Get rid of the code to manage removable media.
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 | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index c0a7acd..03aebfc 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -436,8 +436,6 @@ static int blkvsc_do_operation(struct block_device_context *blkdev,
if (device_type == 0x0)
blkdev->device_type = HARDDISK_TYPE;
- else if (device_type == 0x5)
- blkdev->device_type = DVD_TYPE;
else
blkdev->device_type = UNKNOWN_DEV_TYPE;
@@ -1074,12 +1072,7 @@ static int blkvsc_probe(struct device *device)
sprintf(blkdev->gd->disk_name, "hd%c", 'a' + devnum);
blkvsc_do_operation(blkdev, DO_INQUIRY);
- if (blkdev->device_type == DVD_TYPE) {
- set_disk_ro(blkdev->gd, 1);
- blkdev->gd->flags |= GENHD_FL_REMOVABLE;
- blkvsc_do_operation(blkdev, DO_CAPACITY);
- } else
- blkvsc_do_operation(blkdev, DO_CAPACITY);
+ blkvsc_do_operation(blkdev, DO_CAPACITY);
set_capacity(blkdev->gd, blkdev->capacity * (blkdev->sector_size/512));
blk_queue_logical_block_size(blkdev->gd->queue, blkdev->sector_size);
--
1.7.4.1
^ permalink raw reply related
* [PATCH 14/22] Staging: hv: Cleanup storvsc_remove()
From: K. Y. Srinivasan @ 2011-04-04 22:48 UTC (permalink / raw)
To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang
In-Reply-To: <1301957291-8035-1-git-send-email-kys@microsoft.com>
storvsc_remove() cannot fail, clean it up accordingly.
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 | 14 ++------------
1 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index ae61735..f819c6a 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -404,7 +404,6 @@ static int storvsc_probe(struct device *device)
*/
static int storvsc_remove(struct device *device)
{
- int ret;
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct storvsc_driver_object *storvsc_drv_obj = drv->priv;
@@ -413,20 +412,11 @@ static int storvsc_remove(struct device *device)
struct host_device_context *host_device_ctx =
(struct host_device_context *)host->hostdata;
-
- 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(STORVSC, "unable to remove vsc device (ret %d)",
- ret);
- }
+ storvsc_drv_obj->base.dev_rm(device_obj);
if (host_device_ctx->request_pool) {
kmem_cache_destroy(host_device_ctx->request_pool);
@@ -438,7 +428,7 @@ static int storvsc_remove(struct device *device)
DPRINT_INFO(STORVSC, "releasing host adapter (%p)...", host);
scsi_host_put(host);
- return ret;
+ return 0;
}
/*
--
1.7.4.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox