aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-10-16 05:12:37 -0400
committerJens Axboe <jens.axboe@oracle.com>2007-10-16 05:12:37 -0400
commit0cde8d9510e242c73b2d68f9949cd3c456c863b4 (patch)
tree12f2b2fb9de0db6b9293214fcbd790965195fd38 /drivers/scsi/scsi_lib.c
parent4c2f6d4c282c4d5210221697b9895ad90bc697cb (diff)
scsi: simplify scsi_free_sgtable()
Just pass in the command, no point in passing in the scatterlist and scatterlist pool index seperately. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 960f949b8f8f..7e1dcc57f115 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -741,13 +741,14 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask)
741 741
742EXPORT_SYMBOL(scsi_alloc_sgtable); 742EXPORT_SYMBOL(scsi_alloc_sgtable);
743 743
744void scsi_free_sgtable(struct scatterlist *sgl, int index) 744void scsi_free_sgtable(struct scsi_cmnd *cmd)
745{ 745{
746 struct scatterlist *sgl = cmd->request_buffer;
746 struct scsi_host_sg_pool *sgp; 747 struct scsi_host_sg_pool *sgp;
747 748
748 BUG_ON(index >= SG_MEMPOOL_NR); 749 BUG_ON(cmd->sglist_len >= SG_MEMPOOL_NR);
749 750
750 sgp = scsi_sg_pools + index; 751 sgp = scsi_sg_pools + cmd->sglist_len;
751 mempool_free(sgl, sgp->pool); 752 mempool_free(sgl, sgp->pool);
752} 753}
753 754
@@ -773,7 +774,7 @@ EXPORT_SYMBOL(scsi_free_sgtable);
773static void scsi_release_buffers(struct scsi_cmnd *cmd) 774static void scsi_release_buffers(struct scsi_cmnd *cmd)
774{ 775{
775 if (cmd->use_sg) 776 if (cmd->use_sg)
776 scsi_free_sgtable(cmd->request_buffer, cmd->sglist_len); 777 scsi_free_sgtable(cmd);
777 778
778 /* 779 /*
779 * Zero these out. They now point to freed memory, and it is 780 * Zero these out. They now point to freed memory, and it is