Lines Matching refs:sdb
584 static void scsi_free_sgtable(struct scsi_data_buffer *sdb, bool mq) in scsi_free_sgtable() argument
586 if (mq && sdb->table.orig_nents <= SCSI_MAX_SG_SEGMENTS) in scsi_free_sgtable()
588 __sg_free_table(&sdb->table, SCSI_MAX_SG_SEGMENTS, mq, scsi_sg_free); in scsi_free_sgtable()
591 static int scsi_alloc_sgtable(struct scsi_data_buffer *sdb, int nents, bool mq) in scsi_alloc_sgtable() argument
600 sdb->table.nents = sdb->table.orig_nents = nents; in scsi_alloc_sgtable()
601 sg_init_table(sdb->table.sgl, nents); in scsi_alloc_sgtable()
604 first_chunk = sdb->table.sgl; in scsi_alloc_sgtable()
607 ret = __sg_alloc_table(&sdb->table, nents, SCSI_MAX_SG_SEGMENTS, in scsi_alloc_sgtable()
610 scsi_free_sgtable(sdb, mq); in scsi_alloc_sgtable()
626 if (cmd->sdb.table.nents) in scsi_mq_free_sgtables()
627 scsi_free_sgtable(&cmd->sdb, true); in scsi_mq_free_sgtables()
669 if (cmd->sdb.table.nents) in scsi_release_buffers()
670 scsi_free_sgtable(&cmd->sdb, false); in scsi_release_buffers()
672 memset(&cmd->sdb, 0, sizeof(cmd->sdb)); in scsi_release_buffers()
1082 static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb) in scsi_init_sgtable() argument
1089 if (unlikely(scsi_alloc_sgtable(sdb, req->nr_phys_segments, in scsi_init_sgtable()
1097 count = blk_rq_map_sg(req->q, req, sdb->table.sgl); in scsi_init_sgtable()
1098 BUG_ON(count > sdb->table.nents); in scsi_init_sgtable()
1099 sdb->table.nents = count; in scsi_init_sgtable()
1100 sdb->length = blk_rq_bytes(req); in scsi_init_sgtable()
1124 error = scsi_init_sgtable(rq, &cmd->sdb); in scsi_init_io()
1237 memset(&cmd->sdb, 0, sizeof(cmd->sdb)); in scsi_setup_blk_pc_cmnd()
1931 cmd->sdb.table.sgl = sg; in scsi_mq_prep_fn()