[stgt] [PATCH 2/2] kill cmd->scsi_cmd_done

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Fri Aug 26 21:10:36 CEST 2011


everyone calls target_cmd_io_done() via cmd->scsi_cmd_done.

Signed-off-by: FUJITA Tomonori <fujita.tomonori at lab.ntt.co.jp>
---
 usr/bs.c        |    4 ++--
 usr/bs_aio.c    |    2 +-
 usr/bs_sg.c     |    6 ++----
 usr/mmc.c       |    2 --
 usr/osd.c       |    1 -
 usr/sbc.c       |    3 ---
 usr/scsi_cmnd.h |    2 --
 usr/ssc.c       |    2 --
 8 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/usr/bs.c b/usr/bs.c
index d72d090..f985ef1 100644
--- a/usr/bs.c
+++ b/usr/bs.c
@@ -140,7 +140,7 @@ static void bs_thread_request_done(int fd, int events, void *data)
 		dprintf("back to tgtd, %p\n", cmd);
 
 		list_del(&cmd->bs_list);
-		cmd->scsi_cmd_done(cmd, scsi_get_result(cmd));
+		target_cmd_io_done(cmd, scsi_get_result(cmd));
 	}
 
 rewrite:
@@ -175,7 +175,7 @@ static void bs_sig_request_done(int fd, int events, void *data)
 
 		list_del(&cmd->bs_list);
 
-		cmd->scsi_cmd_done(cmd, scsi_get_result(cmd));
+		target_cmd_io_done(cmd, scsi_get_result(cmd));
 	}
 }
 
diff --git a/usr/bs_aio.c b/usr/bs_aio.c
index 1300649..2828961 100644
--- a/usr/bs_aio.c
+++ b/usr/bs_aio.c
@@ -103,7 +103,7 @@ get_events:
 			result = SAM_STAT_CHECK_CONDITION;
 		}
 
-		cmd->scsi_cmd_done(cmd, result);
+		target_cmd_io_done(cmd, result);
 	}
 
 	if (total)
diff --git a/usr/bs_sg.c b/usr/bs_sg.c
index 53e9e0f..f0f037d 100644
--- a/usr/bs_sg.c
+++ b/usr/bs_sg.c
@@ -95,7 +95,6 @@ static int bs_sg_rw(int host_no, struct scsi_cmd *cmd)
 	unsigned char key = ILLEGAL_REQUEST;
 	uint16_t asc = ASC_LUN_NOT_SUPPORTED;
 
-	cmd->scsi_cmd_done = target_cmd_io_done;
 	ret = cmd->dev->bst->bs_cmd_submit(cmd);
 	if (ret) {
 		key = HARDWARE_ERROR;
@@ -262,8 +261,7 @@ static void bs_bsg_cmd_complete(int fd, int events, void *data)
 		scsi_set_out_resid_by_actual(cmd, 0);
 		scsi_set_in_resid_by_actual(cmd, 0);
 	}
-	dprintf("[%d] BSG() Calling cmd->scsi_cmd_done()\n", getpid());
-	cmd->scsi_cmd_done(cmd, io_hdr.device_status);
+	target_cmd_io_done(cmd, io_hdr.device_status);
 }
 
 static void bs_sg_cmd_complete(int fd, int events, void *data)
@@ -297,7 +295,7 @@ static void bs_sg_cmd_complete(int fd, int events, void *data)
 		scsi_set_in_resid_by_actual(cmd, resid);
 	}
 
-	cmd->scsi_cmd_done(cmd, io_hdr.status);
+	target_cmd_io_done(cmd, io_hdr.status);
 }
 
 static int get_bsg_major(char *path)
diff --git a/usr/mmc.c b/usr/mmc.c
index 4712ec5..dba7859 100644
--- a/usr/mmc.c
+++ b/usr/mmc.c
@@ -97,8 +97,6 @@ static int mmc_rw(int host_no, struct scsi_cmd *cmd)
 		break;
 	}
 
-	cmd->scsi_cmd_done = target_cmd_io_done;
-
 	offset = scsi_rw_offset(cmd->scb);
 	cmd->offset = (offset << MMC_BLK_SHIFT);
 
diff --git a/usr/osd.c b/usr/osd.c
index d81c6cf..2ab29ac 100644
--- a/usr/osd.c
+++ b/usr/osd.c
@@ -31,7 +31,6 @@
 
 static int osd_varlen_cdb(int host_no, struct scsi_cmd *cmd)
 {
-	cmd->scsi_cmd_done = target_cmd_io_done;
 	return cmd->dev->bst->bs_cmd_submit(cmd);
 }
 
diff --git a/usr/sbc.c b/usr/sbc.c
index cb07be6..f6f0dfd 100644
--- a/usr/sbc.c
+++ b/usr/sbc.c
@@ -148,7 +148,6 @@ static int sbc_rw(int host_no, struct scsi_cmd *cmd)
 		goto sense;
 	}
 
-	cmd->scsi_cmd_done = target_cmd_io_done;
 	cmd->offset = lba;
 
 	ret = cmd->dev->bst->bs_cmd_submit(cmd);
@@ -265,8 +264,6 @@ static int sbc_sync_cache(int host_no, struct scsi_cmd *cmd)
 	if (device_reserved(cmd))
 		return SAM_STAT_RESERVATION_CONFLICT;
 
-	cmd->scsi_cmd_done = target_cmd_io_done;
-
 	ret = cmd->dev->bst->bs_cmd_submit(cmd);
 	switch (ret) {
 	case EROFS:
diff --git a/usr/scsi_cmnd.h b/usr/scsi_cmnd.h
index e11395b..c764c4e 100644
--- a/usr/scsi_cmnd.h
+++ b/usr/scsi_cmnd.h
@@ -45,8 +45,6 @@ struct scsi_cmd {
 	unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE];
 	int sense_len;
 
-	void (*scsi_cmd_done)(struct scsi_cmd *, int);
-
 	struct list_head bs_list;
 
 	struct it_nexus *it_nexus;
diff --git a/usr/ssc.c b/usr/ssc.c
index dccd4fd..94beda1 100644
--- a/usr/ssc.c
+++ b/usr/ssc.c
@@ -66,8 +66,6 @@ static int ssc_rw(int host_no, struct scsi_cmd *cmd)
 	if (ret)
 		return SAM_STAT_RESERVATION_CONFLICT;
 
-	cmd->scsi_cmd_done = target_cmd_io_done;
-
 	ret = cmd->dev->bst->bs_cmd_submit(cmd);
 	if (ret) {
 		key = HARDWARE_ERROR;
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list