]> git.ipfire.org Git - thirdparty/linux.git/blobdiff - drivers/scsi/scsi_lib.c
scsi: lib/sg_pool.c: improve APIs for allocating sg pool
[thirdparty/linux.git] / drivers / scsi / scsi_lib.c
index 0916bd6d22b06ea279bd1b9f52f2adc9af986ed3..acc0f7080f187d23877fb9ccdd7eb9b972112180 100644 (file)
@@ -541,9 +541,9 @@ static void scsi_uninit_cmd(struct scsi_cmnd *cmd)
 static void scsi_mq_free_sgtables(struct scsi_cmnd *cmd)
 {
        if (cmd->sdb.table.nents)
-               sg_free_table_chained(&cmd->sdb.table, true);
+               sg_free_table_chained(&cmd->sdb.table, SG_CHUNK_SIZE);
        if (scsi_prot_sg_count(cmd))
-               sg_free_table_chained(&cmd->prot_sdb->table, true);
+               sg_free_table_chained(&cmd->prot_sdb->table, SG_CHUNK_SIZE);
 }
 
 static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd)
@@ -976,7 +976,8 @@ static blk_status_t scsi_init_sgtable(struct request *req,
         * If sg table allocation fails, requeue request later.
         */
        if (unlikely(sg_alloc_table_chained(&sdb->table,
-                       blk_rq_nr_phys_segments(req), sdb->table.sgl)))
+                       blk_rq_nr_phys_segments(req), sdb->table.sgl,
+                       SG_CHUNK_SIZE)))
                return BLK_STS_RESOURCE;
 
        /* 
@@ -1030,7 +1031,8 @@ blk_status_t scsi_init_io(struct scsi_cmnd *cmd)
                ivecs = blk_rq_count_integrity_sg(rq->q, rq->bio);
 
                if (sg_alloc_table_chained(&prot_sdb->table, ivecs,
-                               prot_sdb->table.sgl)) {
+                               prot_sdb->table.sgl,
+                               SG_CHUNK_SIZE)) {
                        ret = BLK_STS_RESOURCE;
                        goto out_free_sgtables;
                }