Re: dmesg flooded with "Very big device. Trying to use READ CAPACITY(16)"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> static int sd_try_rc16_first(struct scsi_device *sdp)
>> {
>>         if (sdp->host->max_cmd_len < 16)
>>                 return 0;
>
>
> option
>
>>         if (sdp->try_rc_10_first)
>>                 return 0;
>
>
> option
>
>>         if (sdp->scsi_level > SCSI_SPC_2)
>>                 return 1;
>>         if (scsi_device_protection(sdp))
>>                 return 1;
>>         return 0;
>
>
> option
>
>> }
>
>
> just picking one arbitrary option and not being entirely sure that's the
> code path but you mentioned USB to SATA bridge, it might be related to:
>

Steffen, since the reason why it goes for read_capacity_10 is that the
upper layer asked for try_rc_10_first = 1, would it be ok if, we
realize that the reported capacity of the attached HDDs is greater
than what it is possible to report via capacity_10 the scsi layer
clear this flag, so the following requests go for read_capacity_16?
Something like:

if (sd_try_rc16_first(sdp)) {
    sector_size = read_capacity_16(sdkp, sdp, buffer);
    if (sector_size == -EOVERFLOW)
        goto got_data;
    if (sector_size == -ENODEV)
        return;
    if (sector_size < 0)
        sector_size = read_capacity_10(sdkp, sdp, buffer);
        if (sector_size < 0)
            return;
} else {
    sector_size = read_capacity_10(sdkp, sdp, buffer);
    if (sector_size == -EOVERFLOW)
        goto got_data;
    if (sector_size < 0)
        return;
    if ((sizeof(sdkp->capacity) > 4) &&
        (sdkp->capacity > 0xffffffffULL)) {
        int old_sector_size = sector_size;
        sd_printk(KERN_NOTICE, sdkp, "Very big device. "
                                                              "Trying
to use READ CAPACITY(16).\n");
        sector_size = read_capacity_16(sdkp, sdp, buffer);
        if (sector_size < 0) {
            sd_printk(KERN_NOTICE, sdkp,
                                                     "Using 0xffffffff
as device size\n");
            sdkp->capacity = 1 + (sector_t) 0xffffffff;
            sector_size = old_sector_size;
            goto got_data;
        }
        /*
           The attached device needs read_capacity_16 and
read_capacity_16 works, go for it
           for the next capacity checks
        */
+      sdp->try_rc_10_first = 0;
    }
}



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux