Patch "scsi: core: Make scsi_get_lba() return the LBA" has been added to the 5.10-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    scsi: core: Make scsi_get_lba() return the LBA

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-core-make-scsi_get_lba-return-the-lba.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 542f7f9da871a2c553c8d774775fbac2680eb0d7
Author: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
Date:   Tue Jun 8 23:39:26 2021 -0400

    scsi: core: Make scsi_get_lba() return the LBA
    
    [ Upstream commit d2c945f01d233085fedc9e3cf7ec180eaa2b7a85 ]
    
    scsi_get_lba() confusingly returned the block layer sector number expressed
    in units of 512 bytes. Now that we have a more aptly named
    scsi_get_sector() function, make scsi_get_lba() return the actual LBA.
    
    Link: https://lore.kernel.org/r/20210609033929.3815-13-martin.petersen@xxxxxxxxxx
    Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>
    Reviewed-by: Benjamin Block <bblock@xxxxxxxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Message-Id: <20210609033929.3815-13-martin.petersen@xxxxxxxxxx>
    Stable-dep-of: 066c5b46b6ea ("scsi: core: Always send batch on reset or error handling command")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index ddab0c580382b..162a53a39ac0d 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -229,6 +229,13 @@ static inline sector_t scsi_get_sector(struct scsi_cmnd *scmd)
 	return blk_rq_pos(scmd->request);
 }
 
+static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
+{
+	unsigned int shift = ilog2(scmd->device->sector_size) - SECTOR_SHIFT;
+
+	return blk_rq_pos(scmd->request) >> shift;
+}
+
 /*
  * The operations below are hints that tell the controller driver how
  * to handle I/Os with DIF or similar types of protection information.
@@ -291,11 +298,6 @@ static inline unsigned char scsi_get_prot_type(struct scsi_cmnd *scmd)
 	return scmd->prot_type;
 }
 
-static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
-{
-	return blk_rq_pos(scmd->request);
-}
-
 static inline u32 scsi_prot_ref_tag(struct scsi_cmnd *scmd)
 {
 	struct request *rq = blk_mq_rq_from_pdu(scmd);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux