sg: remove __sg_start_req
FUJITA Tomonori [Tue, 2 Sep 2008 13:50:04 +0000 (22:50 +0900)]
__sg_start_req() was used temporarily to call blk_get_request() during
converting sg to use the block layer.

Now sg always calls blk_get_request() so we can move blk_get_request()
to sg_start_req(). We don't need __sg_start_req anymore.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

drivers/scsi/sg.c

index ccce31a..9a56c0d 100644 (file)
@@ -1626,14 +1626,23 @@ exit_sg(void)
        idr_destroy(&sg_index_idr);
 }
 
-static int __sg_start_req(struct sg_request *srp, struct sg_io_hdr *hp,
-                         unsigned char *cmd)
+static int sg_start_req(Sg_request *srp, unsigned char *cmd)
 {
-       struct sg_fd *sfp = srp->parentfp;
-       struct request_queue *q = sfp->parentdp->device->request_queue;
+       int res = 0;
        struct request *rq;
+       Sg_fd *sfp = srp->parentfp;
+       sg_io_hdr_t *hp = &srp->header;
+       int dxfer_len = (int) hp->dxfer_len;
+       int dxfer_dir = hp->dxfer_direction;
+       Sg_scatter_hold *req_schp = &srp->data;
+       Sg_scatter_hold *rsv_schp = &sfp->reserve;
+       struct request_queue *q = sfp->parentdp->device->request_queue;
+       struct rq_map_data map_data;
        int rw = hp->dxfer_direction == SG_DXFER_TO_DEV ? WRITE : READ;
 
+       SCSI_LOG_TIMEOUT(4, printk(KERN_INFO "sg_start_req: dxfer_len=%d\n",
+                                  dxfer_len));
+
        rq = blk_get_request(q, rw, GFP_ATOMIC);
        if (!rq)
                return -ENOMEM;
@@ -1648,27 +1657,6 @@ static int __sg_start_req(struct sg_request *srp, struct sg_io_hdr *hp,
        rq->sense = srp->sense_b;
        rq->retries = SG_DEFAULT_RETRIES;
 
-       return 0;
-}
-
-static int sg_start_req(Sg_request *srp, unsigned char *cmd)
-{
-       int res;
-       Sg_fd *sfp = srp->parentfp;
-       sg_io_hdr_t *hp = &srp->header;
-       int dxfer_len = (int) hp->dxfer_len;
-       int dxfer_dir = hp->dxfer_direction;
-       Sg_scatter_hold *req_schp = &srp->data;
-       Sg_scatter_hold *rsv_schp = &sfp->reserve;
-       struct request_queue *q = sfp->parentdp->device->request_queue;
-       struct rq_map_data map_data;
-
-       SCSI_LOG_TIMEOUT(4, printk("sg_start_req: dxfer_len=%d\n", dxfer_len));
-
-       res = __sg_start_req(srp, hp, cmd);
-       if (res)
-               return res;
-
        if ((dxfer_len <= 0) || (dxfer_dir == SG_DXFER_NONE))
                return 0;