diff mbox series

[08/15] scsi: scsi_debug: Remove dump_sector()

Message ID 20210609033929.3815-9-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
The function used to dump sectors containing protection information
errors was useful during initial development over a decade ago.
However, dump_sector() substantially slows down the system during
testing due to writing an entire sector's worth of data to syslog on
every error.

We now log plenty of information about the nature of detected
protection information errors throughout the stack. Dumping the entire
contents of an offending sector is no longer needed.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/scsi/scsi_debug.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

Comments

Douglas Gilbert June 14, 2021, 10:06 p.m. UTC | #1
On 2021-06-08 11:39 p.m., Martin K. Petersen wrote:
> The function used to dump sectors containing protection information

> errors was useful during initial development over a decade ago.

> However, dump_sector() substantially slows down the system during

> testing due to writing an entire sector's worth of data to syslog on

> every error.

> 

> We now log plenty of information about the nature of detected

> protection information errors throughout the stack. Dumping the entire

> contents of an offending sector is no longer needed.

> 

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


Reviewed-by: Douglas Gilbert <dgilbert@interlog.com>
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 5b3a20a140f9..9033ab4911ba 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3232,28 +3232,6 @@  static int resp_read_dt0(struct scsi_cmnd *scp, struct sdebug_dev_info *devip)
 	return 0;
 }
 
-static void dump_sector(unsigned char *buf, int len)
-{
-	int i, j, n;
-
-	pr_err(">>> Sector Dump <<<\n");
-	for (i = 0 ; i < len ; i += 16) {
-		char b[128];
-
-		for (j = 0, n = 0; j < 16; j++) {
-			unsigned char c = buf[i+j];
-
-			if (c >= 0x20 && c < 0x7e)
-				n += scnprintf(b + n, sizeof(b) - n,
-					       " %c ", buf[i+j]);
-			else
-				n += scnprintf(b + n, sizeof(b) - n,
-					       "%02x ", buf[i+j]);
-		}
-		pr_err("%04d: %s\n", i, b);
-	}
-}
-
 static int prot_verify_write(struct scsi_cmnd *SCpnt, sector_t start_sec,
 			     unsigned int sectors, u32 ei_lba)
 {
@@ -3300,10 +3278,8 @@  static int prot_verify_write(struct scsi_cmnd *SCpnt, sector_t start_sec,
 			daddr = diter.addr + dpage_offset;
 
 			ret = dif_verify(sdt, daddr, sector, ei_lba);
-			if (ret) {
-				dump_sector(daddr, sdebug_sector_size);
+			if (ret)
 				goto out;
-			}
 
 			sector++;
 			ei_lba++;