Re: [PATCH RFC 2/2] block: Enforce power-of-2 physical block size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/24/25 4:04 AM, Hannes Reinecke wrote:
While there are no real checks on the physical blocksize (all what
matters to the block layer is the logical blocksize) I can't really
see how a device can have a physical blocksize which is _not_ a
multiple of the logical blocksize.

From SBC-5:

------------------------------------------------------------------------
Table 91 — LOGICAL BLOCKS PER PHYSICAL BLOCK EXPONENT field

Code   Description
0      One or more physical blocks per logical block (a)
n > 0  2n logical blocks per physical block
a  The number of physical blocks per logical block is not reported.
------------------------------------------------------------------------

I think this means that the SCSI standards support physical blocks that
are smaller than the logical block size. However, as far as I know the
Linux kernel does not try to determine the physical block size in this
case. As one can see in drivers/scsi/sd.c LBPPBE == 0 is treated as one
physical block per logical block:

	/* Logical blocks per physical block exponent */
	sdkp->physical_block_size = (1 << (buffer[13] & 0xf)) * sector_size;

Bart.





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux