mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-07 22:03:14 +00:00
scsi: sr: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
Prepare for removal of the request pointer by using scsi_cmd_to_rq() instead. This patch does not change any functionality. Link: https://lore.kernel.org/r/20210809230355.8186-5-bvanassche@acm.org Cc: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.de> Cc: Ming Lei <ming.lei@redhat.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
5999ccff0f
commit
c4deb5b5dd
@ -331,7 +331,8 @@ static int sr_done(struct scsi_cmnd *SCpnt)
|
||||
int good_bytes = (result == 0 ? this_count : 0);
|
||||
int block_sectors = 0;
|
||||
long error_sector;
|
||||
struct scsi_cd *cd = scsi_cd(SCpnt->request->rq_disk);
|
||||
struct request *rq = scsi_cmd_to_rq(SCpnt);
|
||||
struct scsi_cd *cd = scsi_cd(rq->rq_disk);
|
||||
|
||||
#ifdef DEBUG
|
||||
scmd_printk(KERN_INFO, SCpnt, "done: %x\n", result);
|
||||
@ -353,16 +354,14 @@ static int sr_done(struct scsi_cmnd *SCpnt)
|
||||
break;
|
||||
error_sector =
|
||||
get_unaligned_be32(&SCpnt->sense_buffer[3]);
|
||||
if (SCpnt->request->bio != NULL)
|
||||
block_sectors =
|
||||
bio_sectors(SCpnt->request->bio);
|
||||
if (rq->bio != NULL)
|
||||
block_sectors = bio_sectors(rq->bio);
|
||||
if (block_sectors < 4)
|
||||
block_sectors = 4;
|
||||
if (cd->device->sector_size == 2048)
|
||||
error_sector <<= 2;
|
||||
error_sector &= ~(block_sectors - 1);
|
||||
good_bytes = (error_sector -
|
||||
blk_rq_pos(SCpnt->request)) << 9;
|
||||
good_bytes = (error_sector - blk_rq_pos(rq)) << 9;
|
||||
if (good_bytes < 0 || good_bytes >= this_count)
|
||||
good_bytes = 0;
|
||||
/*
|
||||
@ -394,7 +393,7 @@ static blk_status_t sr_init_command(struct scsi_cmnd *SCpnt)
|
||||
{
|
||||
int block = 0, this_count, s_size;
|
||||
struct scsi_cd *cd;
|
||||
struct request *rq = SCpnt->request;
|
||||
struct request *rq = scsi_cmd_to_rq(SCpnt);
|
||||
blk_status_t ret;
|
||||
|
||||
ret = scsi_alloc_sgtables(SCpnt);
|
||||
|
Loading…
Reference in New Issue
Block a user