aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sd.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 09:24:39 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:50:54 -0400
commit83096ebf1263b2c1ee5e653ba37d993d02e3eb7b (patch)
tree2226b71a616ec1cb2d37511c6a09ba9507a1cd69 /drivers/scsi/sd.c
parent5b93629b4509c03ffa87a9316412fedf6f58cb37 (diff)
block: convert to pos and nr_sectors accessors
With recent cleanups, there is no place where low level driver directly manipulates request fields. This means that the 'hard' request fields always equal the !hard fields. Convert all rq->sectors, nr_sectors and current_nr_sectors references to accessors. While at it, drop superflous blk_rq_pos() < 0 test in swim.c. [ Impact: use pos and nr_sectors accessors ] Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Tested-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Grant Likely <grant.likely@secretlab.ca> Tested-by: Adrian McMenamin <adrian@mcmen.demon.co.uk> Acked-by: Adrian McMenamin <adrian@mcmen.demon.co.uk> Acked-by: Mike Miller <mike.miller@hp.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Cc: Borislav Petkov <petkovbb@googlemail.com> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: Eric Moore <Eric.Moore@lsi.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Pete Zaitcev <zaitcev@redhat.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Paul Clements <paul.clements@steeleye.com> Cc: Tim Waugh <tim@cyberelk.net> Cc: Jeff Garzik <jgarzik@pobox.com> Cc: Jeremy Fitzhardinge <jeremy@xensource.com> Cc: Alex Dubov <oakad@yahoo.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Dario Ballabio <ballabio_dario@emc.com> Cc: David S. Miller <davem@davemloft.net> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: unsik Kim <donari75@gmail.com> Cc: Laurent Vivier <Laurent@lvivier.info> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r--drivers/scsi/sd.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 3fcb64b91c43..70c4dd99bbf0 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -383,9 +383,9 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
383 struct scsi_device *sdp = q->queuedata; 383 struct scsi_device *sdp = q->queuedata;
384 struct gendisk *disk = rq->rq_disk; 384 struct gendisk *disk = rq->rq_disk;
385 struct scsi_disk *sdkp; 385 struct scsi_disk *sdkp;
386 sector_t block = rq->sector; 386 sector_t block = blk_rq_pos(rq);
387 sector_t threshold; 387 sector_t threshold;
388 unsigned int this_count = rq->nr_sectors; 388 unsigned int this_count = blk_rq_sectors(rq);
389 int ret, host_dif; 389 int ret, host_dif;
390 390
391 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) { 391 if (rq->cmd_type == REQ_TYPE_BLOCK_PC) {
@@ -412,10 +412,10 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
412 this_count)); 412 this_count));
413 413
414 if (!sdp || !scsi_device_online(sdp) || 414 if (!sdp || !scsi_device_online(sdp) ||
415 block + rq->nr_sectors > get_capacity(disk)) { 415 block + blk_rq_sectors(rq) > get_capacity(disk)) {
416 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, 416 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
417 "Finishing %ld sectors\n", 417 "Finishing %u sectors\n",
418 rq->nr_sectors)); 418 blk_rq_sectors(rq)));
419 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, 419 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
420 "Retry with 0x%p\n", SCpnt)); 420 "Retry with 0x%p\n", SCpnt));
421 goto out; 421 goto out;
@@ -462,7 +462,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
462 * for this. 462 * for this.
463 */ 463 */
464 if (sdp->sector_size == 1024) { 464 if (sdp->sector_size == 1024) {
465 if ((block & 1) || (rq->nr_sectors & 1)) { 465 if ((block & 1) || (blk_rq_sectors(rq) & 1)) {
466 scmd_printk(KERN_ERR, SCpnt, 466 scmd_printk(KERN_ERR, SCpnt,
467 "Bad block number requested\n"); 467 "Bad block number requested\n");
468 goto out; 468 goto out;
@@ -472,7 +472,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
472 } 472 }
473 } 473 }
474 if (sdp->sector_size == 2048) { 474 if (sdp->sector_size == 2048) {
475 if ((block & 3) || (rq->nr_sectors & 3)) { 475 if ((block & 3) || (blk_rq_sectors(rq) & 3)) {
476 scmd_printk(KERN_ERR, SCpnt, 476 scmd_printk(KERN_ERR, SCpnt,
477 "Bad block number requested\n"); 477 "Bad block number requested\n");
478 goto out; 478 goto out;
@@ -482,7 +482,7 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
482 } 482 }
483 } 483 }
484 if (sdp->sector_size == 4096) { 484 if (sdp->sector_size == 4096) {
485 if ((block & 7) || (rq->nr_sectors & 7)) { 485 if ((block & 7) || (blk_rq_sectors(rq) & 7)) {
486 scmd_printk(KERN_ERR, SCpnt, 486 scmd_printk(KERN_ERR, SCpnt,
487 "Bad block number requested\n"); 487 "Bad block number requested\n");
488 goto out; 488 goto out;
@@ -511,10 +511,10 @@ static int sd_prep_fn(struct request_queue *q, struct request *rq)
511 } 511 }
512 512
513 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt, 513 SCSI_LOG_HLQUEUE(2, scmd_printk(KERN_INFO, SCpnt,
514 "%s %d/%ld 512 byte blocks.\n", 514 "%s %d/%u 512 byte blocks.\n",
515 (rq_data_dir(rq) == WRITE) ? 515 (rq_data_dir(rq) == WRITE) ?
516 "writing" : "reading", this_count, 516 "writing" : "reading", this_count,
517 rq->nr_sectors)); 517 blk_rq_sectors(rq)));
518 518
519 /* Set RDPROTECT/WRPROTECT if disk is formatted with DIF */ 519 /* Set RDPROTECT/WRPROTECT if disk is formatted with DIF */
520 host_dif = scsi_host_dif_capable(sdp->host, sdkp->protection_type); 520 host_dif = scsi_host_dif_capable(sdp->host, sdkp->protection_type);
@@ -970,8 +970,8 @@ static struct block_device_operations sd_fops = {
970 970
971static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) 971static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd)
972{ 972{
973 u64 start_lba = scmd->request->sector; 973 u64 start_lba = blk_rq_pos(scmd->request);
974 u64 end_lba = scmd->request->sector + (scsi_bufflen(scmd) / 512); 974 u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512);
975 u64 bad_lba; 975 u64 bad_lba;
976 int info_valid; 976 int info_valid;
977 977