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

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

From: Bart Van Assche <bvanassche@acm.org>
Date: 2021-05-12 22:42:50

On 5/12/21 3:10 PM, James Bottomley wrote:
On Wed, 2021-05-12 at 13:08 -0700, Bart Van Assche wrote:
quoted
This patch series renames scsi_get_lba() into scsi_get_pos(). The
name of scsi_get_lba() is confusing since it does not return an LBA
but instead the start offset divided by 512.
OK, I'll bite: given the logical block size for all drives is 512 why
is logical block address not the start offset in bytes divided by 512?
My understanding is that LBA = logical block address = (start offset in 
bytes) / (logical block size) and also that the Linux kernel supports 
logical block sizes between 512 bytes and 4 KiB. From drivers/scsi/sd.c 
(sector_size represents the logical block size):

	if (sector_size != 512 &&
	    sector_size != 1024 &&
	    sector_size != 2048 &&
	    sector_size != 4096) {
		sd_printk(KERN_NOTICE, sdkp,
			 "Unsupported sector size %d.\n",
			  sector_size);
		/*
		 * The user might want to re-format the drive with
		 * a supported sectorsize.  Once this happens, it
		 * would be relatively trivial to set the thing up.
		 * For this reason, we leave the thing in the table.
		 */
		sdkp->capacity = 0;
		/*
		 * set a bogus sector size so the normal read/write
		 * logic in the block layer will eventually refuse any
		 * request on this device without tripping over power
		 * of two sector size assumptions
		 */
		sector_size = 512;
	}

Thanks,

Bart.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help