On 16/06/2016 07:25, Fam Zheng wrote:
>> > + assert(max_xfer_len);
>> > + stl_be_p(&r->buf[8], max_xfer_len);
>> > + /* Also take care of the opt xfer len. */
>> > + if (ldl_be_p(&r->buf[12]) > max_xfer_len) {
>> > + stl_be_p(&r->buf[12], max_xfer_len);
> Paolo: should we take s->blocksize into account? I missed it when I wrote this
> piece of code.
Hmm, the maximum and optimal transfer length is in logical blocks, so yes.
There is one thing that isn't great: at least Linux reads the capacity
before the block limits page, but we cannot know for sure that everyone
does it. I think it's a good idea to send a READ CAPACITY(10) at
startup, like we do in get_stream_blocksize. We only need it for the
blocksize, not for the capacity, so it's not necessary to use READ
CAPACITY(16).
The snooping is still necessary for the max_lba (which is used by
scsi_disk_dma_command), so we might as well keep the assignment to
s->blocksize in there too. But let's add a best effort READ
CAPACITY(10) at startup.
Paolo