|
@@ -583,7 +583,7 @@ static struct scatterlist *scsi_sg_alloc(unsigned int nents, gfp_t gfp_mask)
|
|
|
|
|
|
static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq)
|
|
static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq)
|
|
{
|
|
{
|
|
- if (mq && sdb->table.nents <= SCSI_MAX_SG_SEGMENTS)
|
|
|
|
|
|
+ if (mq && sdb->table.orig_nents <= SCSI_MAX_SG_SEGMENTS)
|
|
return;
|
|
return;
|
|
__sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free);
|
|
__sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free);
|
|
}
|
|
}
|
|
@@ -597,8 +597,8 @@ static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq)
|
|
|
|
|
|
if (mq) {
|
|
if (mq) {
|
|
if (nents <= SCSI_MAX_SG_SEGMENTS) {
|
|
if (nents <= SCSI_MAX_SG_SEGMENTS) {
|
|
- sdb->table.nents = nents;
|
|
|
|
- sg_init_table(sdb->table.sgl, sdb->table.nents);
|
|
|
|
|
|
+ sdb->table.nents = sdb->table.orig_nents = nents;
|
|
|
|
+ sg_init_table(sdb->table.sgl, nents);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
first_chunk = sdb->table.sgl;
|
|
first_chunk = sdb->table.sgl;
|