Files
linux/android
Bart Van Assche 3f6018f1b6 ANDROID: block: Support configuring limits below the page size
Allow block drivers to configure the following:
* Maximum number of hardware sectors values smaller than
  PAGE_SIZE >> SECTOR_SHIFT. For PAGE_SIZE = 4096 this means that values
  below 8 become supported.
* A maximum segment size below the page size. This is most useful
  for page sizes above 4096 bytes.

The blk_sub_page_segments static branch will be used in later patches to
prevent that performance of block drivers that support segments >=
PAGE_SIZE and max_hw_sectors >= PAGE_SIZE >> SECTOR_SHIFT would be affected.

This patch may change the behavior of existing block drivers from not
working into working. If a block driver calls
blk_queue_max_hw_sectors() or blk_queue_max_segment_size(), this is
usually done to configure the maximum supported limits. An attempt to
configure a limit below what is supported by the block layer causes the
block layer to select a larger value. If that value is not supported by
the block driver, this may cause other data to be transferred than
requested, a kernel crash or other undesirable behavior.

Keeps the ABI stable by taking advantage of a hole in the structure!

Bug: 308663717
Bug: 319125789
Bug: 324152549
Change-Id: I4a7b605f0f0d82dde0b4703496c7314064f48acb
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
[jyescas@google.com: disable subpage limits in block/blk-sysfs.c
                     instead block/blk-core.c because the function
                     blk_free_queue() is not defined in 5.15 kernel]
Signed-off-by: Juan Yescas <jyescas@google.com>
2024-02-14 02:31:28 +00:00
..