/*
* first loop through, set initial index and return value
*/
- if (!ret) {
- cmd->sglist_len = index;
+ if (!ret)
ret = sgl;
- }
/*
* chain previous sglist, if any. we know the previous
struct scatterlist *sgl = cmd->request_buffer;
struct scsi_host_sg_pool *sgp;
- BUG_ON(cmd->sglist_len >= SG_MEMPOOL_NR);
-
/*
* if this is the biggest size sglist, check if we have
* chained parts we need to free
* Restore original, will be freed below
*/
sgl = cmd->request_buffer;
- }
+ sgp = scsi_sg_pools + SG_MEMPOOL_NR - 1;
+ } else
+ sgp = scsi_sg_pools + scsi_sgtable_index(cmd->__use_sg);
- sgp = scsi_sg_pools + cmd->sglist_len;
mempool_free(sgl, sgp->pool);
}
/* These elements define the operation we ultimately want to perform */
unsigned short use_sg; /* Number of pieces of scatter-gather */
- unsigned short sglist_len; /* size of malloc'd scatter-gather list */
unsigned short __use_sg;
unsigned underflow; /* Return error if less than