diff mbox series

[10/15] scsi: core: Introduce scsi_get_sector()

Message ID 20210609033929.3815-11-martin.petersen@oracle.com
State New
Headers show
Series Subject: Protection information and block size cleanup | expand

Commit Message

Martin K. Petersen June 9, 2021, 3:39 a.m. UTC
From: Bart Van Assche <bvanassche@acm.org>

Since scsi_get_lba() returns a sector_t value instead of the LBA, the name
of that function is confusing. Introduce an identical function
scsi_get_sector().

Link: https://lore.kernel.org/r/20210513223757.3938-2-bvanassche@acm.org
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 include/scsi/scsi_cmnd.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Benjamin Block June 14, 2021, 2:48 p.m. UTC | #1
On Tue, Jun 08, 2021 at 11:39:24PM -0400, Martin K. Petersen wrote:
> From: Bart Van Assche <bvanassche@acm.org>

> 

> Since scsi_get_lba() returns a sector_t value instead of the LBA, the name

> of that function is confusing. Introduce an identical function

> scsi_get_sector().

> 

> Link: https://lore.kernel.org/r/20210513223757.3938-2-bvanassche@acm.org

> Cc: Christoph Hellwig <hch@lst.de>

> Cc: Ming Lei <ming.lei@redhat.com>

> Cc: Hannes Reinecke <hare@suse.de>

> Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>

> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

> ---

>  include/scsi/scsi_cmnd.h | 5 +++++

>  1 file changed, 5 insertions(+)

> 

> diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h

> index 301b9cd4ddd0..cba63377d46a 100644

> --- a/include/scsi/scsi_cmnd.h

> +++ b/include/scsi/scsi_cmnd.h

> @@ -220,6 +220,11 @@ static inline int scsi_sg_copy_to_buffer(struct scsi_cmnd *cmd,

>  				 buf, buflen);

>  }

>  

> +static inline sector_t scsi_get_sector(struct scsi_cmnd *scmd)

> +{

> +	return blk_rq_pos(scmd->request);


Wondering a bit why this still uses the request pointer, after you say
in patch 01 that it goes away. So it should probably use
`blk_mq_rq_from_pdu()`?


-- 
Best Regards, Benjamin Block  / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH    /    https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen         /        Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Martin K. Petersen June 15, 2021, 2:28 a.m. UTC | #2
Benjamin,

> Wondering a bit why this still uses the request pointer, after you say

> in patch 01 that it goes away. So it should probably use

> `blk_mq_rq_from_pdu()`?


I was just getting everything ready for Bart's series that makes this
change throughout the tree.

-- 
Martin K. Petersen	Oracle Linux Engineering
Benjamin Block June 15, 2021, 9:33 a.m. UTC | #3
On Mon, Jun 14, 2021 at 10:28:52PM -0400, Martin K. Petersen wrote:
> > Wondering a bit why this still uses the request pointer, after you say

> > in patch 01 that it goes away. So it should probably use

> > `blk_mq_rq_from_pdu()`?

> 

> I was just getting everything ready for Bart's series that makes this

> change throughout the tree.

> 


Ah ok, didn't realize that.


Reviewed-by: Benjamin Block <bblock@linux.ibm.com>


-- 
Best Regards, Benjamin Block  / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH    /    https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen         /        Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
diff mbox series

Patch

diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 301b9cd4ddd0..cba63377d46a 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -220,6 +220,11 @@  static inline int scsi_sg_copy_to_buffer(struct scsi_cmnd *cmd,
 				 buf, buflen);
 }
 
+static inline sector_t scsi_get_sector(struct scsi_cmnd *scmd)
+{
+	return blk_rq_pos(scmd->request);
+}
+
 /*
  * The operations below are hints that tell the controller driver how
  * to handle I/Os with DIF or similar types of protection information.