* [RESEND][PATCH 06/10][SCSI]mpt2sas: For >2TB volumes, DirectDrive support sends IO's with LBA bit 31 to IR FW instead of DirectDrive
@ 2014-06-25 10:34 Reddy, Sreekanth
2014-07-13 15:27 ` Martin K. Petersen
0 siblings, 1 reply; 3+ messages in thread
From: Reddy, Sreekanth @ 2014-06-25 10:34 UTC (permalink / raw)
To: jejb, JBottomley
Cc: linux-scsi, Sathya.Prakash, Nagalakshmi.Nandigama,
sreekanth.reddy, linux-kernel, hch, martin.petersen
There was a down casting of the volume max LBA from a U64 to a U32,
which is taken out and now the max LBA is set appropriately to U64.
Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
---
drivers/scsi/mpt2sas/mpt2sas_scsih.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 6ae109b..4a0728a 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -3865,7 +3865,8 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request,
u16 smid)
{
- u32 v_lba, p_lba, stripe_off, stripe_unit, column, io_size;
+ u32 p_lba, stripe_off, stripe_unit, column, io_size;
+ u64 v_lba;
u32 stripe_sz, stripe_exp;
u8 num_pds, *cdb_ptr, i;
u8 cdb0 = scmd->cmnd[0];
@@ -3882,12 +3883,17 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
| cdb_ptr[5])) {
io_size = scsi_bufflen(scmd) >>
raid_device->block_exponent;
- i = (cdb0 < READ_16) ? 2 : 6;
+
/* get virtual lba */
- v_lba = be32_to_cpu(*(__be32 *)(&cdb_ptr[i]));
+ if (cdb0 < READ_16)
+ v_lba = be32_to_cpu(*(__be32 *)(&cdb_ptr[2]));
+ else
+ v_lba = be64_to_cpu(*(__be64 *)(&cdb_ptr[2]));
+
+ i = (cdb0 < READ_16) ? 2 : 6;
if (((u64)v_lba + (u64)io_size - 1) <=
- (u32)raid_device->max_lba) {
+ raid_device->max_lba) {
stripe_sz = raid_device->stripe_sz;
stripe_exp = raid_device->stripe_exponent;
stripe_off = v_lba & (stripe_sz - 1);
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RESEND][PATCH 06/10][SCSI]mpt2sas: For >2TB volumes, DirectDrive support sends IO's with LBA bit 31 to IR FW instead of DirectDrive
2014-06-25 10:34 [RESEND][PATCH 06/10][SCSI]mpt2sas: For >2TB volumes, DirectDrive support sends IO's with LBA bit 31 to IR FW instead of DirectDrive Reddy, Sreekanth
@ 2014-07-13 15:27 ` Martin K. Petersen
2014-07-13 17:02 ` Elliott, Robert (Server Storage)
0 siblings, 1 reply; 3+ messages in thread
From: Martin K. Petersen @ 2014-07-13 15:27 UTC (permalink / raw)
To: Reddy, Sreekanth
Cc: jejb, JBottomley, linux-scsi, Sathya.Prakash,
Nagalakshmi.Nandigama, linux-kernel, hch, martin.petersen
>>>>> "Sreekanth" == Reddy, Sreekanth <Sreekanth.Reddy@avagotech.com> writes:
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 6ae109b..4a0728a 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -3865,7 +3865,8 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
struct _raid_device *raid_device, Mpi2SCSIIORequest_t *mpi_request,
u16 smid)
{
- u32 v_lba, p_lba, stripe_off, stripe_unit, column, io_size;
+ u32 p_lba, stripe_off, stripe_unit, column, io_size;
+ u64 v_lba;
u32 stripe_sz, stripe_exp;
u8 num_pds, *cdb_ptr, i;
u8 cdb0 = scmd->cmnd[0];
@@ -3882,12 +3883,17 @@ _scsih_setup_direct_io(struct MPT2SAS_ADAPTER *ioc, struct scsi_cmnd *scmd,
| cdb_ptr[5])) {
io_size = scsi_bufflen(scmd) >>
raid_device->block_exponent;
- i = (cdb0 < READ_16) ? 2 : 6;
+
/* get virtual lba */
- v_lba = be32_to_cpu(*(__be32 *)(&cdb_ptr[i]));
+ if (cdb0 < READ_16)
+ v_lba = be32_to_cpu(*(__be32 *)(&cdb_ptr[2]));
+ else
+ v_lba = be64_to_cpu(*(__be64 *)(&cdb_ptr[2]));
Why aren't you using scsi_get_lba() instead of all this nasty CDB
parsing?
+
+ i = (cdb0 < READ_16) ? 2 : 6;
What about WRITE_16? WRITE_16 > READ_16.
if (((u64)v_lba + (u64)io_size - 1) <=
- (u32)raid_device->max_lba) {
+ raid_device->max_lba) {
stripe_sz = raid_device->stripe_sz;
stripe_exp = raid_device->stripe_exponent;
stripe_off = v_lba & (stripe_sz - 1);
Also, this is not touched by the patch, but you're then doing:
(*(__be32 *)(&cdb_ptr[i])) = cpu_to_be32(p_lba);
What if this is a 6-byte READ/WRITE command? You'll end up exceeding the
size of the LBA field.
What if you're using a 16-byte CDB and the target device LBA is > 2TB?
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [RESEND][PATCH 06/10][SCSI]mpt2sas: For >2TB volumes, DirectDrive support sends IO's with LBA bit 31 to IR FW instead of DirectDrive
2014-07-13 15:27 ` Martin K. Petersen
@ 2014-07-13 17:02 ` Elliott, Robert (Server Storage)
0 siblings, 0 replies; 3+ messages in thread
From: Elliott, Robert (Server Storage) @ 2014-07-13 17:02 UTC (permalink / raw)
To: Martin K. Petersen, Reddy, Sreekanth
Cc: jejb, JBottomley, linux-scsi, Sathya.Prakash,
Nagalakshmi.Nandigama, linux-kernel, hch
> -----Original Message-----
> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
> owner@vger.kernel.org] On Behalf Of Martin K. Petersen
...
> Also, this is not touched by the patch, but you're then doing:
>
> (*(__be32 *)(&cdb_ptr[i])) = cpu_to_be32(p_lba);
>
> What if this is a 6-byte READ/WRITE command? You'll end up exceeding the
> size of the LBA field.
All this is inside:
if (cdb0 == READ_16 || cdb0 == READ_10 ||
cdb0 == WRITE_16 || cdb0 == WRITE_10) {
so READ_6 and WRITE_6 and all their oddities are not a problem here.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-13 17:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-25 10:34 [RESEND][PATCH 06/10][SCSI]mpt2sas: For >2TB volumes, DirectDrive support sends IO's with LBA bit 31 to IR FW instead of DirectDrive Reddy, Sreekanth
2014-07-13 15:27 ` Martin K. Petersen
2014-07-13 17:02 ` Elliott, Robert (Server Storage)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).