All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Rename scsi_get_lba() into scsi_get_pos()
@ 2021-05-09 21:43 Bart Van Assche
  2021-05-09 21:43 ` [PATCH 1/7] Introduce scsi_get_pos() Bart Van Assche
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Bart Van Assche @ 2021-05-09 21:43 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Bart Van Assche

Hi Martin,

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.

Please consider this patch series for kernel v5.14.

Thanks,

Bart.

Bart Van Assche (7):
  Introduce scsi_get_pos()
  iser: Use scsi_get_pos() instead of scsi_get_lba()
  zfcp: Use scsi_get_pos() instead of scsi_get_lba()
  iscsi: Use scsi_get_pos() instead of scsi_get_lba()
  qla2xxx: Use scsi_get_pos() instead of scsi_get_lba()
  ufs: Fix the tracing code
  Remove scsi_get_lba()

 drivers/infiniband/ulp/iser/iser_verbs.c |  2 +-
 drivers/s390/scsi/zfcp_fsf.c             |  2 +-
 drivers/scsi/isci/request.c              |  4 ++--
 drivers/scsi/lpfc/lpfc_scsi.c            | 12 ++++++------
 drivers/scsi/qla2xxx/qla_iocb.c          |  9 +++------
 drivers/scsi/qla2xxx/qla_isr.c           |  8 ++++----
 drivers/scsi/ufs/ufshcd.c                | 20 +++++++-------------
 include/scsi/scsi_cmnd.h                 |  2 +-
 include/trace/events/ufs.h               | 10 +++++-----
 9 files changed, 30 insertions(+), 39 deletions(-)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/7] Introduce scsi_get_pos()
  2021-05-09 21:43 [PATCH 0/7] Rename scsi_get_lba() into scsi_get_pos() Bart Van Assche
@ 2021-05-09 21:43 ` Bart Van Assche
  2021-05-09 21:43 ` [PATCH 2/7] iser: Use scsi_get_pos() instead of scsi_get_lba() Bart Van Assche
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Bart Van Assche @ 2021-05-09 21:43 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Bart Van Assche

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_pos(). A later patch will remove scsi_get_lba().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 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 adb8df40b942..8147b1c0f265 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -290,6 +290,11 @@ static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd)
 	return blk_rq_pos(scmd->request);
 }
 
+static inline sector_t scsi_get_pos(struct scsi_cmnd *scmd)
+{
+	return blk_rq_pos(scmd->request);
+}
+
 static inline unsigned int scsi_prot_interval(struct scsi_cmnd *scmd)
 {
 	return scmd->device->sector_size;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/7] iser: Use scsi_get_pos() instead of scsi_get_lba()
  2021-05-09 21:43 [PATCH 0/7] Rename scsi_get_lba() into scsi_get_pos() Bart Van Assche
  2021-05-09 21:43 ` [PATCH 1/7] Introduce scsi_get_pos() Bart Van Assche
@ 2021-05-09 21:43 ` Bart Van Assche
  2021-05-09 21:43 ` [PATCH 3/7] zfcp: " Bart Van Assche
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Bart Van Assche @ 2021-05-09 21:43 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Bart Van Assche, Sagi Grimberg

Use scsi_get_pos() instead of scsi_get_lba() since the name of the latter
is confusing. This patch does not change any functionality.

