[PATCH 07/10] target: core: Extend CaW logging

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

 



Pass se_cmd to the compare_and_write_do_cmp() for extended logging.

Reviewed-by: Dmitriy Bogdanov <d.bogdanov@xxxxxxxxx>
Signed-off-by: Anastasia Kovaleva <a.kovaleva@xxxxxxxxx>
---
 drivers/target/target_core_sbc.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 86b9a0bc6e90..22b705bc7f91 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -375,10 +375,12 @@ static sense_reason_t compare_and_write_post(struct se_cmd *cmd, bool success,
  * @miscmp_off and return TCM_MISCOMPARE_VERIFY.
  */
 static sense_reason_t
-compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
-			 struct scatterlist *cmp_sgl, unsigned int cmp_nents,
-			 unsigned int cmp_len, unsigned int *miscmp_off)
+compare_and_write_do_cmp(struct se_cmd *cmd, unsigned int cmp_len, unsigned int *miscmp_off)
 {
+	struct scatterlist *read_sgl = cmd->t_bidi_data_sg;
+	struct scatterlist *cmp_sgl = cmd->t_data_sg;
+	unsigned int read_nents = cmd->t_bidi_data_nents;
+	unsigned int cmp_nents = cmd->t_data_nents;
 	unsigned char *buf = NULL;
 	struct scatterlist *sg;
 	sense_reason_t ret;
@@ -394,7 +396,7 @@ compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
 
 	rc = sg_copy_to_buffer(cmp_sgl, cmp_nents, buf, cmp_len);
 	if (!rc) {
-		target_err("sg_copy_to_buffer() failed for compare_and_write\n");
+		target_cmd_err(cmd, "sg_copy_to_buffer() failed for compare_and_write\n");
 		ret = TCM_OUT_OF_RESOURCES;
 		goto out;
 	}
@@ -413,7 +415,7 @@ compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
 			for (i = 0; i < len && addr[i] == buf[offset + i]; i++)
 				;
 			*miscmp_off = offset + i;
-			target_warn("Detected MISCOMPARE at offset %u\n", *miscmp_off);
+			target_cmd_warn(cmd, "Detected MISCOMPARE at offset %u\n", *miscmp_off);
 			ret = TCM_MISCOMPARE_VERIFY;
 		}
 		kunmap_atomic(addr);
@@ -425,7 +427,7 @@ compare_and_write_do_cmp(struct scatterlist *read_sgl, unsigned int read_nents,
 		if (!cmp_len)
 			break;
 	}
-	target_debug("COMPARE AND WRITE read data matches compare data\n");
+	target_cmd_debug(cmd, "COMPARE AND WRITE read data matches compare data\n");
 out:
 	kfree(buf);
 	return ret;
@@ -479,12 +481,7 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes
 		goto out;
 	}
 
-	ret = compare_and_write_do_cmp(cmd->t_bidi_data_sg,
-				       cmd->t_bidi_data_nents,
-				       cmd->t_data_sg,
-				       cmd->t_data_nents,
-				       compare_len,
-				       &miscmp_off);
+	ret = compare_and_write_do_cmp(cmd, compare_len, &miscmp_off);
 	if (ret == TCM_MISCOMPARE_VERIFY) {
 		/*
 		 * SBC-4 r15: 5.3 COMPARE AND WRITE command
-- 
2.40.3





[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux