Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bart Van Assche and committed by
Martin K. Petersen
c4deb5b5 5999ccff

+6 -7
+6 -7
drivers/scsi/sr.c
··· 331 331 int good_bytes = (result == 0 ? this_count : 0); 332 332 int block_sectors = 0; 333 333 long error_sector; 334 - struct scsi_cd *cd = scsi_cd(SCpnt->request->rq_disk); 334 + struct request *rq = scsi_cmd_to_rq(SCpnt); 335 + struct scsi_cd *cd = scsi_cd(rq->rq_disk); 335 336 336 337 #ifdef DEBUG 337 338 scmd_printk(KERN_INFO, SCpnt, "done: %x\n", result); ··· 354 353 break; 355 354 error_sector = 356 355 get_unaligned_be32(&SCpnt->sense_buffer[3]); 357 - if (SCpnt->request->bio != NULL) 358 - block_sectors = 359 - bio_sectors(SCpnt->request->bio); 356 + if (rq->bio != NULL) 357 + block_sectors = bio_sectors(rq->bio); 360 358 if (block_sectors < 4) 361 359 block_sectors = 4; 362 360 if (cd->device->sector_size == 2048) 363 361 error_sector <<= 2; 364 362 error_sector &= ~(block_sectors - 1); 365 - good_bytes = (error_sector - 366 - blk_rq_pos(SCpnt->request)) << 9; 363 + good_bytes = (error_sector - blk_rq_pos(rq)) << 9; 367 364 if (good_bytes < 0 || good_bytes >= this_count) 368 365 good_bytes = 0; 369 366 /* ··· 393 394 { 394 395 int block = 0, this_count, s_size; 395 396 struct scsi_cd *cd; 396 - struct request *rq = SCpnt->request; 397 + struct request *rq = scsi_cmd_to_rq(SCpnt); 397 398 blk_status_t ret; 398 399 399 400 ret = scsi_alloc_sgtables(SCpnt);