Skip to content

usb-storage max_sectors default of 240 is suboptimal on bigpages kernels #7545

Description

@P33M

Present since the Ordovician era, Linux has by default limited USB mass storage device transfers to 240 sectors. The chatbot suggests this was due to primitive USB storage controllers implementing an 8-bit internal field for the number of sectors to transfer, and 256 was also deemed bad as these controllers didn't correctly wrap a programmed value of 0 sectors to 256.

So 240 was picked, which is a multiple of 4Ki and 8Ki. But on a kernel with 16KiB pages, it crosses a page boundary after 7 pages, so you end up with 224-sector writes aligned to a 32-LBA boundary. Not great...

Similarly a 64KiB page kernel will degrade to 64KiB writes, but at least these are aligned to a 128-LBA natural boundary.

From a similar geological time period, Windows defaulted to 64KiB and has this has remained to this day.

My preference is to nerf the not-naturally-aligned behaviour without significantly disturbing the fossil beds, so 64KiB on 16KiB pages.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions