Skip to contentSkip to conversation

kill duplicated scsi_cmnd->pid

PATCH In review Chen, Kenneth W 2 participants 3 messages Nov 24, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kill duplicated scsi_cmnd->pid

Kill scsi_cmnd->pid, since it is exactly the same as ->serial_number. No need to use two variables for the same thing. (it's easier to remove pid since usage in printk is a lot less compare to serial_number, only dc395x and tmscsim).

 drivers/scsi/dc395x.c     |  110 +++++++++++++++++++++++-----------------------
 drivers/scsi/scsi.c       |    4 -
 drivers/scsi/scsi_error.c |    6 --
 drivers/scsi/tmscsim.c    |    4 -
 include/scsi/scsi_cmnd.h  |    5 --
 include/scsi/scsi_host.h  |    2 
 6 files changed, 59 insertions(+), 72 deletions(-)
include/scsi/scsi_cmnd.h renamed from include/scsi/scsi_cmnd.h.orig +1 -4
@@ -47,9 +47,7 @@ struct scsi_cmnd {
 	 * has been completed.  It currently doesn't have much use other
 	 * than printk's.  Some lldd's use this number for other purposes.
 	 * It's almost certain that such usages are either incorrect or
-	 * meaningless.  Please kill all usages other than printk's.  Also,
-	 * as this number is always identical to ->pid, please convert
-	 * printk's to use ->pid, so that we can kill this field.
+	 * meaningless.  Please kill all usages other than printk's.
 	 */
 	unsigned long serial_number;
 	/*
@@ -130,7 +128,6 @@ struct scsi_cmnd {
 	int result;		/* Status code from lower level driver */
 
 	unsigned char tag;	/* SCSI-II queued command tag */
-	unsigned long pid;	/* Process ID, starts at 0. Unique per host. */
 };
 
 /*
include/scsi/scsi_host.h renamed from include/scsi/scsi_host.h.orig +1 -1
@@ -526,7 +526,7 @@ struct Scsi_Host {
 	 * Used to assign serial numbers to the cmds.
 	 * Protected by the host lock.
 	 */
-	unsigned long cmd_serial_number, cmd_pid; 
+	unsigned long cmd_serial_number; 
 	
 	unsigned unchecked_isa_dma:1;
 	unsigned use_clustering:1;
drivers/scsi/scsi_error.c renamed from drivers/scsi/scsi_error.c.orig +0 -6
@@ -1702,12 +1702,6 @@ scsi_reset_provider(struct scsi_device *
 
 	init_timer(&scmd->eh_timeout);
 
-	/*
-	 * Sometimes the command can get back into the timer chain,
-	 * so use the pid as an identifier.
-	 */
-	scmd->pid			= 0;
-
 	switch (flag) {
 	case SCSI_TRY_RESET_DEVICE:
 		rtn = scsi_try_bus_device_reset(scmd);
drivers/scsi/scsi.c renamed from drivers/scsi/scsi.c.orig +0 -4
@@ -511,10 +511,6 @@ static inline void scsi_cmd_get_serial(s
 	cmd->serial_number = host->cmd_serial_number++;
 	if (cmd->serial_number == 0) 
 		cmd->serial_number = host->cmd_serial_number++;
-	
-	cmd->pid = host->cmd_pid++;
-	if (cmd->pid == 0)
-		cmd->pid = host->cmd_pid++;
 }
 
 /*
drivers/scsi/dc395x.c renamed from drivers/scsi/dc395x.c.orig +55 -55

428 lines not on this page · raw message

drivers/scsi/tmscsim.c renamed from drivers/scsi/tmscsim.c.orig +2 -2
@@ -2086,7 +2086,7 @@ static int DC390_abort(struct scsi_cmnd 
 	struct dc390_dcb *pDCB = (struct dc390_dcb*) cmd->device->hostdata;
 
 	scmd_printk(KERN_WARNING, cmd,
-		"DC390: Abort command (pid %li)\n", cmd->pid);
+		"DC390: Abort command (pid %li)\n", cmd->serial_number);
 
 	/* abort() is too stupid for already sent commands at the moment. 
 	 * If it's called we are in trouble anyway, so let's dump some info 
@@ -2094,7 +2094,7 @@ static int DC390_abort(struct scsi_cmnd 
 	dc390_dumpinfo(pACB, pDCB, NULL);
 
 	pDCB->DCBFlag |= ABORT_DEV_;
-	printk(KERN_INFO "DC390: Aborted pid %li\n", cmd->pid);
+	printk(KERN_INFO "DC390: Aborted pid %li\n", cmd->serial_number);
 
 	return FAILED;
 }
#1 lore raw
Quoted 4 lines · Kenneth W

Kill scsi_cmnd->pid, since it is exactly the same as ->serial_number. No need to use two variables for the same thing. (it's easier to remove pid since usage in printk is a lot less compare to serial_number, only dc395x and tmscsim).

But serial_number makes much more sense than pid as a name, so it's better to kill pid, even though it's a bigger patch.

#2 lore raw

Matthew Wilcox wrote on Wednesday, November 23, 2005 5:02 PM

Quoted 8 lines · Kenneth W
Quoted 4 lines

Kill scsi_cmnd->pid, since it is exactly the same as ->serial_number. No need to use two variables for the same thing. (it's easier to remove pid since usage in printk is a lot less compare to serial_number, only dc395x and tmscsim).

But serial_number makes much more sense than pid as a name, so it's better to kill pid, even though it's a bigger patch.

Totally agree :-)

- Ken