Cc: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/infiniband/ulp/iser/iser_verbs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 136f6c4492e0..c33e113eeee5 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -949,7 +949,7 @@ u8 iser_check_task_pi_status(struct iscsi_iser_task *iser_task,
 			sector_t sector_off = mr_status.sig_err.sig_err_offset;
 
 			sector_div(sector_off, sector_size + 8);
-			*sector = scsi_get_lba(iser_task->sc) + sector_off;
+			*sector = scsi_get_pos(iser_task->sc) + sector_off;
 
 			iser_err("PI error found type %d at sector %llx "
 			       "expected %x vs actual %x\n",

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/7] zfcp: Use scsi_get_pos() instead of scsi_get_lba()
  2021-05-09 21:43 [PATCH 0/7] Rename scsi_get_lba() into scsi_get_pos() Bart Van Assche
  2021-05-09 21:43 ` [PATCH 1/7] Introduce scsi_get_pos() Bart Van Assche
  2021-05-09 21:43 ` [PATCH 2/7] iser: Use scsi_get_pos() instead of scsi_get_lba() Bart Van Assche
@ 2021-05-09 21:43 ` Bart Van Assche
  2021-05-09 21:43 ` [PATCH 4/7] iscsi: " Bart Van Assche
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Bart Van Assche @ 2021-05-09 21:43 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Bart Van Assche, Benjamin Block

Use scsi_get_pos() instead of scsi_get_lba() since the name of the latter
is confusing. Additionally, use lower_32_bits() instead of open-coding it.
This patch does not change any functionality.

Cc: Benjamin Block <bblock@linux.ibm.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/s390/scsi/zfcp_fsf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 2e4804ef2fb9..ae308ef06714 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2600,7 +2600,7 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd)
 
 	if (scsi_get_prot_op(scsi_cmnd) != SCSI_PROT_NORMAL) {
 		io->data_block_length = scsi_cmnd->device->sector_size;
-		io->ref_tag_value = scsi_get_lba(scsi_cmnd) & 0xFFFFFFFF;
+		io->ref_tag_value = lower_32_bits(scsi_get_pos(scsi_cmnd));
 	}
 
 	if (zfcp_fsf_set_data_dir(scsi_cmnd, &io->data_direction))

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 4/7] iscsi: Use scsi_get_pos() instead of scsi_get_lba()
  2021-05-09 21:43 [PATCH 0/7] Rename scsi_get_lba() into scsi_get_pos() Bart Van Assche
                   ` (2 preceding siblings ...)
  2021-05-09 21:43 ` [PATCH 3/7] zfcp: " Bart Van Assche
@ 2021-05-09 21:43 ` Bart Van Assche
  2021-05-10  1:14   ` Lee Duncan
  2021-05-09 21:43 ` [PATCH 5/7] qla2xxx: " Bart Van Assche
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Bart Van Assche @ 2021-05-09 21:43 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Bart Van Assche, Lee Duncan

Use scsi_get_pos() instead of scsi_get_lba() since the name of the latter
is confusing. Additionally, use lower_32_bits() instead of open-coding it.
This patch does not change any functionality.

Cc: Lee Duncan <lduncan@suse.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/isci/request.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index e7c6cb4c1556..1c25f28385fd 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -341,7 +341,7 @@ static void scu_ssp_ireq_dif_insert(struct isci_request *ireq, u8 type, u8 op)
 	tc->reserved_E8_0 = 0;
 
 	if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2))
-		tc->ref_tag_seed_gen = scsi_get_lba(scmd) & 0xffffffff;
+		tc->ref_tag_seed_gen = lower_32_bits(scsi_get_pos(scmd));
 	else if (type & SCSI_PROT_DIF_TYPE3)
 		tc->ref_tag_seed_gen = 0;
 }
@@ -369,7 +369,7 @@ static void scu_ssp_ireq_dif_strip(struct isci_request *ireq, u8 type, u8 op)
 	tc->app_tag_gen = 0;
 
 	if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2))
-		tc->ref_tag_seed_verify = scsi_get_lba(scmd) & 0xffffffff;
+		tc->ref_tag_seed_verify = lower_32_bits(scsi_get_pos(scmd));
 	else if (type & SCSI_PROT_DIF_TYPE3)
 		tc->ref_tag_seed_verify = 0;
 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 5/7] qla2xxx: Use scsi_get_pos() instead of scsi_get_lba()
  2021-05-09 21:43 [PATCH 0/7] Rename scsi_get_lba() into scsi_get_pos() Bart Van Assche
                   ` (3 preceding siblings ...)
  2021-05-09 21:43 ` [PATCH 4/7] iscsi: " Bart Van Assche
@ 2021-05-09 21:43 ` Bart Van Assche
  2021-05-09 21:43 ` [PATCH 6/7] ufs: Fix the tracing code Bart Van Assche
  2021-05-09 21:43 ` [PATCH 7/7] Remove scsi_get_lba() Bart Van Assche
  6 siblings, 0 replies; 9+ messages in thread
From: Bart Van Assche @ 2021-05-09 21:43 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Bart Van Assche, Nilesh Javali

Use scsi_get_pos() instead of scsi_get_lba() since the name of the latter
is confusing. Additionally, use lower_32_bits() instead of open-coding it.
This patch does not change any functionality.

