Re: [PATCH 4/8] sd: Be consistent about blocks vs. sectors

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

 



On 1/11/19 1:08 AM, Bart Van Assche wrote:
From: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>

We have had several bugs due mixing sector and logical block size
terminology. In the block layer, a sector is a 512-byte unit regardless
of the logical block size of the underlying device. But the term
"sector" is still widely used in sd.c when referring to logical block
sized units.

We previously introduced helper functions such as sectors_to_logical()
and logical_to_sectors() to make the distinction clear. Use these to
make the code in sd.c consistent wrt. logical blocks and block layer
sectors.

Use "lba" to describe a logical block address and "nr_blocks" when
counting logical blocks. SBC uses "TRANSFER LENGTH" to describe the
latter but this term was avoided to prevent confusion with the very
similar DMA transfer size (->transfersize) which is counted in bytes.

Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
[ bvanassche: ported this patch from kernel v4.11 to kernel v5.0 ]
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
  drivers/scsi/sd.c | 169 +++++++++++++++++++++++-----------------------
  1 file changed, 83 insertions(+), 86 deletions(-)

Reviewed-by: Hannes Reinecke <hare@xxxxxxxx>

Cheers,

Hannes
--
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@xxxxxxx			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux