[SCSI] iscsi_iser: convert to use the data buffer accessors
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Fri, 1 Jun 2007 09:56:21 +0000 (18:56 +0900)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Tue, 19 Jun 2007 00:48:43 +0000 (19:48 -0500)
iscsi_iser: convert to use the data buffer accessors

- remove the unnecessary map_single path.

- convert to use the new accessors for the sg lists and the
parameters.

TODO: use scsi_for_each_sg().

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Erez Zilber <erezz@voltaire.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/infiniband/ulp/iser/iscsi_iser.c
drivers/infiniband/ulp/iser/iser_initiator.c

index 1bf173decade5d28bb81dd4a55cf0302b98ce4d4..effdee299b0c4ff2ade61260d2fe1b7a22509294 100644 (file)
@@ -210,10 +210,10 @@ iscsi_iser_ctask_xmit(struct iscsi_conn *conn,
        int error = 0;
 
        if (ctask->sc->sc_data_direction == DMA_TO_DEVICE) {
-               BUG_ON(ctask->sc->request_bufflen == 0);
+               BUG_ON(scsi_bufflen(ctask->sc) == 0);
 
                debug_scsi("cmd [itt %x total %d imm %d unsol_data %d\n",
-                          ctask->itt, ctask->sc->request_bufflen,
+                          ctask->itt, scsi_bufflen(ctask->sc),
                           ctask->imm_count, ctask->unsol_count);
        }
 
index 3651072f6c1f012b3ecd6a7f097fe3cc9777aa70..9ea5b9aaba7c679059f3b0c8d298506a152facc7 100644 (file)
@@ -351,18 +351,12 @@ int iser_send_command(struct iscsi_conn     *conn,
        else
                data_buf = &iser_ctask->data[ISER_DIR_OUT];
 
-       if (sc->use_sg) { /* using a scatter list */
-               data_buf->buf  = sc->request_buffer;
-               data_buf->size = sc->use_sg;
-       } else if (sc->request_bufflen) {
-               /* using a single buffer - convert it into one entry SG */
-               sg_init_one(&data_buf->sg_single,
-                           sc->request_buffer, sc->request_bufflen);
-               data_buf->buf   = &data_buf->sg_single;
-               data_buf->size  = 1;
+       if (scsi_sg_count(sc)) { /* using a scatter list */
+               data_buf->buf  = scsi_sglist(sc);
+               data_buf->size = scsi_sg_count(sc);
        }
 
-       data_buf->data_len = sc->request_bufflen;
+       data_buf->data_len = scsi_bufflen(sc);
 
        if (hdr->flags & ISCSI_FLAG_CMD_READ) {
                err = iser_prepare_read_cmd(ctask, edtl);