aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sg.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-09-02 09:50:04 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:14 -0400
commit44c7b0eaa041007066e30ab4869d5bbf8dad5989 (patch)
tree4c127ab80d271c86c38ea3a382667e88f00b83ca /drivers/scsi/sg.c
parentfd1c1de0766844af4cfc39298e109ad273e72a9e (diff)
sg: remove __sg_start_req
__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>
Diffstat (limited to 'drivers/scsi/sg.c')
-rw-r--r--drivers/scsi/sg.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index ccce31a400ea..9a56c0d320bf 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1626,14 +1626,23 @@ exit_sg(void)
1626 idr_destroy(&sg_index_idr); 1626 idr_destroy(&sg_index_idr);
1627} 1627}
1628 1628
1629static int __sg_start_req(struct sg_request *srp, struct sg_io_hdr *hp, 1629static int sg_start_req(Sg_request *srp, unsigned char *cmd)
1630 unsigned char *cmd)
1631{ 1630{
1632 struct sg_fd *sfp = srp->parentfp; 1631 int res = 0;
1633 struct request_queue *q = sfp->parentdp->device->request_queue;
1634 struct request *rq; 1632 struct request *rq;
1633 Sg_fd *sfp = srp->parentfp;
1634 sg_io_hdr_t *hp = &srp->header;
1635 int dxfer_len = (int) hp->dxfer_len;
1636 int dxfer_dir = hp->dxfer_direction;
1637 Sg_scatter_hold *req_schp = &srp->data;
1638 Sg_scatter_hold *rsv_schp = &sfp->reserve;
1639 struct request_queue *q = sfp->parentdp->device->request_queue;
1640 struct rq_map_data map_data;
1635 int rw = hp->dxfer_direction == SG_DXFER_TO_DEV ? WRITE : READ; 1641 int rw = hp->dxfer_direction == SG_DXFER_TO_DEV ? WRITE : READ;
1636 1642
1643 SCSI_LOG_TIMEOUT(4, printk(KERN_INFO "sg_start_req: dxfer_len=%d\n",
1644 dxfer_len));
1645
1637 rq = blk_get_request(q, rw, GFP_ATOMIC); 1646 rq = blk_get_request(q, rw, GFP_ATOMIC);
1638 if (!rq) 1647 if (!rq)
1639 return -ENOMEM; 1648 return -ENOMEM;
@@ -1648,27 +1657,6 @@ static int __sg_start_req(struct sg_request *srp, struct sg_io_hdr *hp,
1648 rq->sense = srp->sense_b; 1657 rq->sense = srp->sense_b;
1649 rq->retries = SG_DEFAULT_RETRIES; 1658 rq->retries = SG_DEFAULT_RETRIES;
1650 1659
1651 return 0;
1652}
1653
1654static int sg_start_req(Sg_request *srp, unsigned char *cmd)
1655{
1656 int res;
1657 Sg_fd *sfp = srp->parentfp;
1658 sg_io_hdr_t *hp = &srp->header;
1659 int dxfer_len = (int) hp->dxfer_len;
1660 int dxfer_dir = hp->dxfer_direction;
1661 Sg_scatter_hold *req_schp = &srp->data;
1662 Sg_scatter_hold *rsv_schp = &sfp->reserve;
1663 struct request_queue *q = sfp->parentdp->device->request_queue;
1664 struct rq_map_data map_data;
1665
1666 SCSI_LOG_TIMEOUT(4, printk("sg_start_req: dxfer_len=%d\n", dxfer_len));
1667
1668 res = __sg_start_req(srp, hp, cmd);
1669 if (res)
1670 return res;
1671
1672 if ((dxfer_len <= 0) || (dxfer_dir == SG_DXFER_NONE)) 1660 if ((dxfer_len <= 0) || (dxfer_dir == SG_DXFER_NONE))
1673 return 0; 1661 return 0;
1674 1662