Cc: Nilesh Javali <njavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/lpfc/lpfc_scsi.c   | 12 ++++++------
 drivers/scsi/qla2xxx/qla_iocb.c |  9 +++------
 drivers/scsi/qla2xxx/qla_isr.c  |  8 ++++----
 3 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index eefbb9b22798..ebce57c7b742 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -2963,7 +2963,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				"9059 BLKGRD: Guard Tag error in cmd"
 				" 0x%x lba 0x%llx blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
-				(unsigned long long)scsi_get_lba(cmd),
+				(u64)scsi_get_pos(cmd),
 				blk_rq_sectors(cmd->request), bgstat, bghm);
 	}
 
@@ -2980,7 +2980,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				"9060 BLKGRD: Ref Tag error in cmd"
 				" 0x%x lba 0x%llx blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
-				(unsigned long long)scsi_get_lba(cmd),
+				(u64)scsi_get_pos(cmd),
 				blk_rq_sectors(cmd->request), bgstat, bghm);
 	}
 
@@ -2997,7 +2997,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				"9062 BLKGRD: App Tag error in cmd"
 				" 0x%x lba 0x%llx blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
-				(unsigned long long)scsi_get_lba(cmd),
+				(u64)scsi_get_pos(cmd),
 				blk_rq_sectors(cmd->request), bgstat, bghm);
 	}
 
@@ -3028,7 +3028,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 			break;
 		}
 
-		failing_sector = scsi_get_lba(cmd);
+		failing_sector = scsi_get_pos(cmd);
 		failing_sector += bghm;
 
 		/* Descriptor Information */
@@ -3041,7 +3041,7 @@ lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 				"9068 BLKGRD: Unknown error in cmd"
 				" 0x%x lba 0x%llx blk cnt 0x%x "
 				"bgstat=x%x bghm=x%x\n", cmd->cmnd[0],
-				(unsigned long long)scsi_get_lba(cmd),
+				(u64)scsi_get_pos(cmd),
 				blk_rq_sectors(cmd->request), bgstat, bghm);
 
 		/* Calcuate what type of error it was */
@@ -3174,7 +3174,7 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd,
 			break;
 		}
 
-		failing_sector = scsi_get_lba(cmd);
+		failing_sector = scsi_get_pos(cmd);
 		failing_sector += bghm;
 
 		/* Descriptor Information */
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 38b5bdde2405..66e469890a7d 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -778,8 +778,7 @@ qla24xx_set_t10dif_tags(srb_t *sp, struct fw_dif_context *pkt,
 		 * No check for ql2xenablehba_err_chk, as it would be an
 		 * I/O error if hba tag generation is not done.
 		 */
-		pkt->ref_tag = cpu_to_le32((uint32_t)
-		    (0xffffffff & scsi_get_lba(cmd)));
+		pkt->ref_tag = cpu_to_le32(lower_32_bits(scsi_get_pos(cmd)));
 
 		if (!qla2x00_hba_err_chk_enabled(sp))
 			break;
@@ -799,8 +798,7 @@ qla24xx_set_t10dif_tags(srb_t *sp, struct fw_dif_context *pkt,
 		pkt->app_tag_mask[0] = 0x0;
 		pkt->app_tag_mask[1] = 0x0;
 
-		pkt->ref_tag = cpu_to_le32((uint32_t)
-		    (0xffffffff & scsi_get_lba(cmd)));
+		pkt->ref_tag = cpu_to_le32(lower_32_bits(scsi_get_pos(cmd)));
 
 		if (!qla2x00_hba_err_chk_enabled(sp))
 			break;
@@ -824,8 +822,7 @@ qla24xx_set_t10dif_tags(srb_t *sp, struct fw_dif_context *pkt,
 	 * 16 bit app tag.
 	 */
 	case SCSI_PROT_DIF_TYPE1:
-		pkt->ref_tag = cpu_to_le32((uint32_t)
-		    (0xffffffff & scsi_get_lba(cmd)));
+		pkt->ref_tag = cpu_to_le32(lower_32_bits(scsi_get_pos(cmd)));
 		pkt->app_tag = cpu_to_le16(0);
 		pkt->app_tag_mask[0] = 0x0;
 		pkt->app_tag_mask[1] = 0x0;
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 67229af4c142..d6b405d71f45 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -2632,7 +2632,7 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24)
 	    "DIF ERROR in cmd 0x%x lba 0x%llx act ref"
 	    " tag=0x%x, exp ref_tag=0x%x, act app tag=0x%x, exp app"
 	    " tag=0x%x, act guard=0x%x, exp guard=0x%x.\n",
-	    cmd->cmnd[0], (u64)scsi_get_lba(cmd), a_ref_tag, e_ref_tag,
+	    cmd->cmnd[0], (u64)scsi_get_pos(cmd), a_ref_tag, e_ref_tag,
 	    a_app_tag, e_app_tag, a_guard, e_guard);
 
 	/*
@@ -2644,10 +2644,10 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24)
 	    (scsi_get_prot_type(cmd) != SCSI_PROT_DIF_TYPE3 ||
 	     a_ref_tag == be32_to_cpu(T10_PI_REF_ESCAPE))) {
 		uint32_t blocks_done, resid;
-		sector_t lba_s = scsi_get_lba(cmd);
+		sector_t pos = scsi_get_pos(cmd);
 
 		/* 2TB boundary case covered automatically with this */
-		blocks_done = e_ref_tag - (uint32_t)lba_s + 1;
+		blocks_done = e_ref_tag - (uint32_t)pos + 1;
 
 		resid = scsi_bufflen(cmd) - (blocks_done *
 		    cmd->device->sector_size);
@@ -2677,7 +2677,7 @@ qla2x00_handle_dif_error(srb_t *sp, struct sts_entry_24xx *sts24)
 			if (k != blocks_done) {
 				ql_log(ql_log_warn, vha, 0x302f,
 				    "unexpected tag values tag:lba=%x:%llx)\n",
-				    e_ref_tag, (unsigned long long)lba_s);
+				    e_ref_tag, (u64)pos);
 				return 1;
 			}
 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 6/7] ufs: Fix the tracing code
  2021-05-09 21:43 [PATCH 0/7] Rename scsi_get_lba() into scsi_get_pos() Bart Van Assche
                   ` (4 preceding siblings ...)
  2021-05-09 21:43 ` [PATCH 5/7] qla2xxx: " Bart Van Assche
@ 2021-05-09 21:43 ` Bart Van Assche
  2021-05-09 21:43 ` [PATCH 7/7] Remove scsi_get_lba() Bart Van Assche
  6 siblings, 0 replies; 9+ messages in thread
From: Bart Van Assche @ 2021-05-09 21:43 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Bart Van Assche, Lee Susman, Subhash Jadavani, Can Guo

Use scsi_get_pos() instead of scsi_get_lba() since the name of the latter
is confusing. Use scsi_get_pos() for all SCSI requests since all SCSI
requests have a block layer request attached and hence calling
scsi_get_pos() is allowed. Convert the scsi_get_pos() result from sector_t
into an LBA with sectors_to_logical(). Since both READ(10) and WRITE(10)
have a GROUP NUMBER field, extract the GROUP NUMBER field for both types of
commands. Apply the 0x3f mask to that field since the upper two bits are
reserved. Rename the 'transfer_len' variable into 'affected_bytes' since it
represents the number of bytes affected on the storage medium instead of
the size of the SCSI data buffer.

Cc: Lee Susman <lsusman@codeaurora.org>
Cc: Subhash Jadavani <subhashj@codeaurora.org>
Cc: Can Guo <cang@codeaurora.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/ufs/ufshcd.c  | 20 +++++++-------------
 include/trace/events/ufs.h | 10 +++++-----
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 0625da7a42ee..63de6b8a2e26 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -16,6 +16,8 @@
 #include <linux/bitfield.h>
 #include <linux/blk-pm.h>
 #include <linux/blkdev.h>
+#include <scsi/scsi_cmnd.h>
+#include "../sd.h"
 #include "ufshcd.h"
 #include "ufs_quirks.h"
 #include "unipro.h"
@@ -366,7 +368,7 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
 	u32 intr, doorbell;
 	struct ufshcd_lrb *lrbp = &hba->lrb[tag];
 	struct scsi_cmnd *cmd = lrbp->cmd;
-	int transfer_len = -1;
+	int affected_bytes = -1;
 
 	if (!trace_ufshcd_command_enabled()) {
 		/* trace UPIU W/O tracing command */
@@ -378,30 +380,22 @@ static void ufshcd_add_command_trace(struct ufs_hba *hba, unsigned int tag,
 	if (cmd) { /* data phase exists */
 		/* trace UPIU also */
 		ufshcd_add_cmd_upiu_trace(hba, tag, str_t);
+		lba = sectors_to_logical(cmd->device, scsi_get_pos(cmd));
+		affected_bytes = blk_rq_bytes(cmd->request);
 		opcode = cmd->cmnd[0];
 		if ((opcode == READ_10) || (opcode == WRITE_10)) {
 			/*
 			 * Currently we only fully trace read(10) and write(10)
 			 * commands
 			 */
-			if (cmd->request && cmd->request->bio)
-				lba = cmd->request->bio->bi_iter.bi_sector;
-			transfer_len = be32_to_cpu(
-				lrbp->ucd_req_ptr->sc.exp_data_transfer_len);
-			if (opcode == WRITE_10)
-				group_id = lrbp->cmd->cmnd[6];
-		} else if (opcode == UNMAP) {
-			if (cmd->request) {
-				lba = scsi_get_lba(cmd);
-				transfer_len = blk_rq_bytes(cmd->request);
-			}
+			group_id = lrbp->cmd->cmnd[6] & 0x3f;
 		}
 	}
 
 	intr = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
 	doorbell = ufshcd_readl(hba, REG_UTP_TRANSFER_REQ_DOOR_BELL);
 	trace_ufshcd_command(dev_name(hba->dev), str_t, tag,
-			doorbell, transfer_len, intr, lba, opcode, group_id);
+			doorbell, affected_bytes, intr, lba, opcode, group_id);
 }
 
 static void ufshcd_print_clk_freqs(struct ufs_hba *hba)
