WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [linux-2.6.18-xen] pvSCSI: Clean up code

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] pvSCSI: Clean up code
From: "Xen patchbot-linux-2.6.18-xen" <patchbot-linux-2.6.18-xen@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 04 Jul 2008 08:00:20 -0700
Delivery-date: Fri, 04 Jul 2008 08:01:14 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1215088802 -3600
# Node ID c4134d1a3e3f8df10c7204595db9750311c5e68c
# Parent  920abc7b20acaebabf844910e4b461378fae3007
pvSCSI: Clean up code

Signed-off-by: Tomonari Horikoshi <t.horikoshi@xxxxxxxxxxxxxx>
Signed-off-by: Jun Kamada <kama@xxxxxxxxxxxxxx>
---
 drivers/xen/scsiback/common.h    |    4 --
 drivers/xen/scsiback/interface.c |    2 -
 drivers/xen/scsiback/scsiback.c  |   66 ++++++++++-----------------------------
 3 files changed, 20 insertions(+), 52 deletions(-)

diff -r 920abc7b20ac -r c4134d1a3e3f drivers/xen/scsiback/common.h
--- a/drivers/xen/scsiback/common.h     Thu Jul 03 13:36:53 2008 +0100
+++ b/drivers/xen/scsiback/common.h     Thu Jul 03 13:40:02 2008 +0100
@@ -112,8 +112,6 @@ typedef struct {
 
        uint16_t rqid;
        
-       vscsiif_request_t *ring_req;
-       
        uint8_t nr_segments;
        uint8_t cmnd[VSCSIIF_MAX_COMMAND_SIZE];
        uint8_t cmd_len;
@@ -123,7 +121,7 @@ typedef struct {
        
        uint32_t request_bufflen;
        struct scatterlist *sgl;
-       grant_ref_t gref[VSCSIIF_SENSE_BUFFERSIZE];
+       grant_ref_t gref[VSCSIIF_SG_TABLESIZE];
 
        int32_t rslt;
        uint8_t sense_buffer[VSCSIIF_SENSE_BUFFERSIZE];
diff -r 920abc7b20ac -r c4134d1a3e3f drivers/xen/scsiback/interface.c
--- a/drivers/xen/scsiback/interface.c  Thu Jul 03 13:36:53 2008 +0100
+++ b/drivers/xen/scsiback/interface.c  Thu Jul 03 13:40:02 2008 +0100
@@ -80,7 +80,7 @@ static int map_frontend_page( struct vsc
        info->shmem_ref    = ring_ref;
        info->shmem_handle = op.handle;
 
-       return 0;
+       return (GNTST_okay);
 }
 
 static void unmap_frontend_page(struct vscsibk_info *info)
diff -r 920abc7b20ac -r c4134d1a3e3f drivers/xen/scsiback/scsiback.c
--- a/drivers/xen/scsiback/scsiback.c   Thu Jul 03 13:36:53 2008 +0100
+++ b/drivers/xen/scsiback/scsiback.c   Thu Jul 03 13:40:02 2008 +0100
@@ -46,8 +46,6 @@
 #include "common.h"
 
 
-#define  NO_ASYNC  1 /*!aync*/
-
 struct list_head pending_free;
 DEFINE_SPINLOCK(pending_free_lock);
 DECLARE_WAIT_QUEUE_HEAD(pending_free_wq);
@@ -207,20 +205,12 @@ static void scsiback_print_status(char *
 }
 
 
-#ifdef NO_ASYNC /*!async*/
 static void scsiback_cmd_done(struct request *req, int errors)
 {
        pending_req_t *pending_req = req->end_io_data;
        unsigned char *sense_buffer;
 
        sense_buffer = req->sense;
-#else
-static void scsiback_cmd_done(void *data, char *sense_buffer,
-                               int errors, int resid)
-{
-       pending_req_t *pending_req = data;
-       struct scsi_device *sdev = pending_req->sdev;
-#endif
 
        if (errors != 0) {
                if (log_print_stat)
@@ -233,9 +223,7 @@ static void scsiback_cmd_done(void *data
        scsiback_do_resp_with_sense(sense_buffer, errors, pending_req);
        scsiback_put(pending_req->info);
 
-#ifdef NO_ASYNC /*!async*/
        __blk_put_request(req->q, req);
-#endif
 }
 
 
@@ -309,8 +297,6 @@ fail_flush:
        scsiback_fast_flush_area(pending_req);
        return -ENOMEM;
 }
-
-#ifdef NO_ASYNC /*!async*/
 
 /* quoted scsi_lib.c/scsi_merge_bio */
 static int scsiback_merge_bio(struct request *rq, struct bio *bio)
@@ -422,7 +408,6 @@ free_bios:
        return err;
 }
 
-#endif
 
 void scsiback_cmd_exec(pending_req_t *pending_req)
 {
@@ -430,14 +415,8 @@ void scsiback_cmd_exec(pending_req_t *pe
        int data_dir = (int)pending_req->sc_data_direction;
        unsigned int nr_segments = (unsigned int)pending_req->nr_segments;
        unsigned int timeout;
-
-#ifdef NO_ASYNC /*!async*/
        struct request *rq;
        int write;
-#else
-       int err = 0;
-       unsigned int data_len = pending_req->request_bufflen;
-#endif
 
        DPRINTK("%s\n",__FUNCTION__);
 
@@ -447,7 +426,6 @@ void scsiback_cmd_exec(pending_req_t *pe
        else
                timeout = VSCSIIF_TIMEOUT;
 
-#ifdef NO_ASYNC /*!async*/
        write = (data_dir == DMA_TO_DEVICE);
        rq = blk_get_request(pending_req->sdev->request_queue, write, 
GFP_KERNEL);
 
@@ -474,18 +452,6 @@ void scsiback_cmd_exec(pending_req_t *pe
 
        scsiback_get(pending_req->info);
        blk_execute_rq_nowait(rq->q, NULL, rq, 1, scsiback_cmd_done);
-#else   /*async*/
-
-       scsiback_get(pending_req->info);
-       err = scsi_execute_async(pending_req->sdev, &(pending_req->cmnd[0]),
-               cmd_len, data_dir, pending_req->sgl, data_len, nr_segments, 
timeout, 0,
-               pending_req, scsiback_cmd_done, GFP_KERNEL);
-
-       if (err) {
-               scsiback_do_resp_with_sense(NULL, (DRIVER_ERROR << 24), 
pending_req);
-       }
-
-#endif    /*async*/
 
        return ;
 }
@@ -531,6 +497,7 @@ static int prepare_pending_reqs(struct v
        vir.tgt = ring_req->id;
        vir.lun = ring_req->lun;
 
+       rmb();
        sdev = scsiback_do_translation(info, &vir);
        if (!sdev) {
                pending_req->sdev = NULL;
@@ -541,34 +508,37 @@ static int prepare_pending_reqs(struct v
        pending_req->sdev = sdev;
 
        /* request range check from frontend */
-       if ((ring_req->sc_data_direction != DMA_BIDIRECTIONAL) &&
-               (ring_req->sc_data_direction != DMA_TO_DEVICE) &&
-               (ring_req->sc_data_direction != DMA_FROM_DEVICE) &&
-               (ring_req->sc_data_direction != DMA_NONE)) {
+       pending_req->sc_data_direction = ring_req->sc_data_direction;
+       rmb();
+       if ((pending_req->sc_data_direction != DMA_BIDIRECTIONAL) &&
+               (pending_req->sc_data_direction != DMA_TO_DEVICE) &&
+               (pending_req->sc_data_direction != DMA_FROM_DEVICE) &&
+               (pending_req->sc_data_direction != DMA_NONE)) {
                DPRINTK("scsiback: invalid parameter data_dir = %d\n",
-                       ring_req->sc_data_direction);
+                       pending_req->sc_data_direction);
                err = -EINVAL;
                goto invald_value;
        }
 
-       if (ring_req->nr_segments > VSCSIIF_SG_TABLESIZE) {
+       pending_req->nr_segments = ring_req->nr_segments;
+       rmb();
+       if (pending_req->nr_segments > VSCSIIF_SG_TABLESIZE) {
                DPRINTK("scsiback: invalid parameter nr_seg = %d\n",
-                       ring_req->nr_segments);
+                       pending_req->nr_segments);
                err = -EINVAL;
                goto invald_value;
        }
-       pending_req->nr_segments = ring_req->nr_segments;
-
-       if (ring_req->cmd_len > VSCSIIF_MAX_COMMAND_SIZE) {
+
+       pending_req->cmd_len = ring_req->cmd_len;
+       rmb();
+       if (pending_req->cmd_len > VSCSIIF_MAX_COMMAND_SIZE) {
                DPRINTK("scsiback: invalid parameter cmd_len = %d\n",
-                       ring_req->cmd_len);
+                       pending_req->cmd_len);
                err = -EINVAL;
                goto invald_value;
        }
-       memcpy(pending_req->cmnd, ring_req->cmnd, ring_req->cmd_len);
-       pending_req->cmd_len = ring_req->cmd_len;
+       memcpy(pending_req->cmnd, ring_req->cmnd, pending_req->cmd_len);
        
-       pending_req->sc_data_direction = ring_req->sc_data_direction;
        pending_req->timeout_per_command = ring_req->timeout_per_command;
 
        if(scsiback_gnttab_data_map(ring_req, pending_req)) {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] pvSCSI: Clean up code, Xen patchbot-linux-2.6.18-xen <=