On Wed, May 29, 2024 at 7:05 AM Christoph Hellwig <hch@xxxxxx> wrote: > > The soft max_sectors limit is normally capped by the hardware limits and > an arbitrary upper limit enforced by the kernel, but can be modified by > the user. A few drivers want to increase this limit (nbd, rbd) or > adjust it up or down based on hardware capabilities (sd). > > Change blk_validate_limits to default max_sectors to the optimal I/O > size, or upgrade it to the preferred minimal I/O size if that is > larger than the kernel default if no optimal I/O size is provided based > on the logic in the SD driver. > > This keeps the existing kernel default for drivers that do not provide > an io_opt or very big io_min value, but picks a much more useful > default for those who provide these hints, and allows to remove the > hacks to set the user max_sectors limit in nbd, rbd and sd. > > Note that rd picks a different value for the optimal I/O size vs the > user max_sectors value, so this is a bit of a behavior change that > could use careful review from people familiar with rbd. Hi Christoph, For rbd, this change effectively lowers max_sectors from 4M to 64K or less and that is definitely not desirable. From previous interactions with users we want max_sectors to match max_hw_sectors -- this has come up a quite a few times over the years. Some people just aren't aware of the soft cap and the fact that it's adjustable and get frustrated over the time poured into debugging their iostat numbers for workloads that can send object (set) size I/Os. Looking at the git history, we lowered io_opt from objset_bytes to opts->alloc_size in commit [1], but I guess io_opt was lowered just along for the ride. What that commit was concerned with is really discard_granularity and to a smaller extent io_min. How much difference does io_opt make in the real world? If what rbd does stands in the way of a tree-wide cleanup, I would much rather bump io_opt back to objset_bytes (i.e. what max_user_sectors is currently set to). [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=16d80c54ad42c573a897ae7bcf5a9816be54e6fe Thanks, Ilya