Lines Matching refs:sdb
585 static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq) in scsi_free_sgtable() argument
587 if (mq && sdb->table.orig_nents <= SCSI_MAX_SG_SEGMENTS) in scsi_free_sgtable()
589 __sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free); in scsi_free_sgtable()
592 static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) in scsi_alloc_sgtable() argument
601 sdb->table.nents = sdb->table.orig_nents = nents; in scsi_alloc_sgtable()
602 sg_init_table(sdb->table.sgl, nents); in scsi_alloc_sgtable()
605 first_chunk = sdb->table.sgl; in scsi_alloc_sgtable()
608 ret = __sg_alloc_table(&sdb->table, nents, SCSI_MAX_SG_SEGMENTS, in scsi_alloc_sgtable()
611 scsi_free_sgtable(sdb, mq); in scsi_alloc_sgtable()
627 if (cmd->sdb.table.nents) in scsi_mq_free_sgtables()
628 scsi_free_sgtable(&cmd->sdb, true); in scsi_mq_free_sgtables()
670 if (cmd->sdb.table.nents) in scsi_release_buffers()
671 scsi_free_sgtable(&cmd->sdb, false); in scsi_release_buffers()
673 memset(&cmd->sdb, 0, sizeof(cmd->sdb)); in scsi_release_buffers()
1083 static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb) in scsi_init_sgtable() argument
1090 if (unlikely(scsi_alloc_sgtable(sdb, req->nr_phys_segments, in scsi_init_sgtable()
1098 count = blk_rq_map_sg(req->q, req, sdb->table.sgl); in scsi_init_sgtable()
1099 BUG_ON(count > sdb->table.nents); in scsi_init_sgtable()
1100 sdb->table.nents = count; in scsi_init_sgtable()
1101 sdb->length = blk_rq_bytes(req); in scsi_init_sgtable()
1125 error = scsi_init_sgtable(rq, &cmd->sdb); in scsi_init_io()
1238 memset(&cmd->sdb, 0, sizeof(cmd->sdb)); in scsi_setup_blk_pc_cmnd()
1931 cmd->sdb.table.sgl = sg; in scsi_mq_prep_fn()