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

Staging: hv: Move the data_buffer field from struct hv_storvsc_request

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: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarAbhishek Kane <v-abkane@microsoft.com>
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6dc3f0a7
......@@ -522,9 +522,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;
......@@ -569,9 +569,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 */
......@@ -658,9 +659,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;
......@@ -737,9 +739,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;
......@@ -928,8 +931,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() - "
......@@ -1056,10 +1059,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
blkvsc_req->request.extension.
data_buffer.offset
= bvec->bv_offset;
blkvsc_req->request.data_buffer.len
= 0;
blkvsc_req->request.extension.
data_buffer.len = 0;
/* Add to the group */
blkvsc_req->group = group;
......@@ -1073,10 +1077,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;
......@@ -1182,7 +1186,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);
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment