Linux virtualization list
 help / color / mirror / Atom feed
* [PATCH 18/20] Staging: hv: Move the data_buffer field from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation of consolidating all I/O request state,
move the data_buffer field from struct hv_storvsc_request
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/blkvsc_drv.c  |   46 ++++++++++++++++++++-----------------
 drivers/staging/hv/storvsc.c     |   10 +++++---
 drivers/staging/hv/storvsc_api.h |    2 +-
 drivers/staging/hv/storvsc_drv.c |   13 +++++-----
 4 files changed, 39 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index c05a242..782441d 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -520,9 +520,9 @@ static int blkvsc_do_flush(struct block_device_context *blkdev)
 	blkvsc_req->req = NULL;
 	blkvsc_req->write = 0;
 
-	blkvsc_req->request.data_buffer.pfn_array[0] = 0;
-	blkvsc_req->request.data_buffer.offset = 0;
-	blkvsc_req->request.data_buffer.len = 0;
+	blkvsc_req->request.extension.data_buffer.pfn_array[0] = 0;
+	blkvsc_req->request.extension.data_buffer.offset = 0;
+	blkvsc_req->request.extension.data_buffer.len = 0;
 
 	blkvsc_req->cmnd[0] = SYNCHRONIZE_CACHE;
 	blkvsc_req->cmd_len = 10;
@@ -567,9 +567,10 @@ static int blkvsc_do_inquiry(struct block_device_context *blkdev)
 	blkvsc_req->req = NULL;
 	blkvsc_req->write = 0;
 
-	blkvsc_req->request.data_buffer.pfn_array[0] = page_to_pfn(page_buf);
-	blkvsc_req->request.data_buffer.offset = 0;
-	blkvsc_req->request.data_buffer.len = 64;
+	blkvsc_req->request.extension.data_buffer.pfn_array[0] =
+	page_to_pfn(page_buf);
+	blkvsc_req->request.extension.data_buffer.offset = 0;
+	blkvsc_req->request.extension.data_buffer.len = 64;
 
 	blkvsc_req->cmnd[0] = INQUIRY;
 	blkvsc_req->cmnd[1] = 0x1;		/* Get product data */
@@ -656,9 +657,10 @@ static int blkvsc_do_read_capacity(struct block_device_context *blkdev)
 	blkvsc_req->req = NULL;
 	blkvsc_req->write = 0;
 
-	blkvsc_req->request.data_buffer.pfn_array[0] = page_to_pfn(page_buf);
-	blkvsc_req->request.data_buffer.offset = 0;
-	blkvsc_req->request.data_buffer.len = 8;
+	blkvsc_req->request.extension.data_buffer.pfn_array[0] =
+	page_to_pfn(page_buf);
+	blkvsc_req->request.extension.data_buffer.offset = 0;
+	blkvsc_req->request.extension.data_buffer.len = 8;
 
 	blkvsc_req->cmnd[0] = READ_CAPACITY;
 	blkvsc_req->cmd_len = 16;
@@ -735,9 +737,10 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
 	blkvsc_req->req = NULL;
 	blkvsc_req->write = 0;
 
-	blkvsc_req->request.data_buffer.pfn_array[0] = page_to_pfn(page_buf);
-	blkvsc_req->request.data_buffer.offset = 0;
-	blkvsc_req->request.data_buffer.len = 12;
+	blkvsc_req->request.extension.data_buffer.pfn_array[0] =
+	page_to_pfn(page_buf);
+	blkvsc_req->request.extension.data_buffer.offset = 0;
+	blkvsc_req->request.extension.data_buffer.len = 12;
 
 	blkvsc_req->cmnd[0] = 0x9E; /* READ_CAPACITY16; */
 	blkvsc_req->cmd_len = 16;
@@ -926,8 +929,8 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 		   (blkvsc_req->write) ? "WRITE" : "READ",
 		   (unsigned long) blkvsc_req->sector_start,
 		   blkvsc_req->sector_count,
-		   blkvsc_req->request.data_buffer.offset,
-		   blkvsc_req->request.data_buffer.len);
+		   blkvsc_req->request.extension.data_buffer.offset,
+		   blkvsc_req->request.extension.data_buffer.len);
 #if 0
 	for (i = 0; i < (blkvsc_req->request.data_buffer.len >> 12); i++) {
 		DPRINT_DBG(BLKVSC_DRV, "blkvsc_submit_request() - "
@@ -1054,10 +1057,11 @@ static int blkvsc_do_request(struct block_device_context *blkdev,
 
 					blkvsc_req->dev = blkdev;
 					blkvsc_req->req = req;
-					blkvsc_req->request.data_buffer.offset
-						= bvec->bv_offset;
-					blkvsc_req->request.data_buffer.len
-						= 0;
+					blkvsc_req->request.extension.
+					data_buffer.offset
+					= bvec->bv_offset;
+					blkvsc_req->request.extension.
+					data_buffer.len = 0;
 
 					/* Add to the group */
 					blkvsc_req->group = group;
@@ -1071,10 +1075,10 @@ static int blkvsc_do_request(struct block_device_context *blkdev,
 				}
 
 				/* Add the curr bvec/segment to the curr blkvsc_req */
-				blkvsc_req->request.data_buffer.
+				blkvsc_req->request.extension.data_buffer.
 					pfn_array[databuf_idx]
 						= page_to_pfn(bvec->bv_page);
-				blkvsc_req->request.data_buffer.len
+				blkvsc_req->request.extension.data_buffer.len
 					+= bvec->bv_len;
 
 				prev_bvec = bvec;
@@ -1180,7 +1184,7 @@ static void blkvsc_request_completion(struct hv_storvsc_request *request)
 		   (blkvsc_req->write) ? "WRITE" : "READ",
 		   (unsigned long)blkvsc_req->sector_start,
 		   blkvsc_req->sector_count,
-		   blkvsc_req->request.data_buffer.len,
+		   blkvsc_req->request.extension.data_buffer.len,
 		   blkvsc_req->group->outstanding,
 		   blkdev->num_outstanding_reqs);
 
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 6a45d57..0fdbd34 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -529,7 +529,7 @@ int stor_vsc_on_io_request(struct hv_device *device,
 		   request_extension);
 
 	DPRINT_DBG(STORVSC, "req %p len %d",
-		   request, request->data_buffer.len);
+		   request, request->extension.data_buffer.len);
 
 	if (!stor_device) {
 		DPRINT_ERR(STORVSC, "unable to get stor device..."
@@ -549,7 +549,8 @@ int stor_vsc_on_io_request(struct hv_device *device,
 	vstor_packet->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;
 
 
-	vstor_packet->vm_srb.data_transfer_length = request->data_buffer.len;
+	vstor_packet->vm_srb.data_transfer_length =
+	request->extension.data_buffer.len;
 
 	vstor_packet->operation = VSTOR_OPERATION_EXECUTE_SRB;
 
@@ -563,9 +564,10 @@ int stor_vsc_on_io_request(struct hv_device *device,
 		   vstor_packet->vm_srb.sense_info_length,
 		   vstor_packet->vm_srb.cdb_length);
 
-	if (request_extension->request->data_buffer.len) {
+	if (request_extension->request->extension.data_buffer.len) {
 		ret = vmbus_sendpacket_multipagebuffer(device->channel,
-				&request_extension->request->data_buffer,
+				&request_extension->request->extension.
+				data_buffer,
 				vstor_packet,
 				sizeof(struct vstor_packet),
 				(unsigned long)request_extension);
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 1705b9f..f4b7031 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -65,6 +65,7 @@ struct storvsc_request_extension {
 	unsigned char *sense_buffer;
 	void *context;
 	void (*on_io_completion)(struct hv_storvsc_request *request);
+	struct hv_multipage_buffer data_buffer;
 
 	struct vstor_packet vstor_packet;
 };
@@ -73,7 +74,6 @@ struct hv_storvsc_request {
 
 	struct storvsc_request_extension extension;
 
-	struct hv_multipage_buffer data_buffer;
 };
 
 /* Represents the block vsc driver */
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index a2faaef..54be899 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -485,7 +485,8 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
 
 	/* ASSERT(request->BytesXfer <= request->data_buffer.Length); */
 	scsi_set_resid(scmnd,
-		request->data_buffer.len - vm_srb->data_transfer_length);
+		request->extension.data_buffer.len -
+		vm_srb->data_transfer_length);
 
 	scsi_done_fn = scmnd->scsi_done;
 
@@ -789,7 +790,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 	request->extension.sense_buffer = scmnd->sense_buffer;
 
 
-	request->data_buffer.len = scsi_bufflen(scmnd);
+	request->extension.data_buffer.len = scsi_bufflen(scmnd);
 	if (scsi_sg_count(scmnd)) {
 		sgl = (struct scatterlist *)scsi_sglist(scmnd);
 		sg_count = scsi_sg_count(scmnd);
@@ -830,19 +831,19 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 			sg_count = cmd_request->bounce_sgl_count;
 		}
 
-		request->data_buffer.offset = sgl[0].offset;
+		request->extension.data_buffer.offset = sgl[0].offset;
 
 		for (i = 0; i < sg_count; i++) {
 			DPRINT_DBG(STORVSC_DRV, "sgl[%d] len %d offset %d\n",
 				   i, sgl[i].length, sgl[i].offset);
-			request->data_buffer.pfn_array[i] =
+			request->extension.data_buffer.pfn_array[i] =
 				page_to_pfn(sg_page((&sgl[i])));
 		}
 	} else if (scsi_sglist(scmnd)) {
 		/* ASSERT(scsi_bufflen(scmnd) <= PAGE_SIZE); */
-		request->data_buffer.offset =
+		request->extension.data_buffer.offset =
 			virt_to_phys(scsi_sglist(scmnd)) & (PAGE_SIZE-1);
-		request->data_buffer.pfn_array[0] =
+		request->extension.data_buffer.pfn_array[0] =
 			virt_to_phys(scsi_sglist(scmnd)) >> PAGE_SHIFT;
 	}
 
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 17/20] Staging: hv: Get rid of the status field from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization
  Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation of consolidating all I/O request state,
get rid of the  status field from struct hv_storvsc_request
and instead use the state in the struct vmscsi_request directly.

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  |   23 ++++++++++++++++++-----
 drivers/staging/hv/storvsc.c     |    8 +++-----
 drivers/staging/hv/storvsc_api.h |    3 ---
 drivers/staging/hv/storvsc_drv.c |    6 ++++--
 4 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 0e3b193..c05a242 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -631,6 +631,7 @@ static int blkvsc_do_read_capacity(struct block_device_context *blkdev)
 	struct page *page_buf;
 	unsigned char *buf;
 	struct scsi_sense_hdr sense_hdr;
+	struct vmscsi_request *vm_srb;
 
 	DPRINT_DBG(BLKVSC_DRV, "blkvsc_do_read_capacity()\n");
 
@@ -649,6 +650,7 @@ static int blkvsc_do_read_capacity(struct block_device_context *blkdev)
 		return -ENOMEM;
 	}
 
+	vm_srb = &blkvsc_req->request.extension.vstor_packet.vm_srb;
 	init_waitqueue_head(&blkvsc_req->wevent);
 	blkvsc_req->dev = blkdev;
 	blkvsc_req->req = NULL;
@@ -675,7 +677,7 @@ static int blkvsc_do_read_capacity(struct block_device_context *blkdev)
 	wait_event_interruptible(blkvsc_req->wevent, blkvsc_req->cond);
 
 	/* check error */
-	if (blkvsc_req->request.status) {
+	if (vm_srb->scsi_status) {
 		scsi_normalize_sense(blkvsc_req->sense_buffer,
 				     SCSI_SENSE_BUFFERSIZE, &sense_hdr);
 
@@ -708,6 +710,7 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
 	struct page *page_buf;
 	unsigned char *buf;
 	struct scsi_sense_hdr sense_hdr;
+	struct vmscsi_request *vm_srb;
 
 	DPRINT_DBG(BLKVSC_DRV, "blkvsc_do_read_capacity16()\n");
 
@@ -720,6 +723,7 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
 		return -ENOMEM;
 
 	memset(blkvsc_req, 0, sizeof(struct blkvsc_request));
+	vm_srb = &blkvsc_req->request.extension.vstor_packet.vm_srb;
 	page_buf = alloc_page(GFP_KERNEL);
 	if (!page_buf) {
 		kmem_cache_free(blkvsc_req->dev->request_pool, blkvsc_req);
@@ -752,7 +756,7 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
 	wait_event_interruptible(blkvsc_req->wevent, blkvsc_req->cond);
 
 	/* check error */
-	if (blkvsc_req->request.status) {
+	if (vm_srb->scsi_status) {
 		scsi_normalize_sense(blkvsc_req->sense_buffer,
 				     SCSI_SENSE_BUFFERSIZE, &sense_hdr);
 		if (sense_hdr.asc == 0x3A) {
@@ -1140,13 +1144,15 @@ static void blkvsc_cmd_completion(struct hv_storvsc_request *request)
 	struct block_device_context *blkdev =
 			(struct block_device_context *)blkvsc_req->dev;
 	struct scsi_sense_hdr sense_hdr;
+	struct vmscsi_request *vm_srb;
 
 	DPRINT_DBG(BLKVSC_DRV, "blkvsc_cmd_completion() - req %p\n",
 		   blkvsc_req);
 
+	vm_srb = &blkvsc_req->request.extension.vstor_packet.vm_srb;
 	blkdev->num_outstanding_reqs--;
 
-	if (blkvsc_req->request.status)
+	if (vm_srb->scsi_status)
 		if (scsi_normalize_sense(blkvsc_req->sense_buffer,
 					 SCSI_SENSE_BUFFERSIZE, &sense_hdr))
 			scsi_print_sense_hdr("blkvsc", &sense_hdr);
@@ -1163,6 +1169,7 @@ static void blkvsc_request_completion(struct hv_storvsc_request *request)
 			(struct block_device_context *)blkvsc_req->dev;
 	unsigned long flags;
 	struct blkvsc_request *comp_req, *tmp;
+	struct vmscsi_request *vm_srb;
 
 	/* ASSERT(blkvsc_req->group); */
 
@@ -1199,8 +1206,10 @@ static void blkvsc_request_completion(struct hv_storvsc_request *request)
 
 			list_del(&comp_req->req_entry);
 
+			vm_srb =
+			&comp_req->request.extension.vstor_packet.vm_srb;
 			if (!__blk_end_request(comp_req->req,
-				(!comp_req->request.status ? 0 : -EIO),
+				(!vm_srb->scsi_status ? 0 : -EIO),
 				comp_req->sector_count * blkdev->sector_size)) {
 				/*
 				 * All the sectors have been xferred ie the
@@ -1229,6 +1238,7 @@ static int blkvsc_cancel_pending_reqs(struct block_device_context *blkdev)
 {
 	struct blkvsc_request *pend_req, *tmp;
 	struct blkvsc_request *comp_req, *tmp2;
+	struct vmscsi_request *vm_srb;
 
 	int ret = 0;
 
@@ -1257,8 +1267,11 @@ static int blkvsc_cancel_pending_reqs(struct block_device_context *blkdev)
 			list_del(&comp_req->req_entry);
 
 			if (comp_req->req) {
+				vm_srb =
+				&comp_req->request.extension.vstor_packet.
+				vm_srb;
 				ret = __blk_end_request(comp_req->req,
-					(!comp_req->request.status ? 0 : -EIO),
+					(!vm_srb->scsi_status ? 0 : -EIO),
 					comp_req->sector_count *
 					blkdev->sector_size);
 
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index d444cc9..6a45d57 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -296,9 +296,9 @@ static void stor_vsc_on_io_completion(struct hv_device *device,
 
 
 	/* Copy over the status...etc */
-	request->status = vstor_packet->vm_srb.scsi_status;
 
-	if (request->status != 0 || vstor_packet->vm_srb.srb_status != 1) {
+	if (vstor_packet->vm_srb.scsi_status != 0 ||
+		vstor_packet->vm_srb.srb_status != 1) {
 		DPRINT_WARN(STORVSC,
 			    "cmd 0x%x scsi status 0x%x srb status 0x%x\n",
 			    vstor_packet->vm_srb.cdb[0],
@@ -306,7 +306,7 @@ static void stor_vsc_on_io_completion(struct hv_device *device,
 			    vstor_packet->vm_srb.srb_status);
 	}
 
-	if ((request->status & 0xFF) == 0x02) {
+	if ((vstor_packet->vm_srb.scsi_status & 0xFF) == 0x02) {
 		/* CHECK_CONDITION */
 		if (vstor_packet->vm_srb.srb_status & 0x80) {
 			/* autosense data available */
@@ -321,8 +321,6 @@ static void stor_vsc_on_io_completion(struct hv_device *device,
 		}
 	}
 
-	/* TODO: */
-	request->bytes_xfer = vstor_packet->vm_srb.data_transfer_length;
 
 	request->extension.on_io_completion(request);
 
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 89fa155..1705b9f 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -70,9 +70,6 @@ struct storvsc_request_extension {
 };
 
 struct hv_storvsc_request {
-	u32 status;
-	u32 bytes_xfer;
-
 
 	struct storvsc_request_extension extension;
 
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index e3e0486..a2faaef 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -454,6 +454,7 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
 		(struct host_device_context *)scmnd->device->host->hostdata;
 	void (*scsi_done_fn)(struct scsi_cmnd *);
 	struct scsi_sense_hdr sense_hdr;
+	struct vmscsi_request *vm_srb;
 
 	/* ASSERT(request == &cmd_request->request); */
 	/* ASSERT(scmnd); */
@@ -473,7 +474,8 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
 				      cmd_request->bounce_sgl_count);
 	}
 
-	scmnd->result = request->status;
+	vm_srb = &request->extension.vstor_packet.vm_srb;
+	scmnd->result = vm_srb->scsi_status;
 
 	if (scmnd->result) {
 		if (scsi_normalize_sense(scmnd->sense_buffer,
@@ -483,7 +485,7 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
 
 	/* ASSERT(request->BytesXfer <= request->data_buffer.Length); */
 	scsi_set_resid(scmnd,
-		request->data_buffer.len - request->bytes_xfer);
+		request->data_buffer.len - vm_srb->data_transfer_length);
 
 	scsi_done_fn = scmnd->scsi_done;
 
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 16/20] Staging: hv: Move on_io_completion() from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation of consolidating all I/O request state, move
the on_io_completion() field from struct hv_storvsc_request to
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/blkvsc_drv.c  |    2 +-
 drivers/staging/hv/storvsc.c     |    2 +-
 drivers/staging/hv/storvsc_api.h |    2 +-
 drivers/staging/hv/storvsc_drv.c |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 83c4ba3..0e3b193 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -938,7 +938,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 
 	vm_srb->data_in = blkvsc_req->write ? WRITE_TYPE : READ_TYPE;
 
-	storvsc_req->on_io_completion = request_completion;
+	storvsc_req->extension.on_io_completion = request_completion;
 	storvsc_req->extension.context = blkvsc_req;
 
 	vm_srb->port_number = blkdev->port;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 33943ed..d444cc9 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -324,7 +324,7 @@ static void stor_vsc_on_io_completion(struct hv_device *device,
 	/* TODO: */
 	request->bytes_xfer = vstor_packet->vm_srb.data_transfer_length;
 
-	request->on_io_completion(request);
+	request->extension.on_io_completion(request);
 
 	atomic_dec(&stor_device->num_outstanding_req);
 
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 68c5036..89fa155 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -64,6 +64,7 @@ struct storvsc_request_extension {
 
 	unsigned char *sense_buffer;
 	void *context;
+	void (*on_io_completion)(struct hv_storvsc_request *request);
 
 	struct vstor_packet vstor_packet;
 };
@@ -72,7 +73,6 @@ struct hv_storvsc_request {
 	u32 status;
 	u32 bytes_xfer;
 
-	void (*on_io_completion)(struct hv_storvsc_request *request);
 
 	struct storvsc_request_extension extension;
 
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 65e03e6..e3e0486 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -770,7 +770,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 		break;
 	}
 
-	request->on_io_completion = storvsc_commmand_completion;
+	request->extension.on_io_completion = storvsc_commmand_completion;
 	request->extension.context = cmd_request;/* scmnd; */
 
 	/* request->PortId = scmnd->device->channel; */
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 15/20] Staging: hv: Move the context field from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation of consolidating all I/O request state, move
the context field from struct hv_storvsc_request to
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/blkvsc_drv.c  |    6 +++---
 drivers/staging/hv/storvsc_api.h |    3 +--
 drivers/staging/hv/storvsc_drv.c |    4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index be7fae5..83c4ba3 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -939,7 +939,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 	vm_srb->data_in = blkvsc_req->write ? WRITE_TYPE : READ_TYPE;
 
 	storvsc_req->on_io_completion = request_completion;
-	storvsc_req->context = blkvsc_req;
+	storvsc_req->extension.context = blkvsc_req;
 
 	vm_srb->port_number = blkdev->port;
 	vm_srb->path_id = blkdev->path;
@@ -1136,7 +1136,7 @@ static int blkvsc_do_request(struct block_device_context *blkdev,
 static void blkvsc_cmd_completion(struct hv_storvsc_request *request)
 {
 	struct blkvsc_request *blkvsc_req =
-			(struct blkvsc_request *)request->context;
+			(struct blkvsc_request *)request->extension.context;
 	struct block_device_context *blkdev =
 			(struct block_device_context *)blkvsc_req->dev;
 	struct scsi_sense_hdr sense_hdr;
@@ -1158,7 +1158,7 @@ static void blkvsc_cmd_completion(struct hv_storvsc_request *request)
 static void blkvsc_request_completion(struct hv_storvsc_request *request)
 {
 	struct blkvsc_request *blkvsc_req =
-			(struct blkvsc_request *)request->context;
+			(struct blkvsc_request *)request->extension.context;
 	struct block_device_context *blkdev =
 			(struct block_device_context *)blkvsc_req->dev;
 	unsigned long flags;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index fd9165f..68c5036 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -63,6 +63,7 @@ struct storvsc_request_extension {
 	struct completion wait_event;
 
 	unsigned char *sense_buffer;
+	void *context;
 
 	struct vstor_packet vstor_packet;
 };
@@ -71,8 +72,6 @@ struct hv_storvsc_request {
 	u32 status;
 	u32 bytes_xfer;
 
-	void *context;
-
 	void (*on_io_completion)(struct hv_storvsc_request *request);
 
 	struct storvsc_request_extension extension;
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 3a999d0..65e03e6 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -448,7 +448,7 @@ static int storvsc_remove(struct device *device)
 static void storvsc_commmand_completion(struct hv_storvsc_request *request)
 {
 	struct storvsc_cmd_request *cmd_request =
-		(struct storvsc_cmd_request *)request->context;
+		(struct storvsc_cmd_request *)request->extension.context;
 	struct scsi_cmnd *scmnd = cmd_request->cmd;
 	struct host_device_context *host_device_ctx =
 		(struct host_device_context *)scmnd->device->host->hostdata;
@@ -771,7 +771,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 	}
 
 	request->on_io_completion = storvsc_commmand_completion;
-	request->context = cmd_request;/* scmnd; */
+	request->extension.context = cmd_request;/* scmnd; */
 
 	/* request->PortId = scmnd->device->channel; */
 	vm_srb->port_number = host_device_ctx->port;
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 14/20] Staging: hv: Move sense_buffer field
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization
  Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation for consolidating all I/O request state,
move sense_buffer field from struct hv_storvsc_request
to 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/blkvsc_drv.c  |    2 +-
 drivers/staging/hv/storvsc.c     |    2 +-
 drivers/staging/hv/storvsc_api.h |    4 ++--
 drivers/staging/hv/storvsc_drv.c |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 04117be..be7fae5 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -950,7 +950,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 
 	memcpy(vm_srb->cdb, blkvsc_req->cmnd, vm_srb->cdb_length);
 
-	storvsc_req->sense_buffer = blkvsc_req->sense_buffer;
+	storvsc_req->extension.sense_buffer = blkvsc_req->sense_buffer;
 
 	ret = storvsc_drv_obj->on_io_request(blkdev->device_ctx,
 					   &blkvsc_req->request);
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index b322f86..33943ed 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -314,7 +314,7 @@ static void stor_vsc_on_io_completion(struct hv_device *device,
 				    "valid - len %d\n", request_ext,
 				    vstor_packet->vm_srb.sense_info_length);
 
-			memcpy(request->sense_buffer,
+			memcpy(request->extension.sense_buffer,
 			       vstor_packet->vm_srb.sense_data,
 			       vstor_packet->vm_srb.sense_info_length);
 
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 3eccc27..fd9165f 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -62,6 +62,8 @@ struct storvsc_request_extension {
 	/* Synchronize the request/response if needed */
 	struct completion wait_event;
 
+	unsigned char *sense_buffer;
+
 	struct vstor_packet vstor_packet;
 };
 
@@ -69,8 +71,6 @@ struct hv_storvsc_request {
 	u32 status;
 	u32 bytes_xfer;
 
-	unsigned char *sense_buffer;
-
 	void *context;
 
 	void (*on_io_completion)(struct hv_storvsc_request *request);
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index bc435d6..3a999d0 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -784,7 +784,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 
 	memcpy(vm_srb->cdb, scmnd->cmnd, vm_srb->cdb_length);
 
-	request->sense_buffer = scmnd->sense_buffer;
+	request->extension.sense_buffer = scmnd->sense_buffer;
 
 
 	request->data_buffer.len = scsi_bufflen(scmnd);
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 13/20] Staging: hv: Get rid of sense_buffer_size from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization
  Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation for consolidating all I/O request state, get rid of the
sense_buffer_size field from struct hv_storvsc_request and instead
hardcode this value as is currently done.

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  |    1 -
 drivers/staging/hv/storvsc.c     |    2 --
 drivers/staging/hv/storvsc_api.h |    1 -
 drivers/staging/hv/storvsc_drv.c |    3 +--
 4 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index a156930..04117be 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -951,7 +951,6 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 	memcpy(vm_srb->cdb, blkvsc_req->cmnd, vm_srb->cdb_length);
 
 	storvsc_req->sense_buffer = blkvsc_req->sense_buffer;
-	storvsc_req->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;
 
 	ret = storvsc_drv_obj->on_io_request(blkdev->device_ctx,
 					   &blkvsc_req->request);
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index ca41c05..b322f86 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -318,8 +318,6 @@ static void stor_vsc_on_io_completion(struct hv_device *device,
 			       vstor_packet->vm_srb.sense_data,
 			       vstor_packet->vm_srb.sense_info_length);
 
-			request->sense_buffer_size =
-					vstor_packet->vm_srb.sense_info_length;
 		}
 	}
 
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 55c5cc6..3eccc27 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -70,7 +70,6 @@ struct hv_storvsc_request {
 	u32 bytes_xfer;
 
 	unsigned char *sense_buffer;
-	u32 sense_buffer_size;
 
 	void *context;
 
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 08c2df4..bc435d6 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -477,7 +477,7 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
 
 	if (scmnd->result) {
 		if (scsi_normalize_sense(scmnd->sense_buffer,
-				request->sense_buffer_size, &sense_hdr))
+				SCSI_SENSE_BUFFERSIZE, &sense_hdr))
 			scsi_print_sense_hdr("storvsc", &sense_hdr);
 	}
 
@@ -785,7 +785,6 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 	memcpy(vm_srb->cdb, scmnd->cmnd, vm_srb->cdb_length);
 
 	request->sense_buffer = scmnd->sense_buffer;
-	request->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;
 
 
 	request->data_buffer.len = scsi_bufflen(scmnd);
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 12/20] Staging: hv: Get rid of cdb from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation for consolidating all I/O request state, get rid of the
cdb field from struct hv_storvsc_request and instead
directly copy the command into struct vmscsi_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  |    3 ++-
 drivers/staging/hv/storvsc.c     |    6 ++----
 drivers/staging/hv/storvsc_api.h |    1 -
 drivers/staging/hv/storvsc_drv.c |    3 ++-
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 3db622d..a156930 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -947,7 +947,8 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 	vm_srb->lun = 0;	 /* this is not really used at all */
 
 	vm_srb->cdb_length = blkvsc_req->cmd_len;
-	storvsc_req->cdb = blkvsc_req->cmnd;
+
+	memcpy(vm_srb->cdb, blkvsc_req->cmnd, vm_srb->cdb_length);
 
 	storvsc_req->sense_buffer = blkvsc_req->sense_buffer;
 	storvsc_req->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 5a5065c..ca41c05 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -301,7 +301,8 @@ static void stor_vsc_on_io_completion(struct hv_device *device,
 	if (request->status != 0 || vstor_packet->vm_srb.srb_status != 1) {
 		DPRINT_WARN(STORVSC,
 			    "cmd 0x%x scsi status 0x%x srb status 0x%x\n",
-			    request->cdb[0], vstor_packet->vm_srb.scsi_status,
+			    vstor_packet->vm_srb.cdb[0],
+			    vstor_packet->vm_srb.scsi_status,
 			    vstor_packet->vm_srb.srb_status);
 	}
 
@@ -551,9 +552,6 @@ int stor_vsc_on_io_request(struct hv_device *device,
 
 	vstor_packet->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;
 
-	/* Copy over the scsi command descriptor block */
-	memcpy(&vstor_packet->vm_srb.cdb, request->cdb,
-		 vstor_packet->vm_srb.cdb_length);
 
 	vstor_packet->vm_srb.data_transfer_length = request->data_buffer.len;
 
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index fd3af2b..55c5cc6 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -66,7 +66,6 @@ struct storvsc_request_extension {
 };
 
 struct hv_storvsc_request {
-	u8 *cdb;
 	u32 status;
 	u32 bytes_xfer;
 
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index c0ccae2..08c2df4 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -781,7 +781,8 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 
 	/* ASSERT(scmnd->cmd_len <= 16); */
 	vm_srb->cdb_length = scmnd->cmd_len;
-	request->cdb = scmnd->cmnd;
+
+	memcpy(vm_srb->cdb, scmnd->cmnd, vm_srb->cdb_length);
 
 	request->sense_buffer = scmnd->sense_buffer;
 	request->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 11/20] Staging: hv: Get rid of the cdb_len from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation for consolidating all I/O request state, get rid of the
cdb_len field from struct hv_storvsc_request and instead use the
equivalent  state in struct vmscsi_request - cdb_length field.

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  |    2 +-
 drivers/staging/hv/storvsc.c     |    9 ++++-----
 drivers/staging/hv/storvsc_api.h |    1 -
 drivers/staging/hv/storvsc_drv.c |    2 +-
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index f440734..3db622d 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -946,7 +946,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 	vm_srb->target_id = blkdev->target;
 	vm_srb->lun = 0;	 /* this is not really used at all */
 
-	storvsc_req->cdb_len = blkvsc_req->cmd_len;
+	vm_srb->cdb_length = blkvsc_req->cmd_len;
 	storvsc_req->cdb = blkvsc_req->cmnd;
 
 	storvsc_req->sense_buffer = blkvsc_req->sense_buffer;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 849b467..5a5065c 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -531,9 +531,8 @@ int stor_vsc_on_io_request(struct hv_device *device,
 		   "Extension %p", device, stor_device, request,
 		   request_extension);
 
-	DPRINT_DBG(STORVSC, "req %p len %d cdblen %d",
-		   request, request->data_buffer.len,
-		   request->cdb_len);
+	DPRINT_DBG(STORVSC, "req %p len %d",
+		   request, request->data_buffer.len);
 
 	if (!stor_device) {
 		DPRINT_ERR(STORVSC, "unable to get stor device..."
@@ -553,8 +552,8 @@ int stor_vsc_on_io_request(struct hv_device *device,
 	vstor_packet->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;
 
 	/* Copy over the scsi command descriptor block */
-	vstor_packet->vm_srb.cdb_length = request->cdb_len;
-	memcpy(&vstor_packet->vm_srb.cdb, request->cdb, request->cdb_len);
+	memcpy(&vstor_packet->vm_srb.cdb, request->cdb,
+		 vstor_packet->vm_srb.cdb_length);
 
 	vstor_packet->vm_srb.data_transfer_length = request->data_buffer.len;
 
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 940cf98..fd3af2b 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -67,7 +67,6 @@ struct storvsc_request_extension {
 
 struct hv_storvsc_request {
 	u8 *cdb;
-	u32 cdb_len;
 	u32 status;
 	u32 bytes_xfer;
 
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index d30d745..c0ccae2 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -780,7 +780,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 	vm_srb->lun = scmnd->device->lun;
 
 	/* ASSERT(scmnd->cmd_len <= 16); */
-	request->cdb_len = scmnd->cmd_len;
+	vm_srb->cdb_length = scmnd->cmd_len;
 	request->cdb = scmnd->cmnd;
 
 	request->sense_buffer = scmnd->sense_buffer;
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 10/20] Staging: hv: Get rid of lun_id from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation for consolidating all I/O request state, get rid of the
lun_id field from struct hv_storvsc_request and instead use the
equivalent  state in struct vmscsi_request - lun field.

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  |    2 +-
 drivers/staging/hv/storvsc.c     |    5 ++---
 drivers/staging/hv/storvsc_api.h |    1 -
 drivers/staging/hv/storvsc_drv.c |    2 +-
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index ec01662..f440734 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -944,7 +944,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 	vm_srb->port_number = blkdev->port;
 	vm_srb->path_id = blkdev->path;
 	vm_srb->target_id = blkdev->target;
-	storvsc_req->lun_id = 0;	 /* this is not really used at all */
+	vm_srb->lun = 0;	 /* this is not really used at all */
 
 	storvsc_req->cdb_len = blkvsc_req->cmd_len;
 	storvsc_req->cdb = blkvsc_req->cmnd;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 2282ba2..849b467 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -531,9 +531,9 @@ int stor_vsc_on_io_request(struct hv_device *device,
 		   "Extension %p", device, stor_device, request,
 		   request_extension);
 
-	DPRINT_DBG(STORVSC, "req %p len %d lun %d cdblen %d",
+	DPRINT_DBG(STORVSC, "req %p len %d cdblen %d",
 		   request, request->data_buffer.len,
-		   request->lun_id, request->cdb_len);
+		   request->cdb_len);
 
 	if (!stor_device) {
 		DPRINT_ERR(STORVSC, "unable to get stor device..."
@@ -549,7 +549,6 @@ int stor_vsc_on_io_request(struct hv_device *device,
 
 	vstor_packet->vm_srb.length = sizeof(struct vmscsi_request);
 
-	vstor_packet->vm_srb.lun = request->lun_id;
 
 	vstor_packet->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;
 
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 54690ad..940cf98 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -66,7 +66,6 @@ struct storvsc_request_extension {
 };
 
 struct hv_storvsc_request {
-	u32 lun_id;
 	u8 *cdb;
 	u32 cdb_len;
 	u32 status;
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index c77ddc1..d30d745 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -777,7 +777,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 	vm_srb->port_number = host_device_ctx->port;
 	vm_srb->path_id = scmnd->device->channel;
 	vm_srb->target_id = scmnd->device->id;
-	request->lun_id = scmnd->device->lun;
+	vm_srb->lun = scmnd->device->lun;
 
 	/* ASSERT(scmnd->cmd_len <= 16); */
 	request->cdb_len = scmnd->cmd_len;
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 09/20] Staging: hv: Get rid of the target_id from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation for consolidating all I/O request state, get rid of the
target_id field from struct hv_storvsc_request and instead use the
equivalent  state in struct vmscsi_request - target_id field.

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  |    2 +-
 drivers/staging/hv/storvsc.c     |    5 ++---
 drivers/staging/hv/storvsc_api.h |    1 -
 drivers/staging/hv/storvsc_drv.c |    2 +-
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index a679e18..ec01662 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -943,7 +943,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 
 	vm_srb->port_number = blkdev->port;
 	vm_srb->path_id = blkdev->path;
-	storvsc_req->target_id = blkdev->target;
+	vm_srb->target_id = blkdev->target;
 	storvsc_req->lun_id = 0;	 /* this is not really used at all */
 
 	storvsc_req->cdb_len = blkvsc_req->cmd_len;
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index c307922..2282ba2 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -531,9 +531,9 @@ int stor_vsc_on_io_request(struct hv_device *device,
 		   "Extension %p", device, stor_device, request,
 		   request_extension);
 
-	DPRINT_DBG(STORVSC, "req %p len %d  target %d, lun %d cdblen %d",
+	DPRINT_DBG(STORVSC, "req %p len %d lun %d cdblen %d",
 		   request, request->data_buffer.len,
-		   request->target_id, request->lun_id, request->cdb_len);
+		   request->lun_id, request->cdb_len);
 
 	if (!stor_device) {
 		DPRINT_ERR(STORVSC, "unable to get stor device..."
@@ -549,7 +549,6 @@ int stor_vsc_on_io_request(struct hv_device *device,
 
 	vstor_packet->vm_srb.length = sizeof(struct vmscsi_request);
 
-	vstor_packet->vm_srb.target_id = request->target_id;
 	vstor_packet->vm_srb.lun = request->lun_id;
 
 	vstor_packet->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 07a391b..54690ad 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -66,7 +66,6 @@ struct storvsc_request_extension {
 };
 
 struct hv_storvsc_request {
-	u32 target_id;
 	u32 lun_id;
 	u8 *cdb;
 	u32 cdb_len;
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 05339bf..c77ddc1 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -776,7 +776,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 	/* request->PortId = scmnd->device->channel; */
 	vm_srb->port_number = host_device_ctx->port;
 	vm_srb->path_id = scmnd->device->channel;
-	request->target_id = scmnd->device->id;
+	vm_srb->target_id = scmnd->device->id;
 	request->lun_id = scmnd->device->lun;
 
 	/* ASSERT(scmnd->cmd_len <= 16); */
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 08/20] Staging: hv: Get rid of the bus field from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation for consolidating all I/O request state, get rid of the
bus field from struct hv_storvsc_request and instead use the
equivalent  state in struct vmscsi_request - path_id field.

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  |    2 +-
 drivers/staging/hv/storvsc.c     |    5 ++---
 drivers/staging/hv/storvsc_api.h |    1 -
 drivers/staging/hv/storvsc_drv.c |    2 +-
 4 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index eb184ff..a679e18 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -942,7 +942,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 	storvsc_req->context = blkvsc_req;
 
 	vm_srb->port_number = blkdev->port;
-	storvsc_req->bus = blkdev->path;
+	vm_srb->path_id = blkdev->path;
 	storvsc_req->target_id = blkdev->target;
 	storvsc_req->lun_id = 0;	 /* this is not really used at all */
 
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 7273f77..c307922 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -531,8 +531,8 @@ int stor_vsc_on_io_request(struct hv_device *device,
 		   "Extension %p", device, stor_device, request,
 		   request_extension);
 
-	DPRINT_DBG(STORVSC, "req %p len %d bus %d, target %d, lun %d cdblen %d",
-		   request, request->data_buffer.len, request->bus,
+	DPRINT_DBG(STORVSC, "req %p len %d  target %d, lun %d cdblen %d",
+		   request, request->data_buffer.len,
 		   request->target_id, request->lun_id, request->cdb_len);
 
 	if (!stor_device) {
@@ -549,7 +549,6 @@ int stor_vsc_on_io_request(struct hv_device *device,
 
 	vstor_packet->vm_srb.length = sizeof(struct vmscsi_request);
 
-	vstor_packet->vm_srb.path_id = request->bus;
 	vstor_packet->vm_srb.target_id = request->target_id;
 	vstor_packet->vm_srb.lun = request->lun_id;
 
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index f9dc4f1..07a391b 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -66,7 +66,6 @@ struct storvsc_request_extension {
 };
 
 struct hv_storvsc_request {
-	u32 bus;
 	u32 target_id;
 	u32 lun_id;
 	u8 *cdb;
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 05bcab6..05339bf 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -775,7 +775,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 
 	/* request->PortId = scmnd->device->channel; */
 	vm_srb->port_number = host_device_ctx->port;
-	request->bus = scmnd->device->channel;
+	vm_srb->path_id = scmnd->device->channel;
 	request->target_id = scmnd->device->id;
 	request->lun_id = scmnd->device->lun;
 
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 07/20] Staging: hv: Get rid of the host field from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization
  Cc: K. Y. Srinivasan, Haiyang Zhang, Abhishek Kane, Hank Janssen
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation for consolidating all I/O request state, get rid of the
host field from struct hv_storvsc_request and instead use the
equivalent  state in struct vmscsi_request - port_number field.

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  |    2 +-
 drivers/staging/hv/storvsc.c     |    1 -
 drivers/staging/hv/storvsc_api.h |    1 -
 drivers/staging/hv/storvsc_drv.c |    2 +-
 4 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 00bc226..eb184ff 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -941,7 +941,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 	storvsc_req->on_io_completion = request_completion;
 	storvsc_req->context = blkvsc_req;
 
-	storvsc_req->host = blkdev->port;
+	vm_srb->port_number = blkdev->port;
 	storvsc_req->bus = blkdev->path;
 	storvsc_req->target_id = blkdev->target;
 	storvsc_req->lun_id = 0;	 /* this is not really used at all */
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index b580c30..7273f77 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -549,7 +549,6 @@ int stor_vsc_on_io_request(struct hv_device *device,
 
 	vstor_packet->vm_srb.length = sizeof(struct vmscsi_request);
 
-	vstor_packet->vm_srb.port_number = request->host;
 	vstor_packet->vm_srb.path_id = request->bus;
 	vstor_packet->vm_srb.target_id = request->target_id;
 	vstor_packet->vm_srb.lun = request->lun_id;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 27781f4..f9dc4f1 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -66,7 +66,6 @@ struct storvsc_request_extension {
 };
 
 struct hv_storvsc_request {
-	u32 host;
 	u32 bus;
 	u32 target_id;
 	u32 lun_id;
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index b08423b..05bcab6 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -774,7 +774,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 	request->context = cmd_request;/* scmnd; */
 
 	/* request->PortId = scmnd->device->channel; */
-	request->host = host_device_ctx->port;
+	vm_srb->port_number = host_device_ctx->port;
 	request->bus = scmnd->device->channel;
 	request->target_id = scmnd->device->id;
 	request->lun_id = scmnd->device->lun;
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 06/20] Staging: hv: Get rid of the type field from struct hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

In preparation for consolidating all I/O request state, get rid of the
type field from struct hv_storvsc_request and instead use the
equivalent  state in struct vmscsi_request - data_in field.
In the current code there is a call to zero out the struct vstor_packet in
stor_vsc_on_io_request(). So, to be able to directly set the state in the
vstor_packet in blkvsc_drv.c and storvsc_drv.c, get rid of the call to
zero out the packet in stor_vsc_on_io_request() and instead allocate the 
request structure that has been zeroed out. 

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  |   18 +++++++++++-------
 drivers/staging/hv/storvsc.c     |    3 ---
 drivers/staging/hv/storvsc_api.h |    1 -
 drivers/staging/hv/storvsc_drv.c |    8 +++++---
 4 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 1e5320e..00bc226 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -510,7 +510,7 @@ static int blkvsc_do_flush(struct block_device_context *blkdev)
 	if (blkdev->device_type != HARDDISK_TYPE)
 		return 0;
 
-	blkvsc_req = kmem_cache_alloc(blkdev->request_pool, GFP_KERNEL);
+	blkvsc_req = kmem_cache_zalloc(blkdev->request_pool, GFP_KERNEL);
 	if (!blkvsc_req)
 		return -ENOMEM;
 
@@ -551,7 +551,7 @@ static int blkvsc_do_inquiry(struct block_device_context *blkdev)
 
 	DPRINT_DBG(BLKVSC_DRV, "blkvsc_do_inquiry()\n");
 
-	blkvsc_req = kmem_cache_alloc(blkdev->request_pool, GFP_KERNEL);
+	blkvsc_req = kmem_cache_zalloc(blkdev->request_pool, GFP_KERNEL);
 	if (!blkvsc_req)
 		return -ENOMEM;
 
@@ -638,7 +638,7 @@ static int blkvsc_do_read_capacity(struct block_device_context *blkdev)
 	blkdev->capacity = 0;
 	blkdev->media_not_present = 0; /* assume a disk is present */
 
-	blkvsc_req = kmem_cache_alloc(blkdev->request_pool, GFP_KERNEL);
+	blkvsc_req = kmem_cache_zalloc(blkdev->request_pool, GFP_KERNEL);
 	if (!blkvsc_req)
 		return -ENOMEM;
 
@@ -715,7 +715,7 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
 	blkdev->capacity = 0;
 	blkdev->media_not_present = 0; /* assume a disk is present */
 
-	blkvsc_req = kmem_cache_alloc(blkdev->request_pool, GFP_KERNEL);
+	blkvsc_req = kmem_cache_zalloc(blkdev->request_pool, GFP_KERNEL);
 	if (!blkvsc_req)
 		return -ENOMEM;
 
@@ -913,6 +913,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 	struct storvsc_driver_object *storvsc_drv_obj =
 			drv->priv;
 	struct hv_storvsc_request *storvsc_req;
+	struct vmscsi_request *vm_srb;
 	int ret;
 
 	DPRINT_DBG(BLKVSC_DRV, "blkvsc_submit_request() - "
@@ -933,8 +934,9 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 #endif
 
 	storvsc_req = &blkvsc_req->request;
+	vm_srb = &storvsc_req->extension.vstor_packet.vm_srb;
 
-	storvsc_req->type = blkvsc_req->write ? WRITE_TYPE : READ_TYPE;
+	vm_srb->data_in = blkvsc_req->write ? WRITE_TYPE : READ_TYPE;
 
 	storvsc_req->on_io_completion = request_completion;
 	storvsc_req->context = blkvsc_req;
@@ -983,7 +985,7 @@ static int blkvsc_do_request(struct block_device_context *blkdev,
 		  (unsigned long)blk_rq_pos(req));
 
 	/* Create a group to tie req to list of blkvsc_reqs */
-	group = kmem_cache_alloc(blkdev->request_pool, GFP_ATOMIC);
+	group = kmem_cache_zalloc(blkdev->request_pool, GFP_ATOMIC);
 	if (!group)
 		return -ENOMEM;
 
@@ -1026,7 +1028,9 @@ static int blkvsc_do_request(struct block_device_context *blkdev,
 					 * Create new blkvsc_req to represent
 					 * the current bvec
 					 */
-					blkvsc_req = kmem_cache_alloc(blkdev->request_pool, GFP_ATOMIC);
+					blkvsc_req =
+					kmem_cache_zalloc(
+					blkdev->request_pool, GFP_ATOMIC);
 					if (!blkvsc_req) {
 						/* free up everything */
 						list_for_each_entry_safe(
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 8dc17b9..b580c30 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -545,8 +545,6 @@ int stor_vsc_on_io_request(struct hv_device *device,
 	request_extension->request = request;
 	request_extension->device  = device;
 
-	memset(vstor_packet, 0 , sizeof(struct vstor_packet));
-
 	vstor_packet->flags |= REQUEST_COMPLETION_FLAG;
 
 	vstor_packet->vm_srb.length = sizeof(struct vmscsi_request);
@@ -562,7 +560,6 @@ int stor_vsc_on_io_request(struct hv_device *device,
 	vstor_packet->vm_srb.cdb_length = request->cdb_len;
 	memcpy(&vstor_packet->vm_srb.cdb, request->cdb, request->cdb_len);
 
-	vstor_packet->vm_srb.data_in = request->type;
 	vstor_packet->vm_srb.data_transfer_length = request->data_buffer.len;
 
 	vstor_packet->operation = VSTOR_OPERATION_EXECUTE_SRB;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index cdef1c7..27781f4 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -66,7 +66,6 @@ struct storvsc_request_extension {
 };
 
 struct hv_storvsc_request {
-	enum storvsc_request_type type;
 	u32 host;
 	u32 bus;
 	u32 target_id;
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index c2a3a5b..b08423b 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -709,6 +709,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 	int i;
 	struct scatterlist *sgl;
 	unsigned int sg_count = 0;
+	struct vmscsi_request *vm_srb;
 
 	DPRINT_DBG(STORVSC_DRV, "scmnd %p dir %d, use_sg %d buf %p len %d "
 		   "queue depth %d tagged %d", scmnd, scmnd->sc_data_direction,
@@ -752,19 +753,20 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 	scmnd->host_scribble = (unsigned char *)cmd_request;
 
 	request = &cmd_request->request;
+	vm_srb = &request->extension.vstor_packet.vm_srb;
 
 	DPRINT_DBG(STORVSC_DRV, "req %p size %d", request, request_size);
 
 	/* Build the SRB */
 	switch (scmnd->sc_data_direction) {
 	case DMA_TO_DEVICE:
-		request->type = WRITE_TYPE;
+		vm_srb->data_in = WRITE_TYPE;
 		break;
 	case DMA_FROM_DEVICE:
-		request->type = READ_TYPE;
+		vm_srb->data_in = READ_TYPE;
 		break;
 	default:
-		request->type = UNKNOWN_TYPE;
+		vm_srb->data_in = UNKNOWN_TYPE;
 		break;
 	}
 
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 05/20] Staging: hv: Use struct completion in struct storvsc_request_extension
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

Get rid of the wait_queue mechanism for synchronization in
struct storvsc_request_extension and instead use completion
mechanism.

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.c     |   34 ++++++++++++----------------------
 drivers/staging/hv/storvsc_api.h |    3 +--
 drivers/staging/hv/storvsc_drv.c |   10 ++++------
 3 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 5cea331..8dc17b9 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -20,7 +20,7 @@
  */
 #include <linux/kernel.h>
 #include <linux/sched.h>
-#include <linux/wait.h>
+#include <linux/completion.h>
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
@@ -107,7 +107,7 @@ static int stor_vsc_channel_init(struct hv_device *device)
 	struct storvsc_device *stor_device;
 	struct storvsc_request_extension *request;
 	struct vstor_packet *vstor_packet;
-	int ret;
+	int ret, t;
 
 	stor_device = get_stor_device(device);
 	if (!stor_device) {
@@ -124,13 +124,12 @@ static int stor_vsc_channel_init(struct hv_device *device)
 	 * channel
 	 */
 	memset(request, 0, sizeof(struct storvsc_request_extension));
-	init_waitqueue_head(&request->wait_event);
+	init_completion(&request->wait_event);
 	vstor_packet->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION;
 	vstor_packet->flags = REQUEST_COMPLETION_FLAG;
 
 	DPRINT_INFO(STORVSC, "BEGIN_INITIALIZATION_OPERATION...");
 
-	request->wait_condition = 0;
 	ret = vmbus_sendpacket(device->channel, vstor_packet,
 			       sizeof(struct vstor_packet),
 			       (unsigned long)request,
@@ -142,14 +141,12 @@ static int stor_vsc_channel_init(struct hv_device *device)
 		goto cleanup;
 	}
 
-	wait_event_timeout(request->wait_event, request->wait_condition,
-			msecs_to_jiffies(1000));
-	if (request->wait_condition == 0) {
+	t = wait_for_completion_timeout(&request->wait_event, HZ);
+	if (t == 0) {
 		ret = -ETIMEDOUT;
 		goto cleanup;
 	}
 
-
 	if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
 	    vstor_packet->status != 0) {
 		DPRINT_ERR(STORVSC, "BEGIN_INITIALIZATION_OPERATION failed "
@@ -168,7 +165,6 @@ static int stor_vsc_channel_init(struct hv_device *device)
 	vstor_packet->version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT;
 	FILL_VMSTOR_REVISION(vstor_packet->version.revision);
 
-	request->wait_condition = 0;
 	ret = vmbus_sendpacket(device->channel, vstor_packet,
 			       sizeof(struct vstor_packet),
 			       (unsigned long)request,
@@ -180,9 +176,8 @@ static int stor_vsc_channel_init(struct hv_device *device)
 		goto cleanup;
 	}
 
-	wait_event_timeout(request->wait_event, request->wait_condition,
-			msecs_to_jiffies(1000));
-	if (request->wait_condition == 0) {
+	t = wait_for_completion_timeout(&request->wait_event, HZ);
+	if (t == 0) {
 		ret = -ETIMEDOUT;
 		goto cleanup;
 	}
@@ -205,7 +200,6 @@ static int stor_vsc_channel_init(struct hv_device *device)
 	vstor_packet->storage_channel_properties.port_number =
 					stor_device->port_number;
 
-	request->wait_condition = 0;
 	ret = vmbus_sendpacket(device->channel, vstor_packet,
 			       sizeof(struct vstor_packet),
 			       (unsigned long)request,
@@ -218,9 +212,8 @@ static int stor_vsc_channel_init(struct hv_device *device)
 		goto cleanup;
 	}
 
-	wait_event_timeout(request->wait_event, request->wait_condition,
-			msecs_to_jiffies(1000));
-	if (request->wait_condition == 0) {
+	t = wait_for_completion_timeout(&request->wait_event, HZ);
+	if (t == 0) {
 		ret = -ETIMEDOUT;
 		goto cleanup;
 	}
@@ -248,7 +241,6 @@ static int stor_vsc_channel_init(struct hv_device *device)
 	vstor_packet->operation = VSTOR_OPERATION_END_INITIALIZATION;
 	vstor_packet->flags = REQUEST_COMPLETION_FLAG;
 
-	request->wait_condition = 0;
 	ret = vmbus_sendpacket(device->channel, vstor_packet,
 			       sizeof(struct vstor_packet),
 			       (unsigned long)request,
@@ -261,9 +253,8 @@ static int stor_vsc_channel_init(struct hv_device *device)
 		goto cleanup;
 	}
 
-	wait_event_timeout(request->wait_event, request->wait_condition,
-			msecs_to_jiffies(1000));
-	if (request->wait_condition == 0) {
+	t = wait_for_completion_timeout(&request->wait_event, HZ);
+	if (t == 0) {
 		ret = -ETIMEDOUT;
 		goto cleanup;
 	}
@@ -397,8 +388,7 @@ static void stor_vsc_on_channel_callback(void *context)
 
 				memcpy(&request->vstor_packet, packet,
 				       sizeof(struct vstor_packet));
-				request->wait_condition = 1;
-				wake_up(&request->wait_event);
+				complete(&request->wait_event);
 			} else {
 				stor_vsc_on_receive(device,
 						(struct vstor_packet *)packet,
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 5c80cdb..cdef1c7 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -60,8 +60,7 @@ struct storvsc_request_extension {
 	struct hv_device *device;
 
 	/* Synchronize the request/response if needed */
-	int wait_condition;
-	wait_queue_head_t wait_event;
+	struct completion wait_event;
 
 	struct vstor_packet vstor_packet;
 };
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 268c607..c2a3a5b 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -231,7 +231,7 @@ static 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;
+	int ret, t;
 
 	DPRINT_INFO(STORVSC, "resetting host adapter...");
 
@@ -245,13 +245,12 @@ static int stor_vsc_on_host_reset(struct hv_device *device)
 	request = &stor_device->reset_request;
 	vstor_packet = &request->vstor_packet;
 
-	init_waitqueue_head(&request->wait_event);
+	init_completion(&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,
@@ -263,9 +262,8 @@ static int stor_vsc_on_host_reset(struct hv_device *device)
 		goto cleanup;
 	}
 
-	wait_event_timeout(request->wait_event, request->wait_condition,
-			msecs_to_jiffies(1000));
-	if (request->wait_condition == 0) {
+	t = wait_for_completion_timeout(&request->wait_event, HZ);
+	if (t == 0) {
 		ret = -ETIMEDOUT;
 		goto cleanup;
 	}
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 04/20] Staging: hv: Add a function to map a hv_driver pointer to storvsc driver
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

Get rid of the need for struct hv_device to be the first
element of struct host_device_context.

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  |    2 +-
 drivers/staging/hv/storvsc_api.h |    8 ++++++--
 drivers/staging/hv/storvsc_drv.c |    2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 3672e15..1e5320e 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -154,7 +154,7 @@ static int blk_vsc_initialize(struct hv_driver *driver)
 	struct storvsc_driver_object *stor_driver;
 	int ret = 0;
 
-	stor_driver = (struct storvsc_driver_object *)driver;
+	stor_driver = hvdr_to_stordr(driver);
 
 	/* Make sure we are at least 2 pages since 1 page is used for control */
 	/* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index eeaeaef..5c80cdb 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 <linux/kernel.h>
 #include "vstorage.h"
 #include "vmbus_api.h"
 
@@ -90,8 +91,6 @@ struct hv_storvsc_request {
 
 /* Represents the block vsc driver */
 struct storvsc_driver_object {
-	/* Must be the first field */
-	/* Which is a bug FIXME! */
 	struct hv_driver base;
 
 	/* Set by caller (in bytes) */
@@ -159,6 +158,11 @@ static inline void put_stor_device(struct hv_device *device)
 	atomic_dec(&stor_device->ref_count);
 }
 
+static inline struct storvsc_driver_object *hvdr_to_stordr(struct hv_driver *d)
+{
+	return container_of(d, struct storvsc_driver_object, base);
+}
+
 /* Interface */
 
 int stor_vsc_on_device_add(struct hv_device *device,
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 1d13f1b..268c607 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -79,7 +79,7 @@ static int stor_vsc_initialize(struct hv_driver *driver)
 {
 	struct storvsc_driver_object *stor_driver;
 
-	stor_driver = (struct storvsc_driver_object *)driver;
+	stor_driver = hvdr_to_stordr(driver);
 
 	DPRINT_DBG(STORVSC, "sizeof(STORVSC_REQUEST)=%zd "
 		   "sizeof(struct storvsc_request_extension)=%zd "
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 03/20] Staging: hv: Get rid of request_ext_size from struct storvsc_driver_object
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-1-git-send-email-kys@microsoft.com>

Now that struct storvsc_request_extension is part of struct hv_storvsc_request
get rid of the field request_ext_size from struct storvsc_driver_object.

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  |    5 +----
 drivers/staging/hv/storvsc_api.h |    3 ---
 drivers/staging/hv/storvsc_drv.c |   11 +++--------
 3 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 9ceaa99..3672e15 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -162,8 +162,6 @@ static int blk_vsc_initialize(struct hv_driver *driver)
 	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
@@ -346,8 +344,7 @@ static int blkvsc_probe(struct device *device)
 	/* 	sizeof(struct blkvsc_request)); */
 
 	blkdev->request_pool = kmem_cache_create(dev_name(&device_obj->device),
-					sizeof(struct blkvsc_request) +
-					storvsc_drv_obj->request_ext_size, 0,
+					sizeof(struct blkvsc_request), 0,
 					SLAB_HWCACHE_ALIGN, NULL);
 	if (!blkdev->request_pool) {
 		ret = -ENOMEM;
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index e41b68b..eeaeaef 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -97,9 +97,6 @@ struct storvsc_driver_object {
 	/* Set by caller (in bytes) */
 	u32 ring_buffer_size;
 
-	/* Allocate this much private extension for each I/O request */
-	u32 request_ext_size;
-
 	/* Maximum # of requests in flight per channel/device */
 	u32 max_outstanding_req_per_channel;
 
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 58d12e0..1d13f1b 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -96,8 +96,6 @@ static int stor_vsc_initialize(struct hv_driver *driver)
 	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
@@ -203,8 +201,7 @@ static int storvsc_drv_init(void)
 	drv->priv = storvsc_drv_obj;
 
 	DPRINT_INFO(STORVSC_DRV,
-		    "request extension size %u, max outstanding reqs %u",
-		    storvsc_drv_obj->request_ext_size,
+		    "max outstanding reqs %u",
 		    storvsc_drv_obj->max_outstanding_req_per_channel);
 
 	if (storvsc_drv_obj->max_outstanding_req_per_channel <
@@ -359,8 +356,7 @@ static int storvsc_probe(struct device *device)
 
 	host_device_ctx->request_pool =
 				kmem_cache_create(dev_name(&device_obj->device),
-					sizeof(struct storvsc_cmd_request) +
-					storvsc_drv_obj->request_ext_size, 0,
+					sizeof(struct storvsc_cmd_request), 0,
 					SLAB_HWCACHE_ALIGN, NULL);
 
 	if (!host_device_ctx->request_pool) {
@@ -759,8 +755,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 
 	request = &cmd_request->request;
 
-	DPRINT_DBG(STORVSC_DRV, "req %p size %d ext %d", request, request_size,
-		   storvsc_drv_obj->request_ext_size);
+	DPRINT_DBG(STORVSC_DRV, "req %p size %d", request, request_size);
 
 	/* Build the SRB */
 	switch (scmnd->sc_data_direction) {
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH 02/20] Staging: hv: Embed struct storvsc_request_extension into hv_storvsc_request
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301330025-25542-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/20] Staging: hv: Move the definition of struct storvsc_request_extension
From: K. Y. Srinivasan @ 2011-03-28 16:33 UTC (permalink / raw)
  To: gregkh, linux-kernel, devel, virtualization; +Cc: Haiyang Zhang, Abhishek Kane
In-Reply-To: <1301329950-25490-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

* [PATCH 00/20] Staging: hv: Cleanup-storage-drivers-phase-II
From: K. Y. Srinivasan @ 2011-03-28 16:32 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] virtio: Decrement avail idx on buffer detach
From: Amit Shah @ 2011-03-28 14:27 UTC (permalink / raw)
  To: Rusty Russell; +Cc: Virtualization List
In-Reply-To: <20110317122659.GB18382@amit-x200.redhat.com>

On (Thu) 17 Mar 2011 [17:56:59], Amit Shah wrote:
> On (Thu) 17 Mar 2011 [15:26:28], Rusty Russell wrote:
> > On Wed, 16 Mar 2011 19:12:10 +0530, Amit Shah <amit.shah@redhat.com> wrote:
> > > When detaching a buffer from a vq, the avail.idx value should be
> > > decremented as well.
> > > 
> > > This was noticed by hot-unplugging a virtio console port and then
> > > plugging in a new one on the same number (re-using the vqs which were
> > > just 'disowned').  qemu reported
> > > 
> > >    'Guest moved used index from 0 to 256'
> > > 
> > > when any IO was attempted on the new port.
> > 
> > Yech... detach_unused_buf cannot be used on a live virtqueue; it assumes
> > we will reset the vq (usually by resetting the entire device).
> > 
> > You've partially violated that assumption by reusing the vq after
> > calling detach_unused_buf.  So I'm not entirely sure this is the only
> > bug lurking; safer would be to re-initialize the vq somehow when you
> > plug back in...
> 
> Right; and then that will need host changes too (re-init the vqs on
> the host side), which then gets us into compat problems...

Rusty, any thoughts on this?

		Amit

^ permalink raw reply

* Joint COMPSAC/SAINT Doctoral Symposium Call For Papers
From: Ming Zhao @ 2011-03-26 23:00 UTC (permalink / raw)
  To: virtualization

         Joint COMPSAC/SAINT Doctoral Symposium : Call For Papers
                  Munich, GERMANY (July 18-22, 2011) 

         COMPSAC 2011 : The 35th Annual IEEE International Computer 
                  Software and Applications Conference
                http://conferences.computer.org/compsac/

       SAINT2011 : The 11th Annual Annual International Symposium on 
                   Applications and the Internet
                  http://www.saintconference.org/

---------------------------------------------------------------------------
Important Dates
---------------------------------------------------------------------------
Doctoral Symposium Paper Submission:           April  3, 2011
Doctoral Symposium Author Notification:        April 18, 2011
Final Manuscript and Authors Registration Due: May 2, 2011
(ONE STUDENT Registration per ONE paper)
---------------------------------------------------------------------------
What is Doctoral Symposium
---------------------------------------------------------------------------
The joint COMPSAC/SAINT Doctoral Symposium will provide an international 
forum for doctoral students to interact with other students, faculty 
mentors, industry and government.

The Doctoral Symposium seeks to bring together PhD students working in 
COMPSAC and SAINT related fields. Selected students will have the 
opportunity to present and discuss their research goals, methodology, and 
preliminary results within a constructive and international atmosphere. 
Participants will obtain useful guidance for completion of their 
dissertation research and initiation of a research career, by comments 
discussions with mentors of COMPSAC and SAINT expertise. 

The Symposium organizers will strive to provide useful guidance for 
completion of the dissertation research and motivation for a research 
career. The Symposium is intended for students who have already settled on 
a specific research topic and have produced limited preliminary results, 
but have enough time remaining before their final defense to benefit from 
Symposium discussions.

All accepted papers will be published in the electronic proceedings by IEEE 
Computer Society.
---------------------------------------------------------------------------
Page Form, Page Limit and Submission
---------------------------------------------------------------------------
Students should consider participating in the Doctoral Symposium at least 
one year before completion of their dissertation, but after having chosen a 
topic and begun to work on it.

Submissions should include only the student as a single author, and must be 
accompanied by a letter of recommendation from the advisor.  This letter 
should include your name, a candid assessment of the current status of your 
dissertation research, and an expected date for dissertation submission. 
The letter should be in PDF, and e-mailed to yamai at cc.okayama-u.ac.jp 
and ming at cs.fiu.edu with the subject: SAINT 2011 DOCTORAL SYMPOSIUM 
RECOMMENDATION.

Students wishing to participate in the Symposium must submit an extended 
paper that describes their dissertation research. Each paper should:
  - Clearly formulate the research topic
  - Outline the significant problems in the field and current solutions
  - Present the preliminary idea, the proposed approach, the evaluation 
    plan, and results achieved to date
  - Explicitly point out the contributions of the proposed work

Submissions that fail to address these issues, or present them in a poorly 
organized way, are not likely to be accepted.

The length of the submission and camera-ready versions of the paper is 
limited to 4 pages (IEEE Proceedings style) printed in 10-12 point font. 
Please follow IEEE Computer Society Press Proceedings Author Guidelines to 
prepare your paper. LaTeX formatting macros and Word template are  
available on the IEEE CS Web site. 
http://www.computer.org/portal/web/cscps/formatting/

Papers should be submitted either to COMPSAC or to SAINT, but not to both. 
(Submitters should select the submission site based on the relevance of the 
conference's topics to their research.)

Check SAINT web for a paper submission page.

Submissions will be judged on originality, significance of potential 
contribution to the field, technical merit, presentation quality, and 
adherence to paper submission guidelines.
---------------------------------------------------------------------------
Registration
---------------------------------------------------------------------------
Doctoral Symposium authors are eligible to register under the student 
registration fee. An author for each paper should complete STUDENT 
registration for the Doctoral Symposium paper, prior to the submission of 
the final manuscript. Otherwise the paper will not appear in the 
Proceedings.
---------------------------------------------------------------------------
Poster Presentation
---------------------------------------------------------------------------
An author of an accepted paper will be asked to provide a poster describing 
their research. A format of a poster will be informed to an author prior to 
the conference. A poster presentation by an author will be done during the 
conference. The exact date for poster presentation will be announced with 
"Program at a Glance."

It also should be noted that any paper will not be included in the IEEE-CS 
digital library if no poster presentation is made without reasonable 
notification.
---------------------------------------------------------------------------
Joint Panel "Technology Summit : International Perspectives on Computed World"
---------------------------------------------------------------------------
COMPSAC/SAINT2011 specifically plans to hold the joint Panel "Technology 
Summit : International Perspectives on Computed World". Panelists of this 
special event are key-persons from academia, industries, founders and 
societies. This panel will be organized in conjunction with COMPSAC/SAINT 
Doctoral Symposium. So it will provide students for a talk about how to 
drive their career with key-persons from those areas. Panelists and further 
detail of the panel will be announced on the web, so do not miss this 
special event.

^ permalink raw reply

* Re: [Xen-devel] Re: [PATCH] xen: fix p2m section mismatches
From: Konrad Rzeszutek Wilk @ 2011-03-25 15:06 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Randy Dunlap, akpm, xen-devel, Jeremy Fitzhardinge,
	virtualization
In-Reply-To: <20110324144802.1def1400@nehalam>

On Thu, Mar 24, 2011 at 02:48:02PM -0700, Stephen Hemminger wrote:
> On Thu, 24 Mar 2011 13:34:32 -0700
> Randy Dunlap <randy.dunlap@oracle.com> wrote:
> 
> > From: Randy Dunlap <randy.dunlap@oracle.com>
> > 
> > Fix section mismatch warnings:
> > set_phys_range_identity() is called by __init xen_set_identity(),
> > so also mark set_phys_range_identity() as __init.
> > then:
> > __early_alloc_p2m() is called set_phys_range_identity(), so also mark
> > __early_alloc_p2m() as __init.
> > 
> > WARNING: arch/x86/built-in.o(.text+0x7856): Section mismatch in reference from the function __early_alloc_p2m() to the function .init.text:extend_brk()
> > The function __early_alloc_p2m() references
> > the function __init extend_brk().
> > This is often because __early_alloc_p2m lacks a __init 
> > annotation or the annotation of extend_brk is wrong.
> > 
> > WARNING: arch/x86/built-in.o(.text+0x7967): Section mismatch in reference from the function set_phys_range_identity() to the function .init.text:extend_brk()
> > The function set_phys_range_identity() references
> > the function __init extend_brk().
> > This is often because set_phys_range_identity lacks a __init 
> > annotation or the annotation of extend_brk is wrong.
> > 
> > Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> > ---
> >  arch/x86/xen/p2m.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > --- linux-2.6.38-git13.orig/arch/x86/xen/p2m.c
> > +++ linux-2.6.38-git13/arch/x86/xen/p2m.c
> > @@ -497,7 +497,7 @@ static bool alloc_p2m(unsigned long pfn)
> >  	return true;
> >  }
> >  
> > -bool __early_alloc_p2m(unsigned long pfn)
> > +bool __init __early_alloc_p2m(unsigned long pfn)
> 
> __early_alloc_p2m could be static as well.

<nods> Let me queue it up for rc1. Thanks guys.

^ permalink raw reply

* Re: [Xen-devel] [patch 1/2] xen-gntdev: return -EFAULT on copy_to_user failure
From: Konrad Rzeszutek Wilk @ 2011-03-25 15:04 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jeremy Fitzhardinge, kernel-janitors, xen-devel, virtualization
In-Reply-To: <20110319054434.GD2008@bicker>

On Sat, Mar 19, 2011 at 08:44:34AM +0300, Dan Carpenter wrote:
> copy_to_user() returns the amount of data remaining to be copied.  We
> want to return a negative error code here.  The upper layers just
> call WARN_ON() if we return non-zero so this doesn't change the
> behavior.  But returning -EFAULT is still cleaner.

Thank you. Will put it on rc1 train.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
> index 017ce60..b0f9e8f 100644
> --- a/drivers/xen/gntdev.c
> +++ b/drivers/xen/gntdev.c
> @@ -273,7 +273,7 @@ static int __unmap_grant_pages(struct grant_map *map, int offset, int pages)
>  				map->vma->vm_start + map->notify.addr;
>  			err = copy_to_user(tmp, &err, 1);
>  			if (err)
> -				return err;
> +				return -EFAULT;
>  			map->notify.flags &= ~UNMAP_NOTIFY_CLEAR_BYTE;
>  		} else if (pgno >= offset && pgno < offset + pages) {
>  			uint8_t *tmp = kmap(map->pages[pgno]);
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply

* Re: [Xen-devel] [patch 2/2] xen-gntdev: unlock on error path in gntdev_mmap()
From: Konrad Rzeszutek Wilk @ 2011-03-25 15:04 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jeremy Fitzhardinge, kernel-janitors, xen-devel, virtualization
In-Reply-To: <20110319054543.GE2008@bicker>

On Sat, Mar 19, 2011 at 08:45:43AM +0300, Dan Carpenter wrote:
> We should unlock here and also decrement the number of &map->users.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> ---
> I'm not very familiar with this code.  Please review carefully.

It looks right. -EINVAL is still returned so that is OK. Put it
on the rc1 train.
> 
> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
> index 017ce60..b0f9e8f 100644
> --- a/drivers/xen/gntdev.c
> +++ b/drivers/xen/gntdev.c
> @@ -662,7 +662,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
>  	if (map->flags) {
>  		if ((vma->vm_flags & VM_WRITE) &&
>  				(map->flags & GNTMAP_readonly))
> -			return -EINVAL;
> +			goto out_unlock_put;
>  	} else {
>  		map->flags = GNTMAP_host_map;
>  		if (!(vma->vm_flags & VM_WRITE))
> @@ -700,6 +700,8 @@ unlock_out:
>  	spin_unlock(&priv->lock);
>  	return err;
>  
> +out_unlock_put:
> +	spin_unlock(&priv->lock);
>  out_put_map:
>  	if (use_ptemod)
>  		map->vma = NULL;
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply

* Re: [PATCH] xen: fix p2m section mismatches
From: Stephen Hemminger @ 2011-03-24 21:48 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: akpm, xen-devel, Jeremy Fitzhardinge, Konrad Rzeszutek Wilk,
	virtualization
In-Reply-To: <20110324133432.544092e4.randy.dunlap@oracle.com>

On Thu, 24 Mar 2011 13:34:32 -0700
Randy Dunlap <randy.dunlap@oracle.com> wrote:

> From: Randy Dunlap <randy.dunlap@oracle.com>
> 
> Fix section mismatch warnings:
> set_phys_range_identity() is called by __init xen_set_identity(),
> so also mark set_phys_range_identity() as __init.
> then:
> __early_alloc_p2m() is called set_phys_range_identity(), so also mark
> __early_alloc_p2m() as __init.
> 
> WARNING: arch/x86/built-in.o(.text+0x7856): Section mismatch in reference from the function __early_alloc_p2m() to the function .init.text:extend_brk()
> The function __early_alloc_p2m() references
> the function __init extend_brk().
> This is often because __early_alloc_p2m lacks a __init 
> annotation or the annotation of extend_brk is wrong.
> 
> WARNING: arch/x86/built-in.o(.text+0x7967): Section mismatch in reference from the function set_phys_range_identity() to the function .init.text:extend_brk()
> The function set_phys_range_identity() references
> the function __init extend_brk().
> This is often because set_phys_range_identity lacks a __init 
> annotation or the annotation of extend_brk is wrong.
> 
> Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
> ---
>  arch/x86/xen/p2m.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> --- linux-2.6.38-git13.orig/arch/x86/xen/p2m.c
> +++ linux-2.6.38-git13/arch/x86/xen/p2m.c
> @@ -497,7 +497,7 @@ static bool alloc_p2m(unsigned long pfn)
>  	return true;
>  }
>  
> -bool __early_alloc_p2m(unsigned long pfn)
> +bool __init __early_alloc_p2m(unsigned long pfn)

__early_alloc_p2m could be static as well.
-- 

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox