Re: [PATCH v3] scsi: ufs: Increase the maximum data buffer size

Bean Huo
2022-09-15T10:57:04Z

On Tue, 2022-09-06 at 11:04 -0700, Bart Van Assche wrote:
>
> Hi Bean,
>
> It seems to me that the block layer only uses the optimal transfer
> size
> (io_opt) to determine how much data to read ahead during sequential
> reads? See also disk_update_readahead().
>

Bart,
Sorry for later reply, Didn't notice a question here.

In the upstream standard Linux kernel, if the device supports a valid
VPD, I think, your this change will also not change the read-ahead
window.

....

sdkp->opt_xfer_blocks = get_unaligned_be32(&vpd->data[12]);

sd_revalidate_disk() {

...
if (sd_validate_opt_xfer_size(sdkp, dev_max)) {
q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks);
rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
}
...
}

device_add_disk()
disk_update_readahead(disk) {
disk->bdi->ra_pages =
max(queue_io_opt(q) * 2 / PAGE_SIZE,
VM_READAHEAD_PAGES);
}

e.g., if device reports opt 512KB, and the maximum transfer length will
be 512KB, and readahead window will be 1MB.

Kind regards,
Bean