Staging: hv: Simplify blkvsc_init_rw()
Simplyfify blkvsc_init_rw() by using a single scsi command independent of the start sector. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: Hank Janssen <hjanssen@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
3880914aa6
commit
9bd0859a24
1 changed files with 13 additions and 45 deletions
|
@ -305,7 +305,6 @@ static void blkvsc_init_rw(struct blkvsc_request *blkvsc_req)
|
|||
|
||||
blkvsc_req->cmd_len = 16;
|
||||
|
||||
if (blkvsc_req->sector_start > 0xffffffff) {
|
||||
if (rq_data_dir(blkvsc_req->req)) {
|
||||
blkvsc_req->write = 1;
|
||||
blkvsc_req->cmnd[0] = WRITE_16;
|
||||
|
@ -321,37 +320,6 @@ static void blkvsc_init_rw(struct blkvsc_request *blkvsc_req)
|
|||
cpu_to_be64(blkvsc_req->sector_start);
|
||||
*(unsigned int *)&blkvsc_req->cmnd[10] =
|
||||
cpu_to_be32(blkvsc_req->sector_count);
|
||||
} else if ((blkvsc_req->sector_count > 0xff) ||
|
||||
(blkvsc_req->sector_start > 0x1fffff)) {
|
||||
if (rq_data_dir(blkvsc_req->req)) {
|
||||
blkvsc_req->write = 1;
|
||||
blkvsc_req->cmnd[0] = WRITE_10;
|
||||
} else {
|
||||
blkvsc_req->write = 0;
|
||||
blkvsc_req->cmnd[0] = READ_10;
|
||||
}
|
||||
|
||||
blkvsc_req->cmnd[1] |=
|
||||
(blkvsc_req->req->cmd_flags & REQ_FUA) ? 0x8 : 0;
|
||||
|
||||
*(unsigned int *)&blkvsc_req->cmnd[2] =
|
||||
cpu_to_be32(blkvsc_req->sector_start);
|
||||
*(unsigned short *)&blkvsc_req->cmnd[7] =
|
||||
cpu_to_be16(blkvsc_req->sector_count);
|
||||
} else {
|
||||
if (rq_data_dir(blkvsc_req->req)) {
|
||||
blkvsc_req->write = 1;
|
||||
blkvsc_req->cmnd[0] = WRITE_6;
|
||||
} else {
|
||||
blkvsc_req->write = 0;
|
||||
blkvsc_req->cmnd[0] = READ_6;
|
||||
}
|
||||
|
||||
*(unsigned int *)&blkvsc_req->cmnd[1] =
|
||||
cpu_to_be32(blkvsc_req->sector_start) >> 8;
|
||||
blkvsc_req->cmnd[1] &= 0x1f;
|
||||
blkvsc_req->cmnd[4] = (unsigned char)blkvsc_req->sector_count;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue