[SLOF] [PATCH] scsi: implement READ (16) command

Nikunj A Dadhania nikunj at linux.vnet.ibm.com
Wed Sep 28 17:03:30 AEST 2016


Thomas Huth <thuth at redhat.com> writes:

> On 28.09.2016 08:37, Nikunj A Dadhania wrote:
>> For disks bigger than 2TB(512B sector size), read-10 would fail as it is
>> limited by the block address(4bytes). Add and use SCSI command READ(16)
>> which has 8bytes block address.
>> 
>> Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
>> ---
>>  slof/fs/scsi-disk.fs    |  2 +-
>>  slof/fs/scsi-support.fs | 29 +++++++++++++++++++++++++++++
>>  2 files changed, 30 insertions(+), 1 deletion(-)
>> 
>> diff --git a/slof/fs/scsi-disk.fs b/slof/fs/scsi-disk.fs
>> index 2f7d740..83aab89 100644
>> --- a/slof/fs/scsi-disk.fs
>> +++ b/slof/fs/scsi-disk.fs
>> @@ -82,7 +82,7 @@ CREATE cdb 10 allot
>>      >r rot r> 			                ( block# #blocks addr len )
>>      2swap                                       ( addr len block# #blocks )
>>      dup >r
>> -    cdb scsi-build-read-10                      ( addr len )
>> +    cdb scsi-build-read-16                      ( addr len )
>>      r> -rot                                     ( #blocks addr len )
>>      scsi-dir-read cdb scsi-param-size 10
>>      retry-scsi-command
>
> I'm feeling a little bit uneasy about using READ-16 here
> unconditionally... IIRC, the scsi stack is also used for USB devices,
> and these often used to only implement the bare minimum of SCSI
> commands, i.e. things like READ-16 are likely not supported there.
> Could you maybe add a check if the block address can not be stored in 4
> bytes anymore, and only use the READ-16 in that case?

Yeah sure, that can be done. How about this:

    cdb                                         ( addr len block# #blocks cdb )
    max-block-num FFFFFFFF > IF
        scsi-build-read-16                      ( addr len )
    ELSE
        scsi-build-read-10                      ( addr len )
    THEN
    r> -rot                                     ( #blocks addr len )

Regards,
Nikunj



More information about the SLOF mailing list