diff --git a/include/trace/events/ufs.h b/include/trace/events/ufs.h
index 1cb6f1afba0e..b36df5b20ad1 100644
--- a/include/trace/events/ufs.h
+++ b/include/trace/events/ufs.h
@@ -248,10 +248,10 @@ DEFINE_EVENT(ufshcd_template, ufshcd_init,
 
 TRACE_EVENT(ufshcd_command,
 	TP_PROTO(const char *dev_name, enum ufs_trace_str_t str_t,
-		 unsigned int tag, u32 doorbell, int transfer_len, u32 intr,
+		 unsigned int tag, u32 doorbell, int affected_bytes, u32 intr,
 		 u64 lba, u8 opcode, u8 group_id),
 
-	TP_ARGS(dev_name, str_t, tag, doorbell, transfer_len,
+	TP_ARGS(dev_name, str_t, tag, doorbell, affected_bytes,
 				intr, lba, opcode, group_id),
 
 	TP_STRUCT__entry(
@@ -259,7 +259,7 @@ TRACE_EVENT(ufshcd_command,
 		__field(enum ufs_trace_str_t, str_t)
 		__field(unsigned int, tag)
 		__field(u32, doorbell)
-		__field(int, transfer_len)
+		__field(int, affected_bytes)
 		__field(u32, intr)
 		__field(u64, lba)
 		__field(u8, opcode)
@@ -271,7 +271,7 @@ TRACE_EVENT(ufshcd_command,
 		__entry->str_t = str_t;
 		__entry->tag = tag;
 		__entry->doorbell = doorbell;
-		__entry->transfer_len = transfer_len;
+		__entry->affected_bytes = affected_bytes;
 		__entry->intr = intr;
 		__entry->lba = lba;
 		__entry->opcode = opcode;
@@ -281,7 +281,7 @@ TRACE_EVENT(ufshcd_command,
 	TP_printk(
 		"%s: %s: tag: %u, DB: 0x%x, size: %d, IS: %u, LBA: %llu, opcode: 0x%x (%s), group_id: 0x%x",
 		show_ufs_cmd_trace_str(__entry->str_t), __get_str(dev_name),
-		__entry->tag, __entry->doorbell, __entry->transfer_len,
+		__entry->tag, __entry->doorbell, __entry->affected_bytes,
 		__entry->intr, __entry->lba, (u32)__entry->opcode,
 		str_opcode(__entry->opcode), (u32)__entry->group_id
 	)

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 7/7] Remove scsi_get_lba()
  2021-05-09 21:43 [PATCH 0/7] Rename scsi_get_lba() into scsi_get_pos() Bart Van Assche
                   ` (5 preceding siblings ...)
  2021-05-09 21:43 ` [PATCH 6/7] ufs: Fix the tracing code Bart Van Assche
@ 2021-05-09 21:43 ` Bart Van Assche
  6 siblings, 0 replies; 9+ messages in thread
From: Bart Van Assche @ 2021-05-09 21:43 UTC (permalink / raw)
  To: Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Hannes Reinecke, Ming Lei,
	Bart Van Assche

Remove scsi_get_lba() since all callers have been converted to
scsi_get_pos().

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/scsi/scsi_cmnd.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 8147b1c0f265..f8084efa9838 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -285,11 +285,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 sector_t scsi_get_pos(struct scsi_cmnd *scmd)
 {
 	return blk_rq_pos(scmd->request);

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 4/7] iscsi: Use scsi_get_pos() instead of scsi_get_lba()
  2021-05-09 21:43 ` [PATCH 4/7] iscsi: " Bart Van Assche
@ 2021-05-10  1:14   ` Lee Duncan
  0 siblings, 0 replies; 9+ messages in thread
From: Lee Duncan @ 2021-05-10  1:14 UTC (permalink / raw)
  To: Bart Van Assche, Martin K . Petersen, James E . J . Bottomley
  Cc: linux-scsi, Christoph Hellwig, Hannes Reinecke, Ming Lei

On 5/9/21 2:43 PM, Bart Van Assche wrote:
> Use scsi_get_pos() instead of scsi_get_lba() since the name of the latter
> is confusing. Additionally, use lower_32_bits() instead of open-coding it.
> This patch does not change any functionality.
> 
> Cc: Lee Duncan <lduncan@suse.com>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/scsi/isci/request.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
> index e7c6cb4c1556..1c25f28385fd 100644
> --- a/drivers/scsi/isci/request.c
> +++ b/drivers/scsi/isci/request.c
> @@ -341,7 +341,7 @@ static void scu_ssp_ireq_dif_insert(struct isci_request *ireq, u8 type, u8 op)
>  	tc->reserved_E8_0 = 0;
>  
>  	if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2))
> -		tc->ref_tag_seed_gen = scsi_get_lba(scmd) & 0xffffffff;
> +		tc->ref_tag_seed_gen = lower_32_bits(scsi_get_pos(scmd));
>  	else if (type & SCSI_PROT_DIF_TYPE3)
>  		tc->ref_tag_seed_gen = 0;
>  }
> @@ -369,7 +369,7 @@ static void scu_ssp_ireq_dif_strip(struct isci_request *ireq, u8 type, u8 op)
>  	tc->app_tag_gen = 0;
>  
>  	if ((type & SCSI_PROT_DIF_TYPE1) || (type & SCSI_PROT_DIF_TYPE2))
> -		tc->ref_tag_seed_verify = scsi_get_lba(scmd) & 0xffffffff;
> +		tc->ref_tag_seed_verify = lower_32_bits(scsi_get_pos(scmd));
>  	else if (type & SCSI_PROT_DIF_TYPE3)
>  		tc->ref_tag_seed_verify = 0;
>  
> 

Reviewed-by: Lee Duncan <lduncan@suse.com>


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-05-10  1:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-09 21:43 [PATCH 0/7] Rename scsi_get_lba() into scsi_get_pos() Bart Van Assche
2021-05-09 21:43 ` [PATCH 1/7] Introduce scsi_get_pos() Bart Van Assche
2021-05-09 21:43 ` [PATCH 2/7] iser: Use scsi_get_pos() instead of scsi_get_lba() Bart Van Assche
2021-05-09 21:43 ` [PATCH 3/7] zfcp: " Bart Van Assche
2021-05-09 21:43 ` [PATCH 4/7] iscsi: " Bart Van Assche
2021-05-10  1:14   ` Lee Duncan
2021-05-09 21:43 ` [PATCH 5/7] qla2xxx: " Bart Van Assche
2021-05-09 21:43 ` [PATCH 6/7] ufs: Fix the tracing code Bart Van Assche
2021-05-09 21:43 ` [PATCH 7/7] Remove scsi_get_lba() Bart Van Assche

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.