]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] libiscsi: pass opcode into alloc_pdu callout
authorMike Christie <michaelc@cs.wisc.edu>
Tue, 2 Dec 2008 06:32:14 +0000 (00:32 -0600)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 29 Dec 2008 17:24:23 +0000 (11:24 -0600)
We do not need to allocate a itt for data_out, so this
passes the opcode to the alloc_pdu callout.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/infiniband/ulp/iser/iscsi_iser.c
drivers/scsi/iscsi_tcp.c
drivers/scsi/libiscsi.c
drivers/scsi/libiscsi_tcp.c
include/scsi/scsi_transport_iscsi.h

index 78bf5e4538cb2dfff93a77325cbebe5152bfaaa4..12876392516e84d746f5109e15043ffe39594465 100644 (file)
@@ -119,7 +119,7 @@ error:
        iscsi_conn_failure(conn, rc);
 }
 
-static int iscsi_iser_pdu_alloc(struct iscsi_task *task)
+static int iscsi_iser_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
 {
        struct iscsi_iser_task *iser_task = task->dd_data;
 
index 07d9eb14721bd9c3947e221e8c0d2957260d9aff..de5c9b3e51fb1b39340c75606757cb3c9809ea54 100644 (file)
@@ -457,7 +457,7 @@ static int iscsi_sw_tcp_pdu_init(struct iscsi_task *task,
        return 0;
 }
 
-static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task *task)
+static int iscsi_sw_tcp_pdu_alloc(struct iscsi_task *task, uint8_t opcode)
 {
        struct iscsi_tcp_task *tcp_task = task->dd_data;
 
index 6c4034b1561c9e87da4cd67cd95c6421fb947b16..ddf53978f0bef79a96ba9bed54801e3b68a44766 100644 (file)
@@ -225,13 +225,18 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
        itt_t itt;
        int rc;
 
-       rc = conn->session->tt->alloc_pdu(task);
+       rc = conn->session->tt->alloc_pdu(task, ISCSI_OP_SCSI_CMD);
        if (rc)
                return rc;
        hdr = (struct iscsi_cmd *) task->hdr;
        itt = hdr->itt;
        memset(hdr, 0, sizeof(*hdr));
 
+       if (session->tt->parse_pdu_itt)
+               hdr->itt = task->hdr_itt = itt;
+       else
+               hdr->itt = task->hdr_itt = build_itt(task->itt,
+                                                    task->conn->session->age);
        task->hdr_len = 0;
        rc = iscsi_add_hdr(task, sizeof(*hdr));
        if (rc)
@@ -240,11 +245,6 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
        hdr->flags = ISCSI_ATTR_SIMPLE;
        int_to_scsilun(sc->device->lun, (struct scsi_lun *)hdr->lun);
        memcpy(task->lun, hdr->lun, sizeof(task->lun));
-       if (session->tt->parse_pdu_itt)
-               hdr->itt = task->hdr_itt = itt;
-       else
-               hdr->itt = task->hdr_itt = build_itt(task->itt,
-                                                    task->conn->session->age);
        hdr->cmdsn = task->cmdsn = cpu_to_be32(session->cmdsn);
        session->cmdsn++;
        hdr->exp_statsn = cpu_to_be32(conn->exp_statsn);
@@ -532,7 +532,7 @@ __iscsi_conn_send_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
        } else
                task->data_count = 0;
 
-       if (conn->session->tt->alloc_pdu(task)) {
+       if (conn->session->tt->alloc_pdu(task, hdr->opcode)) {
                iscsi_conn_printk(KERN_ERR, conn, "Could not allocate "
                                 "pdu for mgmt task.\n");
                goto requeue_task;
index e86508936314454144d18fcffbca7346c9735dbd..9df6b3436e4a517a52be377a6873152b2ab8b93a 100644 (file)
@@ -1021,7 +1021,7 @@ flush:
                return 0;
        }
 
-       rc = conn->session->tt->alloc_pdu(task);
+       rc = conn->session->tt->alloc_pdu(task, ISCSI_OP_SCSI_DATA_OUT);
        if (rc)
                return rc;
        iscsi_prep_data_out_pdu(task, r2t, (struct iscsi_data *) task->hdr);
index e13cb20f1eaefa8be18336f32563741c08ea9573..b50aabe2861e1d469d84f2dceb029bd9bf7a1d7d 100644 (file)
@@ -118,7 +118,7 @@ struct iscsi_transport {
        int (*xmit_task) (struct iscsi_task *task);
        void (*cleanup_task) (struct iscsi_task *task);
 
-       int (*alloc_pdu) (struct iscsi_task *task);
+       int (*alloc_pdu) (struct iscsi_task *task, uint8_t opcode);
        int (*xmit_pdu) (struct iscsi_task *task);
        int (*init_pdu) (struct iscsi_task *task, unsigned int offset,
                         unsigned int count);