Thread (17 messages) 17 messages, 5 authors, 2021-05-13

Re: [PATCH v2 0/7] Rename scsi_get_lba() into scsi_get_pos()

From: Damien Le Moal <hidden>
Date: 2021-05-13 02:18:31

On 2021/05/13 9:14, James Bottomley wrote:
On Wed, 2021-05-12 at 17:00 -0700, Bart Van Assche wrote:
quoted
On 5/12/21 4:23 PM, James Bottomley wrote:
quoted
No, we support physical sector sizes up to 4k.  The logical block
size internal to the kernel and the block layer is always 512.  I
can see the utility in using consistent naming to the block layer,
but I can't see that logical block address is confusing ...
especially now manufacturers seem all to have aligned on 512 for
the logical block size even when it's usually 4k physical.
Are we talking about the same? Just below the code that I included in
my previous email there is the following line:

	blk_queue_logical_block_size(sdp->request_queue, sector_size);

where sector_size is the logical block size reported by the READ 
CAPACITY command and has a value between 512 and 4096.
That was for devices from before the industry standardised, which are
getting harder and harder to find (In fact I'm thinking of making a NFT
out of my last 4k logical/physical disk).  But it didn't alter the fact
that the kernel internal block size is 512.
struct bio and struct request use 512B sector_t unit addressing. So does the
entire block layer, file systems device mapper etc. SAll users of block devices
use this unit. Yes, that is fixed to 512B, regardless of the characteristics of
the target device. But to avoid confusion, we never refer to this as the
"logical block size" or "block size". We use the term "sector" and reserve the
term "block" for the device layer.

The logical block size (the unit used for command addressing) may or may not be
512B (it may or may not be equal to the block layer sector size). These days,
most HDDs are 512e, that is, 512B logical block size and 4K physical block size.
Lots of SSDs are still 512/512. 4K/4K HDDs and SSDs are gaining ground and
spreading.

I agree with Bart's cleanup patches. They correct a non-standard use of the term
LBA to refer to a value using the block layer sector unit.

Bart suggested scsi_get_pos() as the new function name to solve the confusion. I
think that using scsi_get_sector() as a name would be even clearer about the
unit of the values being handled.

-- 
Damien Le Moal
Western Digital Research
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help