aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
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/block
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/block')
-rw-r--r--drivers/block/DAC960.c6
-rw-r--r--drivers/block/amiflop.c6
-rw-r--r--drivers/block/ataflop.c10
-rw-r--r--drivers/block/cciss.c22
-rw-r--r--drivers/block/cpqarray.c9
-rw-r--r--drivers/block/floppy.c53
-rw-r--r--drivers/block/hd.c14
-rw-r--r--drivers/block/mg_disk.c25
-rw-r--r--drivers/block/nbd.c12
-rw-r--r--drivers/block/paride/pcd.c4
-rw-r--r--drivers/block/paride/pd.c8
-rw-r--r--drivers/block/paride/pf.c8
-rw-r--r--drivers/block/ps3disk.c9
-rw-r--r--drivers/block/sunvdc.c2
-rw-r--r--drivers/block/swim.c6
-rw-r--r--drivers/block/swim3.c34
-rw-r--r--drivers/block/sx8.c6
-rw-r--r--drivers/block/ub.c6
-rw-r--r--drivers/block/viodasd.c2
-rw-r--r--drivers/block/virtio_blk.c2
-rw-r--r--drivers/block/xd.c4
-rw-r--r--drivers/block/xen-blkfront.c11
-rw-r--r--drivers/block/xsysace.c17
-rw-r--r--drivers/block/z2ram.c6
24 files changed, 143 insertions, 139 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
index f22ed6cc69f2..774ab05973a9 100644
--- a/drivers/block/DAC960.c
+++ b/drivers/block/DAC960.c
@@ -3338,8 +3338,8 @@ static int DAC960_process_queue(DAC960_Controller_T *Controller, struct request_
3338 } 3338 }
3339 Command->Completion = Request->end_io_data; 3339 Command->Completion = Request->end_io_data;
3340 Command->LogicalDriveNumber = (long)Request->rq_disk->private_data; 3340 Command->LogicalDriveNumber = (long)Request->rq_disk->private_data;
3341 Command->BlockNumber = Request->sector; 3341 Command->BlockNumber = blk_rq_pos(Request);
3342 Command->BlockCount = Request->nr_sectors; 3342 Command->BlockCount = blk_rq_sectors(Request);
3343 Command->Request = Request; 3343 Command->Request = Request;
3344 blkdev_dequeue_request(Request); 3344 blkdev_dequeue_request(Request);
3345 Command->SegmentCount = blk_rq_map_sg(req_q, 3345 Command->SegmentCount = blk_rq_map_sg(req_q,
@@ -3431,7 +3431,7 @@ static void DAC960_queue_partial_rw(DAC960_Command_T *Command)
3431 * successfully as possible. 3431 * successfully as possible.
3432 */ 3432 */
3433 Command->SegmentCount = 1; 3433 Command->SegmentCount = 1;
3434 Command->BlockNumber = Request->sector; 3434 Command->BlockNumber = blk_rq_pos(Request);
3435 Command->BlockCount = 1; 3435 Command->BlockCount = 1;
3436 DAC960_QueueReadWriteCommand(Command); 3436 DAC960_QueueReadWriteCommand(Command);
3437 return; 3437 return;
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 8ff95f2c0ede..e4a14b94828e 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -1351,13 +1351,13 @@ static void redo_fd_request(void)
1351 drive = floppy - unit; 1351 drive = floppy - unit;
1352 1352
1353 /* Here someone could investigate to be more efficient */ 1353 /* Here someone could investigate to be more efficient */
1354 for (cnt = 0; cnt < CURRENT->current_nr_sectors; cnt++) { 1354 for (cnt = 0; cnt < blk_rq_cur_sectors(CURRENT); cnt++) {
1355#ifdef DEBUG 1355#ifdef DEBUG
1356 printk("fd: sector %ld + %d requested for %s\n", 1356 printk("fd: sector %ld + %d requested for %s\n",
1357 CURRENT->sector,cnt, 1357 blk_rq_pos(CURRENT), cnt,
1358 (rq_data_dir(CURRENT) == READ) ? "read" : "write"); 1358 (rq_data_dir(CURRENT) == READ) ? "read" : "write");
1359#endif 1359#endif
1360 block = CURRENT->sector + cnt; 1360 block = blk_rq_pos(CURRENT) + cnt;
1361 if ((int)block > floppy->blocks) { 1361 if ((int)block > floppy->blocks) {
1362 __blk_end_request_cur(CURRENT, -EIO); 1362 __blk_end_request_cur(CURRENT, -EIO);
1363 goto repeat; 1363 goto repeat;
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 25067287211f..234024cda5ec 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -725,7 +725,7 @@ static void do_fd_action( int drive )
725 if (IS_BUFFERED( drive, ReqSide, ReqTrack )) { 725 if (IS_BUFFERED( drive, ReqSide, ReqTrack )) {
726 if (ReqCmd == READ) { 726 if (ReqCmd == READ) {
727 copy_buffer( SECTOR_BUFFER(ReqSector), ReqData ); 727 copy_buffer( SECTOR_BUFFER(ReqSector), ReqData );
728 if (++ReqCnt < CURRENT->current_nr_sectors) { 728 if (++ReqCnt < blk_rq_cur_sectors(CURRENT)) {
729 /* read next sector */ 729 /* read next sector */
730 setup_req_params( drive ); 730 setup_req_params( drive );
731 goto repeat; 731 goto repeat;
@@ -1130,7 +1130,7 @@ static void fd_rwsec_done1(int status)
1130 } 1130 }
1131 } 1131 }
1132 1132
1133 if (++ReqCnt < CURRENT->current_nr_sectors) { 1133 if (++ReqCnt < blk_rq_cur_sectors(CURRENT)) {
1134 /* read next sector */ 1134 /* read next sector */
1135 setup_req_params( SelectedDrive ); 1135 setup_req_params( SelectedDrive );
1136 do_fd_action( SelectedDrive ); 1136 do_fd_action( SelectedDrive );
@@ -1394,7 +1394,7 @@ static void redo_fd_request(void)
1394 1394
1395 DPRINT(("redo_fd_request: CURRENT=%p dev=%s CURRENT->sector=%ld\n", 1395 DPRINT(("redo_fd_request: CURRENT=%p dev=%s CURRENT->sector=%ld\n",
1396 CURRENT, CURRENT ? CURRENT->rq_disk->disk_name : "", 1396 CURRENT, CURRENT ? CURRENT->rq_disk->disk_name : "",
1397 CURRENT ? CURRENT->sector : 0 )); 1397 CURRENT ? blk_rq_pos(CURRENT) : 0 ));
1398 1398
1399 IsFormatting = 0; 1399 IsFormatting = 0;
1400 1400
@@ -1440,7 +1440,7 @@ repeat:
1440 UD.autoprobe = 0; 1440 UD.autoprobe = 0;
1441 } 1441 }
1442 1442
1443 if (CURRENT->sector + 1 > UDT->blocks) { 1443 if (blk_rq_pos(CURRENT) + 1 > UDT->blocks) {
1444 __blk_end_request_cur(CURRENT, -EIO); 1444 __blk_end_request_cur(CURRENT, -EIO);
1445 goto repeat; 1445 goto repeat;
1446 } 1446 }
@@ -1450,7 +1450,7 @@ repeat:
1450 1450
1451 ReqCnt = 0; 1451 ReqCnt = 0;
1452 ReqCmd = rq_data_dir(CURRENT); 1452 ReqCmd = rq_data_dir(CURRENT);
1453 ReqBlock = CURRENT->sector; 1453 ReqBlock = blk_rq_pos(CURRENT);
1454 ReqBuffer = CURRENT->buffer; 1454 ReqBuffer = CURRENT->buffer;
1455 setup_req_params( drive ); 1455 setup_req_params( drive );
1456 do_fd_action( drive ); 1456 do_fd_action( drive );
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index f22d4932433f..ab7b04c0db70 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -2835,10 +2835,10 @@ static void do_cciss_request(struct request_queue *q)
2835 c->Request.Timeout = 0; // Don't time out 2835 c->Request.Timeout = 0; // Don't time out
2836 c->Request.CDB[0] = 2836 c->Request.CDB[0] =
2837 (rq_data_dir(creq) == READ) ? h->cciss_read : h->cciss_write; 2837 (rq_data_dir(creq) == READ) ? h->cciss_read : h->cciss_write;
2838 start_blk = creq->sector; 2838 start_blk = blk_rq_pos(creq);
2839#ifdef CCISS_DEBUG 2839#ifdef CCISS_DEBUG
2840 printk(KERN_DEBUG "ciss: sector =%d nr_sectors=%d\n", (int)creq->sector, 2840 printk(KERN_DEBUG "ciss: sector =%d nr_sectors=%d\n",
2841 (int)creq->nr_sectors); 2841 (int)blk_rq_pos(creq), (int)blk_rq_sectors(creq));
2842#endif /* CCISS_DEBUG */ 2842#endif /* CCISS_DEBUG */
2843 2843
2844 sg_init_table(tmp_sg, MAXSGENTRIES); 2844 sg_init_table(tmp_sg, MAXSGENTRIES);
@@ -2864,8 +2864,8 @@ static void do_cciss_request(struct request_queue *q)
2864 h->maxSG = seg; 2864 h->maxSG = seg;
2865 2865
2866#ifdef CCISS_DEBUG 2866#ifdef CCISS_DEBUG
2867 printk(KERN_DEBUG "cciss: Submitting %lu sectors in %d segments\n", 2867 printk(KERN_DEBUG "cciss: Submitting %u sectors in %d segments\n",
2868 creq->nr_sectors, seg); 2868 blk_rq_sectors(creq), seg);
2869#endif /* CCISS_DEBUG */ 2869#endif /* CCISS_DEBUG */
2870 2870
2871 c->Header.SGList = c->Header.SGTotal = seg; 2871 c->Header.SGList = c->Header.SGTotal = seg;
@@ -2877,8 +2877,8 @@ static void do_cciss_request(struct request_queue *q)
2877 c->Request.CDB[4] = (start_blk >> 8) & 0xff; 2877 c->Request.CDB[4] = (start_blk >> 8) & 0xff;
2878 c->Request.CDB[5] = start_blk & 0xff; 2878 c->Request.CDB[5] = start_blk & 0xff;
2879 c->Request.CDB[6] = 0; // (sect >> 24) & 0xff; MSB 2879 c->Request.CDB[6] = 0; // (sect >> 24) & 0xff; MSB
2880 c->Request.CDB[7] = (creq->nr_sectors >> 8) & 0xff; 2880 c->Request.CDB[7] = (blk_rq_sectors(creq) >> 8) & 0xff;
2881 c->Request.CDB[8] = creq->nr_sectors & 0xff; 2881 c->Request.CDB[8] = blk_rq_sectors(creq) & 0xff;
2882 c->Request.CDB[9] = c->Request.CDB[11] = c->Request.CDB[12] = 0; 2882 c->Request.CDB[9] = c->Request.CDB[11] = c->Request.CDB[12] = 0;
2883 } else { 2883 } else {
2884 u32 upper32 = upper_32_bits(start_blk); 2884 u32 upper32 = upper_32_bits(start_blk);
@@ -2893,10 +2893,10 @@ static void do_cciss_request(struct request_queue *q)
2893 c->Request.CDB[7]= (start_blk >> 16) & 0xff; 2893 c->Request.CDB[7]= (start_blk >> 16) & 0xff;
2894 c->Request.CDB[8]= (start_blk >> 8) & 0xff; 2894 c->Request.CDB[8]= (start_blk >> 8) & 0xff;
2895 c->Request.CDB[9]= start_blk & 0xff; 2895 c->Request.CDB[9]= start_blk & 0xff;
2896 c->Request.CDB[10]= (creq->nr_sectors >> 24) & 0xff; 2896 c->Request.CDB[10]= (blk_rq_sectors(creq) >> 24) & 0xff;
2897 c->Request.CDB[11]= (creq->nr_sectors >> 16) & 0xff; 2897 c->Request.CDB[11]= (blk_rq_sectors(creq) >> 16) & 0xff;
2898 c->Request.CDB[12]= (creq->nr_sectors >> 8) & 0xff; 2898 c->Request.CDB[12]= (blk_rq_sectors(creq) >> 8) & 0xff;
2899 c->Request.CDB[13]= creq->nr_sectors & 0xff; 2899 c->Request.CDB[13]= blk_rq_sectors(creq) & 0xff;
2900 c->Request.CDB[14] = c->Request.CDB[15] = 0; 2900 c->Request.CDB[14] = c->Request.CDB[15] = 0;
2901 } 2901 }
2902 } else if (blk_pc_request(creq)) { 2902 } else if (blk_pc_request(creq)) {
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 488a8f4a60aa..a5caeff4718e 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -919,10 +919,11 @@ queue_next:
919 c->hdr.size = sizeof(rblk_t) >> 2; 919 c->hdr.size = sizeof(rblk_t) >> 2;
920 c->size += sizeof(rblk_t); 920 c->size += sizeof(rblk_t);
921 921
922 c->req.hdr.blk = creq->sector; 922 c->req.hdr.blk = blk_rq_pos(creq);
923 c->rq = creq; 923 c->rq = creq;
924DBGPX( 924DBGPX(
925 printk("sector=%d, nr_sectors=%d\n", creq->sector, creq->nr_sectors); 925 printk("sector=%d, nr_sectors=%u\n",
926 blk_rq_pos(creq), blk_rq_sectors(creq));
926); 927);
927 sg_init_table(tmp_sg, SG_MAX); 928 sg_init_table(tmp_sg, SG_MAX);
928 seg = blk_rq_map_sg(q, creq, tmp_sg); 929 seg = blk_rq_map_sg(q, creq, tmp_sg);
@@ -940,9 +941,9 @@ DBGPX(
940 tmp_sg[i].offset, 941 tmp_sg[i].offset,
941 tmp_sg[i].length, dir); 942 tmp_sg[i].length, dir);
942 } 943 }
943DBGPX( printk("Submitting %d sectors in %d segments\n", creq->nr_sectors, seg); ); 944DBGPX( printk("Submitting %u sectors in %d segments\n", blk_rq_sectors(creq), seg); );
944 c->req.hdr.sg_cnt = seg; 945 c->req.hdr.sg_cnt = seg;
945 c->req.hdr.blk_cnt = creq->nr_sectors; 946 c->req.hdr.blk_cnt = blk_rq_sectors(creq);
946 c->req.hdr.cmd = (rq_data_dir(creq) == READ) ? IDA_READ : IDA_WRITE; 947 c->req.hdr.cmd = (rq_data_dir(creq) == READ) ? IDA_READ : IDA_WRITE;
947 c->type = CMD_RWREQ; 948 c->type = CMD_RWREQ;
948 949
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 1300df6f1642..452486283386 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -2303,7 +2303,7 @@ static void floppy_end_request(struct request *req, int error)
2303 2303
2304 /* current_count_sectors can be zero if transfer failed */ 2304 /* current_count_sectors can be zero if transfer failed */
2305 if (error) 2305 if (error)
2306 nr_sectors = req->current_nr_sectors; 2306 nr_sectors = blk_rq_cur_sectors(req);
2307 if (__blk_end_request(req, error, nr_sectors << 9)) 2307 if (__blk_end_request(req, error, nr_sectors << 9))
2308 return; 2308 return;
2309 2309
@@ -2332,7 +2332,7 @@ static void request_done(int uptodate)
2332 if (uptodate) { 2332 if (uptodate) {
2333 /* maintain values for invalidation on geometry 2333 /* maintain values for invalidation on geometry
2334 * change */ 2334 * change */
2335 block = current_count_sectors + req->sector; 2335 block = current_count_sectors + blk_rq_pos(req);
2336 INFBOUND(DRS->maxblock, block); 2336 INFBOUND(DRS->maxblock, block);
2337 if (block > _floppy->sect) 2337 if (block > _floppy->sect)
2338 DRS->maxtrack = 1; 2338 DRS->maxtrack = 1;
@@ -2346,10 +2346,10 @@ static void request_done(int uptodate)
2346 /* record write error information */ 2346 /* record write error information */
2347 DRWE->write_errors++; 2347 DRWE->write_errors++;
2348 if (DRWE->write_errors == 1) { 2348 if (DRWE->write_errors == 1) {
2349 DRWE->first_error_sector = req->sector; 2349 DRWE->first_error_sector = blk_rq_pos(req);
2350 DRWE->first_error_generation = DRS->generation; 2350 DRWE->first_error_generation = DRS->generation;
2351 } 2351 }
2352 DRWE->last_error_sector = req->sector; 2352 DRWE->last_error_sector = blk_rq_pos(req);
2353 DRWE->last_error_generation = DRS->generation; 2353 DRWE->last_error_generation = DRS->generation;
2354 } 2354 }
2355 spin_lock_irqsave(q->queue_lock, flags); 2355 spin_lock_irqsave(q->queue_lock, flags);
@@ -2503,24 +2503,24 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
2503 2503
2504 max_sector = transfer_size(ssize, 2504 max_sector = transfer_size(ssize,
2505 min(max_sector, max_sector_2), 2505 min(max_sector, max_sector_2),
2506 current_req->nr_sectors); 2506 blk_rq_sectors(current_req));
2507 2507
2508 if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE && 2508 if (current_count_sectors <= 0 && CT(COMMAND) == FD_WRITE &&
2509 buffer_max > fsector_t + current_req->nr_sectors) 2509 buffer_max > fsector_t + blk_rq_sectors(current_req))
2510 current_count_sectors = min_t(int, buffer_max - fsector_t, 2510 current_count_sectors = min_t(int, buffer_max - fsector_t,
2511 current_req->nr_sectors); 2511 blk_rq_sectors(current_req));
2512 2512
2513 remaining = current_count_sectors << 9; 2513 remaining = current_count_sectors << 9;
2514#ifdef FLOPPY_SANITY_CHECK 2514#ifdef FLOPPY_SANITY_CHECK
2515 if ((remaining >> 9) > current_req->nr_sectors && 2515 if ((remaining >> 9) > blk_rq_sectors(current_req) &&
2516 CT(COMMAND) == FD_WRITE) { 2516 CT(COMMAND) == FD_WRITE) {
2517 DPRINT("in copy buffer\n"); 2517 DPRINT("in copy buffer\n");
2518 printk("current_count_sectors=%ld\n", current_count_sectors); 2518 printk("current_count_sectors=%ld\n", current_count_sectors);
2519 printk("remaining=%d\n", remaining >> 9); 2519 printk("remaining=%d\n", remaining >> 9);
2520 printk("current_req->nr_sectors=%ld\n", 2520 printk("current_req->nr_sectors=%u\n",
2521 current_req->nr_sectors); 2521 blk_rq_sectors(current_req));
2522 printk("current_req->current_nr_sectors=%u\n", 2522 printk("current_req->current_nr_sectors=%u\n",
2523 current_req->current_nr_sectors); 2523 blk_rq_cur_sectors(current_req));
2524 printk("max_sector=%d\n", max_sector); 2524 printk("max_sector=%d\n", max_sector);
2525 printk("ssize=%d\n", ssize); 2525 printk("ssize=%d\n", ssize);
2526 } 2526 }
@@ -2530,7 +2530,7 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2)
2530 2530
2531 dma_buffer = floppy_track_buffer + ((fsector_t - buffer_min) << 9); 2531 dma_buffer = floppy_track_buffer + ((fsector_t - buffer_min) << 9);
2532 2532
2533 size = current_req->current_nr_sectors << 9; 2533 size = blk_rq_cur_sectors(current_req) << 9;
2534 2534
2535 rq_for_each_segment(bv, current_req, iter) { 2535 rq_for_each_segment(bv, current_req, iter) {
2536 if (!remaining) 2536 if (!remaining)
@@ -2648,10 +2648,10 @@ static int make_raw_rw_request(void)
2648 2648
2649 max_sector = _floppy->sect * _floppy->head; 2649 max_sector = _floppy->sect * _floppy->head;
2650 2650
2651 TRACK = (int)current_req->sector / max_sector; 2651 TRACK = (int)blk_rq_pos(current_req) / max_sector;
2652 fsector_t = (int)current_req->sector % max_sector; 2652 fsector_t = (int)blk_rq_pos(current_req) % max_sector;
2653 if (_floppy->track && TRACK >= _floppy->track) { 2653 if (_floppy->track && TRACK >= _floppy->track) {
2654 if (current_req->current_nr_sectors & 1) { 2654 if (blk_rq_cur_sectors(current_req) & 1) {
2655 current_count_sectors = 1; 2655 current_count_sectors = 1;
2656 return 1; 2656 return 1;
2657 } else 2657 } else
@@ -2669,7 +2669,7 @@ static int make_raw_rw_request(void)
2669 if (fsector_t >= max_sector) { 2669 if (fsector_t >= max_sector) {
2670 current_count_sectors = 2670 current_count_sectors =
2671 min_t(int, _floppy->sect - fsector_t, 2671 min_t(int, _floppy->sect - fsector_t,
2672 current_req->nr_sectors); 2672 blk_rq_sectors(current_req));
2673 return 1; 2673 return 1;
2674 } 2674 }
2675 SIZECODE = 2; 2675 SIZECODE = 2;
@@ -2720,7 +2720,7 @@ static int make_raw_rw_request(void)
2720 2720
2721 in_sector_offset = (fsector_t % _floppy->sect) % ssize; 2721 in_sector_offset = (fsector_t % _floppy->sect) % ssize;
2722 aligned_sector_t = fsector_t - in_sector_offset; 2722 aligned_sector_t = fsector_t - in_sector_offset;
2723 max_size = current_req->nr_sectors; 2723 max_size = blk_rq_sectors(current_req);
2724 if ((raw_cmd->track == buffer_track) && 2724 if ((raw_cmd->track == buffer_track) &&
2725 (current_drive == buffer_drive) && 2725 (current_drive == buffer_drive) &&
2726 (fsector_t >= buffer_min) && (fsector_t < buffer_max)) { 2726 (fsector_t >= buffer_min) && (fsector_t < buffer_max)) {
@@ -2729,10 +2729,10 @@ static int make_raw_rw_request(void)
2729 copy_buffer(1, max_sector, buffer_max); 2729 copy_buffer(1, max_sector, buffer_max);
2730 return 1; 2730 return 1;
2731 } 2731 }
2732 } else if (in_sector_offset || current_req->nr_sectors < ssize) { 2732 } else if (in_sector_offset || blk_rq_sectors(current_req) < ssize) {
2733 if (CT(COMMAND) == FD_WRITE) { 2733 if (CT(COMMAND) == FD_WRITE) {
2734 if (fsector_t + current_req->nr_sectors > ssize && 2734 if (fsector_t + blk_rq_sectors(current_req) > ssize &&
2735 fsector_t + current_req->nr_sectors < ssize + ssize) 2735 fsector_t + blk_rq_sectors(current_req) < ssize + ssize)
2736 max_size = ssize + ssize; 2736 max_size = ssize + ssize;
2737 else 2737 else
2738 max_size = ssize; 2738 max_size = ssize;
@@ -2776,7 +2776,7 @@ static int make_raw_rw_request(void)
2776 (indirect * 2 > direct * 3 && 2776 (indirect * 2 > direct * 3 &&
2777 *errors < DP->max_errors.read_track && ((!probing 2777 *errors < DP->max_errors.read_track && ((!probing
2778 || (DP->read_track & (1 << DRS->probed_format)))))) { 2778 || (DP->read_track & (1 << DRS->probed_format)))))) {
2779 max_size = current_req->nr_sectors; 2779 max_size = blk_rq_sectors(current_req);
2780 } else { 2780 } else {
2781 raw_cmd->kernel_data = current_req->buffer; 2781 raw_cmd->kernel_data = current_req->buffer;
2782 raw_cmd->length = current_count_sectors << 9; 2782 raw_cmd->length = current_count_sectors << 9;
@@ -2801,7 +2801,7 @@ static int make_raw_rw_request(void)
2801 fsector_t > buffer_max || 2801 fsector_t > buffer_max ||
2802 fsector_t < buffer_min || 2802 fsector_t < buffer_min ||
2803 ((CT(COMMAND) == FD_READ || 2803 ((CT(COMMAND) == FD_READ ||
2804 (!in_sector_offset && current_req->nr_sectors >= ssize)) && 2804 (!in_sector_offset && blk_rq_sectors(current_req) >= ssize)) &&
2805 max_sector > 2 * max_buffer_sectors + buffer_min && 2805 max_sector > 2 * max_buffer_sectors + buffer_min &&
2806 max_size + fsector_t > 2 * max_buffer_sectors + buffer_min) 2806 max_size + fsector_t > 2 * max_buffer_sectors + buffer_min)
2807 /* not enough space */ 2807 /* not enough space */
@@ -2879,8 +2879,8 @@ static int make_raw_rw_request(void)
2879 printk("write\n"); 2879 printk("write\n");
2880 return 0; 2880 return 0;
2881 } 2881 }
2882 } else if (raw_cmd->length > current_req->nr_sectors << 9 || 2882 } else if (raw_cmd->length > blk_rq_sectors(current_req) << 9 ||
2883 current_count_sectors > current_req->nr_sectors) { 2883 current_count_sectors > blk_rq_sectors(current_req)) {
2884 DPRINT("buffer overrun in direct transfer\n"); 2884 DPRINT("buffer overrun in direct transfer\n");
2885 return 0; 2885 return 0;
2886 } else if (raw_cmd->length < current_count_sectors << 9) { 2886 } else if (raw_cmd->length < current_count_sectors << 9) {
@@ -2990,8 +2990,9 @@ static void do_fd_request(struct request_queue * q)
2990 if (usage_count == 0) { 2990 if (usage_count == 0) {
2991 printk("warning: usage count=0, current_req=%p exiting\n", 2991 printk("warning: usage count=0, current_req=%p exiting\n",
2992 current_req); 2992 current_req);
2993 printk("sect=%ld type=%x flags=%x\n", (long)current_req->sector, 2993 printk("sect=%ld type=%x flags=%x\n",
2994 current_req->cmd_type, current_req->cmd_flags); 2994 (long)blk_rq_pos(current_req), current_req->cmd_type,
2995 current_req->cmd_flags);
2995 return; 2996 return;
2996 } 2997 }
2997 if (test_bit(0, &fdc_busy)) { 2998 if (test_bit(0, &fdc_busy)) {
diff --git a/drivers/block/hd.c b/drivers/block/hd.c
index 75b9ca95c4eb..a3b39940ce02 100644
--- a/drivers/block/hd.c
+++ b/drivers/block/hd.c
@@ -228,7 +228,7 @@ static void dump_status(const char *msg, unsigned int stat)
228 printk(", CHS=%d/%d/%d", (inb(HD_HCYL)<<8) + inb(HD_LCYL), 228 printk(", CHS=%d/%d/%d", (inb(HD_HCYL)<<8) + inb(HD_LCYL),
229 inb(HD_CURRENT) & 0xf, inb(HD_SECTOR)); 229 inb(HD_CURRENT) & 0xf, inb(HD_SECTOR));
230 if (CURRENT) 230 if (CURRENT)
231 printk(", sector=%ld", CURRENT->sector); 231 printk(", sector=%ld", blk_rq_pos(CURRENT));
232 } 232 }
233 printk("\n"); 233 printk("\n");
234 } 234 }
@@ -457,9 +457,9 @@ ok_to_read:
457 req = CURRENT; 457 req = CURRENT;
458 insw(HD_DATA, req->buffer, 256); 458 insw(HD_DATA, req->buffer, 256);
459#ifdef DEBUG 459#ifdef DEBUG
460 printk("%s: read: sector %ld, remaining = %ld, buffer=%p\n", 460 printk("%s: read: sector %ld, remaining = %u, buffer=%p\n",
461 req->rq_disk->disk_name, req->sector + 1, req->nr_sectors - 1, 461 req->rq_disk->disk_name, blk_rq_pos(req) + 1,
462 req->buffer+512); 462 blk_rq_sectors(req) - 1, req->buffer+512);
463#endif 463#endif
464 if (__blk_end_request(req, 0, 512)) { 464 if (__blk_end_request(req, 0, 512)) {
465 SET_HANDLER(&read_intr); 465 SET_HANDLER(&read_intr);
@@ -485,7 +485,7 @@ static void write_intr(void)
485 continue; 485 continue;
486 if (!OK_STATUS(i)) 486 if (!OK_STATUS(i))
487 break; 487 break;
488 if ((req->nr_sectors <= 1) || (i & DRQ_STAT)) 488 if ((blk_rq_sectors(req) <= 1) || (i & DRQ_STAT))
489 goto ok_to_write; 489 goto ok_to_write;
490 } while (--retries > 0); 490 } while (--retries > 0);
491 dump_status("write_intr", i); 491 dump_status("write_intr", i);
@@ -589,8 +589,8 @@ repeat:
589 return; 589 return;
590 } 590 }
591 disk = req->rq_disk->private_data; 591 disk = req->rq_disk->private_data;
592 block = req->sector; 592 block = blk_rq_pos(req);
593 nsect = req->nr_sectors; 593 nsect = blk_rq_sectors(req);
594 if (block >= get_capacity(req->rq_disk) || 594 if (block >= get_capacity(req->rq_disk) ||
595 ((block+nsect) > get_capacity(req->rq_disk))) { 595 ((block+nsect) > get_capacity(req->rq_disk))) {
596 printk("%s: bad access: block=%d, count=%d\n", 596 printk("%s: bad access: block=%d, count=%d\n",
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 71e56cc28cac..826c3492b9fe 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -220,7 +220,8 @@ static void mg_dump_status(const char *msg, unsigned int stat,
220 if (host->breq) { 220 if (host->breq) {
221 req = elv_next_request(host->breq); 221 req = elv_next_request(host->breq);
222 if (req) 222 if (req)
223 printk(", sector=%u", (u32)req->sector); 223 printk(", sector=%u",
224 (unsigned int)blk_rq_pos(req));
224 } 225 }
225 226
226 } 227 }
@@ -493,12 +494,12 @@ static void mg_read(struct request *req)
493 u32 j; 494 u32 j;
494 struct mg_host *host = req->rq_disk->private_data; 495 struct mg_host *host = req->rq_disk->private_data;
495 496
496 if (mg_out(host, req->sector, req->nr_sectors, MG_CMD_RD, NULL) != 497 if (mg_out(host, blk_rq_pos(req), blk_rq_sectors(req),
497 MG_ERR_NONE) 498 MG_CMD_RD, NULL) != MG_ERR_NONE)
498 mg_bad_rw_intr(host); 499 mg_bad_rw_intr(host);
499 500
500 MG_DBG("requested %d sects (from %ld), buffer=0x%p\n", 501 MG_DBG("requested %d sects (from %ld), buffer=0x%p\n",
501 req->nr_sectors, req->sector, req->buffer); 502 blk_rq_sectors(req), blk_rq_pos(req), req->buffer);
502 503
503 do { 504 do {
504 u16 *buff = (u16 *)req->buffer; 505 u16 *buff = (u16 *)req->buffer;
@@ -522,14 +523,14 @@ static void mg_write(struct request *req)
522 u32 j; 523 u32 j;
523 struct mg_host *host = req->rq_disk->private_data; 524 struct mg_host *host = req->rq_disk->private_data;
524 525
525 if (mg_out(host, req->sector, req->nr_sectors, MG_CMD_WR, NULL) != 526 if (mg_out(host, blk_rq_pos(req), blk_rq_sectors(req),
526 MG_ERR_NONE) { 527 MG_CMD_WR, NULL) != MG_ERR_NONE) {
527 mg_bad_rw_intr(host); 528 mg_bad_rw_intr(host);
528 return; 529 return;
529 } 530 }
530 531
531 MG_DBG("requested %d sects (from %ld), buffer=0x%p\n", 532 MG_DBG("requested %d sects (from %ld), buffer=0x%p\n",
532 req->nr_sectors, req->sector, req->buffer); 533 blk_rq_sectors(req), blk_rq_pos(req), req->buffer);
533 534
534 do { 535 do {
535 u16 *buff = (u16 *)req->buffer; 536 u16 *buff = (u16 *)req->buffer;
@@ -579,7 +580,7 @@ ok_to_read:
579 (i << 1)); 580 (i << 1));
580 581
581 MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n", 582 MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n",
582 req->sector, req->nr_sectors - 1, req->buffer); 583 blk_rq_pos(req), blk_rq_sectors(req) - 1, req->buffer);
583 584
584 /* send read confirm */ 585 /* send read confirm */
585 outb(MG_CMD_RD_CONF, (unsigned long)host->dev_base + MG_REG_COMMAND); 586 outb(MG_CMD_RD_CONF, (unsigned long)host->dev_base + MG_REG_COMMAND);
@@ -609,7 +610,7 @@ static void mg_write_intr(struct mg_host *host)
609 break; 610 break;
610 if (!MG_READY_OK(i)) 611 if (!MG_READY_OK(i))
611 break; 612 break;
612 if ((req->nr_sectors <= 1) || (i & ATA_DRQ)) 613 if ((blk_rq_sectors(req) <= 1) || (i & ATA_DRQ))
613 goto ok_to_write; 614 goto ok_to_write;
614 } while (0); 615 } while (0);
615 mg_dump_status("mg_write_intr", i, host); 616 mg_dump_status("mg_write_intr", i, host);
@@ -627,7 +628,7 @@ ok_to_write:
627 buff++; 628 buff++;
628 } 629 }
629 MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n", 630 MG_DBG("sector %ld, remaining=%ld, buffer=0x%p\n",
630 req->sector, req->nr_sectors, req->buffer); 631 blk_rq_pos(req), blk_rq_sectors(req), req->buffer);
631 host->mg_do_intr = mg_write_intr; 632 host->mg_do_intr = mg_write_intr;
632 mod_timer(&host->timer, jiffies + 3 * HZ); 633 mod_timer(&host->timer, jiffies + 3 * HZ);
633 } 634 }
@@ -749,9 +750,9 @@ static void mg_request(struct request_queue *q)
749 750
750 del_timer(&host->timer); 751 del_timer(&host->timer);
751 752
752 sect_num = req->sector; 753 sect_num = blk_rq_pos(req);
753 /* deal whole segments */ 754 /* deal whole segments */
754 sect_cnt = req->nr_sectors; 755 sect_cnt = blk_rq_sectors(req);
755 756
756 /* sanity check */ 757 /* sanity check */
757 if (sect_num >= get_capacity(req->rq_disk) || 758 if (sect_num >= get_capacity(req->rq_disk) ||
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index a9ab8be9d92f..977a57377930 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -110,7 +110,7 @@ static void nbd_end_request(struct request *req)
110 req, error ? "failed" : "done"); 110 req, error ? "failed" : "done");
111 111
112 spin_lock_irqsave(q->queue_lock, flags); 112 spin_lock_irqsave(q->queue_lock, flags);
113 __blk_end_request(req, error, req->nr_sectors << 9); 113 __blk_end_request(req, error, blk_rq_sectors(req) << 9);
114 spin_unlock_irqrestore(q->queue_lock, flags); 114 spin_unlock_irqrestore(q->queue_lock, flags);
115} 115}
116 116
@@ -231,19 +231,19 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req)
231{ 231{
232 int result, flags; 232 int result, flags;
233 struct nbd_request request; 233 struct nbd_request request;
234 unsigned long size = req->nr_sectors << 9; 234 unsigned long size = blk_rq_sectors(req) << 9;
235 235
236 request.magic = htonl(NBD_REQUEST_MAGIC); 236 request.magic = htonl(NBD_REQUEST_MAGIC);
237 request.type = htonl(nbd_cmd(req)); 237 request.type = htonl(nbd_cmd(req));
238 request.from = cpu_to_be64((u64) req->sector << 9); 238 request.from = cpu_to_be64((u64)blk_rq_pos(req) << 9);
239 request.len = htonl(size); 239 request.len = htonl(size);
240 memcpy(request.handle, &req, sizeof(req)); 240 memcpy(request.handle, &req, sizeof(req));
241 241
242 dprintk(DBG_TX, "%s: request %p: sending control (%s@%llu,%luB)\n", 242 dprintk(DBG_TX, "%s: request %p: sending control (%s@%llu,%uB)\n",
243 lo->disk->disk_name, req, 243 lo->disk->disk_name, req,
244 nbdcmd_to_ascii(nbd_cmd(req)), 244 nbdcmd_to_ascii(nbd_cmd(req)),
245 (unsigned long long)req->sector << 9, 245 (unsigned long long)blk_rq_pos(req) << 9,
246 req->nr_sectors << 9); 246 blk_rq_sectors(req) << 9);
247 result = sock_xmit(lo, 1, &request, sizeof(request), 247 result = sock_xmit(lo, 1, &request, sizeof(request),
248 (nbd_cmd(req) == NBD_CMD_WRITE) ? MSG_MORE : 0); 248 (nbd_cmd(req) == NBD_CMD_WRITE) ? MSG_MORE : 0);
249 if (result <= 0) { 249 if (result <= 0) {
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 9fd57c2aa463..2d5dc0af55e4 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -728,8 +728,8 @@ static void do_pcd_request(struct request_queue * q)
728 if (cd != pcd_current) 728 if (cd != pcd_current)
729 pcd_bufblk = -1; 729 pcd_bufblk = -1;
730 pcd_current = cd; 730 pcd_current = cd;
731 pcd_sector = pcd_req->sector; 731 pcd_sector = blk_rq_pos(pcd_req);
732 pcd_count = pcd_req->current_nr_sectors; 732 pcd_count = blk_rq_cur_sectors(pcd_req);
733 pcd_buf = pcd_req->buffer; 733 pcd_buf = pcd_req->buffer;
734 pcd_busy = 1; 734 pcd_busy = 1;
735 ps_set_intr(do_pcd_read, NULL, 0, nice); 735 ps_set_intr(do_pcd_read, NULL, 0, nice);
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
index 0732df4e901a..9ec5d4ac0b64 100644
--- a/drivers/block/paride/pd.c
+++ b/drivers/block/paride/pd.c
@@ -444,11 +444,11 @@ static enum action do_pd_io_start(void)
444 444
445 pd_cmd = rq_data_dir(pd_req); 445 pd_cmd = rq_data_dir(pd_req);
446 if (pd_cmd == READ || pd_cmd == WRITE) { 446 if (pd_cmd == READ || pd_cmd == WRITE) {
447 pd_block = pd_req->sector; 447 pd_block = blk_rq_pos(pd_req);
448 pd_count = pd_req->current_nr_sectors; 448 pd_count = blk_rq_cur_sectors(pd_req);
449 if (pd_block + pd_count > get_capacity(pd_req->rq_disk)) 449 if (pd_block + pd_count > get_capacity(pd_req->rq_disk))
450 return Fail; 450 return Fail;
451 pd_run = pd_req->nr_sectors; 451 pd_run = blk_rq_sectors(pd_req);
452 pd_buf = pd_req->buffer; 452 pd_buf = pd_req->buffer;
453 pd_retries = 0; 453 pd_retries = 0;
454 if (pd_cmd == READ) 454 if (pd_cmd == READ)
@@ -479,7 +479,7 @@ static int pd_next_buf(void)
479 return 0; 479 return 0;
480 spin_lock_irqsave(&pd_lock, saved_flags); 480 spin_lock_irqsave(&pd_lock, saved_flags);
481 __blk_end_request_cur(pd_req, 0); 481 __blk_end_request_cur(pd_req, 0);
482 pd_count = pd_req->current_nr_sectors; 482 pd_count = blk_rq_cur_sectors(pd_req);
483 pd_buf = pd_req->buffer; 483 pd_buf = pd_req->buffer;
484 spin_unlock_irqrestore(&pd_lock, saved_flags); 484 spin_unlock_irqrestore(&pd_lock, saved_flags);
485 return 0; 485 return 0;
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index 3871e3586d6d..e88c889aa7f2 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -768,9 +768,9 @@ repeat:
768 return; 768 return;
769 769
770 pf_current = pf_req->rq_disk->private_data; 770 pf_current = pf_req->rq_disk->private_data;
771 pf_block = pf_req->sector; 771 pf_block = blk_rq_pos(pf_req);
772 pf_run = pf_req->nr_sectors; 772 pf_run = blk_rq_sectors(pf_req);
773 pf_count = pf_req->current_nr_sectors; 773 pf_count = blk_rq_cur_sectors(pf_req);
774 774
775 if (pf_block + pf_count > get_capacity(pf_req->rq_disk)) { 775 if (pf_block + pf_count > get_capacity(pf_req->rq_disk)) {
776 pf_end_request(-EIO); 776 pf_end_request(-EIO);
@@ -810,7 +810,7 @@ static int pf_next_buf(void)
810 spin_unlock_irqrestore(&pf_spin_lock, saved_flags); 810 spin_unlock_irqrestore(&pf_spin_lock, saved_flags);
811 if (!pf_req) 811 if (!pf_req)
812 return 1; 812 return 1;
813 pf_count = pf_req->current_nr_sectors; 813 pf_count = blk_rq_cur_sectors(pf_req);
814 pf_buf = pf_req->buffer; 814 pf_buf = pf_req->buffer;
815 } 815 }
816 return 0; 816 return 0;
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index c2388673684e..8d583081b50a 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -134,13 +134,12 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
134 rq_for_each_segment(bv, req, iter) 134 rq_for_each_segment(bv, req, iter)
135 n++; 135 n++;
136 dev_dbg(&dev->sbd.core, 136 dev_dbg(&dev->sbd.core,
137 "%s:%u: %s req has %u bvecs for %lu sectors %lu hard sectors\n", 137 "%s:%u: %s req has %u bvecs for %u sectors\n",
138 __func__, __LINE__, op, n, req->nr_sectors, 138 __func__, __LINE__, op, n, blk_rq_sectors(req));
139 blk_rq_sectors(req));
140#endif 139#endif
141 140
142 start_sector = req->sector * priv->blocking_factor; 141 start_sector = blk_rq_pos(req) * priv->blocking_factor;
143 sectors = req->nr_sectors * priv->blocking_factor; 142 sectors = blk_rq_sectors(req) * priv->blocking_factor;
144 dev_dbg(&dev->sbd.core, "%s:%u: %s %llu sectors starting at %llu\n", 143 dev_dbg(&dev->sbd.core, "%s:%u: %s %llu sectors starting at %llu\n",
145 __func__, __LINE__, op, sectors, start_sector); 144 __func__, __LINE__, op, sectors, start_sector);
146 145
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c
index f59887c5ffbd..9f351bfa15ea 100644
--- a/drivers/block/sunvdc.c
+++ b/drivers/block/sunvdc.c
@@ -416,7 +416,7 @@ static int __send_request(struct request *req)
416 desc->slice = 0; 416 desc->slice = 0;
417 } 417 }
418 desc->status = ~0; 418 desc->status = ~0;
419 desc->offset = (req->sector << 9) / port->vdisk_block_size; 419 desc->offset = (blk_rq_pos(req) << 9) / port->vdisk_block_size;
420 desc->size = len; 420 desc->size = len;
421 desc->ncookies = err; 421 desc->ncookies = err;
422 422
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 97ef4266c4c7..fc6a1c322933 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -531,7 +531,7 @@ static void redo_fd_request(struct request_queue *q)
531 while ((req = elv_next_request(q))) { 531 while ((req = elv_next_request(q))) {
532 532
533 fs = req->rq_disk->private_data; 533 fs = req->rq_disk->private_data;
534 if (req->sector < 0 || req->sector >= fs->total_secs) { 534 if (blk_rq_pos(req) >= fs->total_secs) {
535 __blk_end_request_cur(req, -EIO); 535 __blk_end_request_cur(req, -EIO);
536 continue; 536 continue;
537 } 537 }
@@ -551,8 +551,8 @@ static void redo_fd_request(struct request_queue *q)
551 __blk_end_request_cur(req, -EIO); 551 __blk_end_request_cur(req, -EIO);
552 break; 552 break;
553 case READ: 553 case READ:
554 if (floppy_read_sectors(fs, req->sector, 554 if (floppy_read_sectors(fs, blk_rq_pos(req),
555 req->current_nr_sectors, 555 blk_rq_cur_sectors(req),
556 req->buffer)) { 556 req->buffer)) {
557 __blk_end_request_cur(req, -EIO); 557 __blk_end_request_cur(req, -EIO);
558 continue; 558 continue;
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c
index 424855945b9b..c1b9a4dc11ba 100644
--- a/drivers/block/swim3.c
+++ b/drivers/block/swim3.c
@@ -312,14 +312,14 @@ static void start_request(struct floppy_state *fs)
312 } 312 }
313 while (fs->state == idle && (req = elv_next_request(swim3_queue))) { 313 while (fs->state == idle && (req = elv_next_request(swim3_queue))) {
314#if 0 314#if 0
315 printk("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%ld buf=%p\n", 315 printk("do_fd_req: dev=%s cmd=%d sec=%ld nr_sec=%u buf=%p\n",
316 req->rq_disk->disk_name, req->cmd, 316 req->rq_disk->disk_name, req->cmd,
317 (long)req->sector, req->nr_sectors, req->buffer); 317 (long)blk_rq_pos(req), blk_rq_sectors(req), req->buffer);
318 printk(" errors=%d current_nr_sectors=%ld\n", 318 printk(" errors=%d current_nr_sectors=%u\n",
319 req->errors, req->current_nr_sectors); 319 req->errors, blk_rq_cur_sectors(req));
320#endif 320#endif
321 321
322 if (req->sector >= fs->total_secs) { 322 if (blk_rq_pos(req) >= fs->total_secs) {
323 __blk_end_request_cur(req, -EIO); 323 __blk_end_request_cur(req, -EIO);
324 continue; 324 continue;
325 } 325 }
@@ -337,13 +337,14 @@ static void start_request(struct floppy_state *fs)
337 } 337 }
338 } 338 }
339 339
340 /* Do not remove the cast. req->sector is now a sector_t and 340 /* Do not remove the cast. blk_rq_pos(req) is now a
341 * can be 64 bits, but it will never go past 32 bits for this 341 * sector_t and can be 64 bits, but it will never go
342 * driver anyway, so we can safely cast it down and not have 342 * past 32 bits for this driver anyway, so we can
343 * to do a 64/32 division 343 * safely cast it down and not have to do a 64/32
344 * division
344 */ 345 */
345 fs->req_cyl = ((long)req->sector) / fs->secpercyl; 346 fs->req_cyl = ((long)blk_rq_pos(req)) / fs->secpercyl;
346 x = ((long)req->sector) % fs->secpercyl; 347 x = ((long)blk_rq_pos(req)) % fs->secpercyl;
347 fs->head = x / fs->secpertrack; 348 fs->head = x / fs->secpertrack;
348 fs->req_sector = x % fs->secpertrack + 1; 349 fs->req_sector = x % fs->secpertrack + 1;
349 fd_req = req; 350 fd_req = req;
@@ -420,7 +421,7 @@ static inline void setup_transfer(struct floppy_state *fs)
420 struct dbdma_cmd *cp = fs->dma_cmd; 421 struct dbdma_cmd *cp = fs->dma_cmd;
421 struct dbdma_regs __iomem *dr = fs->dma; 422 struct dbdma_regs __iomem *dr = fs->dma;
422 423
423 if (fd_req->current_nr_sectors <= 0) { 424 if (blk_rq_cur_sectors(fd_req) <= 0) {
424 printk(KERN_ERR "swim3: transfer 0 sectors?\n"); 425 printk(KERN_ERR "swim3: transfer 0 sectors?\n");
425 return; 426 return;
426 } 427 }
@@ -428,8 +429,8 @@ static inline void setup_transfer(struct floppy_state *fs)
428 n = 1; 429 n = 1;
429 else { 430 else {
430 n = fs->secpertrack - fs->req_sector + 1; 431 n = fs->secpertrack - fs->req_sector + 1;
431 if (n > fd_req->current_nr_sectors) 432 if (n > blk_rq_cur_sectors(fd_req))
432 n = fd_req->current_nr_sectors; 433 n = blk_rq_cur_sectors(fd_req);
433 } 434 }
434 fs->scount = n; 435 fs->scount = n;
435 swim3_select(fs, fs->head? READ_DATA_1: READ_DATA_0); 436 swim3_select(fs, fs->head? READ_DATA_1: READ_DATA_0);
@@ -600,7 +601,8 @@ static void xfer_timeout(unsigned long data)
600 out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION); 601 out_8(&sw->control_bic, WRITE_SECTORS | DO_ACTION);
601 out_8(&sw->select, RELAX); 602 out_8(&sw->select, RELAX);
602 printk(KERN_ERR "swim3: timeout %sing sector %ld\n", 603 printk(KERN_ERR "swim3: timeout %sing sector %ld\n",
603 (rq_data_dir(fd_req)==WRITE? "writ": "read"), (long)fd_req->sector); 604 (rq_data_dir(fd_req)==WRITE? "writ": "read"),
605 (long)blk_rq_pos(fd_req));
604 __blk_end_request_cur(fd_req, -EIO); 606 __blk_end_request_cur(fd_req, -EIO);
605 fs->state = idle; 607 fs->state = idle;
606 start_request(fs); 608 start_request(fs);
@@ -714,7 +716,7 @@ static irqreturn_t swim3_interrupt(int irq, void *dev_id)
714 } else { 716 } else {
715 printk("swim3: error %sing block %ld (err=%x)\n", 717 printk("swim3: error %sing block %ld (err=%x)\n",
716 rq_data_dir(fd_req) == WRITE? "writ": "read", 718 rq_data_dir(fd_req) == WRITE? "writ": "read",
717 (long)fd_req->sector, err); 719 (long)blk_rq_pos(fd_req), err);
718 __blk_end_request_cur(fd_req, -EIO); 720 __blk_end_request_cur(fd_req, -EIO);
719 fs->state = idle; 721 fs->state = idle;
720 } 722 }
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 60e85bb6f790..087c94c8b2da 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -903,10 +903,10 @@ queue_one_request:
903 msg->sg_count = n_elem; 903 msg->sg_count = n_elem;
904 msg->sg_type = SGT_32BIT; 904 msg->sg_type = SGT_32BIT;
905 msg->handle = cpu_to_le32(TAG_ENCODE(crq->tag)); 905 msg->handle = cpu_to_le32(TAG_ENCODE(crq->tag));
906 msg->lba = cpu_to_le32(rq->sector & 0xffffffff); 906 msg->lba = cpu_to_le32(blk_rq_pos(rq) & 0xffffffff);
907 tmp = (rq->sector >> 16) >> 16; 907 tmp = (blk_rq_pos(rq) >> 16) >> 16;
908 msg->lba_high = cpu_to_le16( (u16) tmp ); 908 msg->lba_high = cpu_to_le16( (u16) tmp );
909 msg->lba_count = cpu_to_le16(rq->nr_sectors); 909 msg->lba_count = cpu_to_le16(blk_rq_sectors(rq));
910 910
911 msg_size = sizeof(struct carm_msg_rw) - sizeof(msg->sg); 911 msg_size = sizeof(struct carm_msg_rw) - sizeof(msg->sg);
912 for (i = 0; i < n_elem; i++) { 912 for (i = 0; i < n_elem; i++) {
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 8c2cc71327e3..dc3b899ad2b3 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -726,8 +726,8 @@ static void ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun,
726 * The call to blk_queue_hardsect_size() guarantees that request 726 * The call to blk_queue_hardsect_size() guarantees that request
727 * is aligned, but it is given in terms of 512 byte units, always. 727 * is aligned, but it is given in terms of 512 byte units, always.
728 */ 728 */
729 block = rq->sector >> lun->capacity.bshift; 729 block = blk_rq_pos(rq) >> lun->capacity.bshift;
730 nblks = rq->nr_sectors >> lun->capacity.bshift; 730 nblks = blk_rq_sectors(rq) >> lun->capacity.bshift;
731 731
732 cmd->cdb[0] = (cmd->dir == UB_DIR_READ)? READ_10: WRITE_10; 732 cmd->cdb[0] = (cmd->dir == UB_DIR_READ)? READ_10: WRITE_10;
733 /* 10-byte uses 4 bytes of LBA: 2147483648KB, 2097152MB, 2048GB */ 733 /* 10-byte uses 4 bytes of LBA: 2147483648KB, 2097152MB, 2048GB */
@@ -739,7 +739,7 @@ static void ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun,
739 cmd->cdb[8] = nblks; 739 cmd->cdb[8] = nblks;
740 cmd->cdb_len = 10; 740 cmd->cdb_len = 10;
741 741
742 cmd->len = rq->nr_sectors * 512; 742 cmd->len = blk_rq_sectors(rq) * 512;
743} 743}
744 744
745static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun, 745static void ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun,
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c
index e821eed7132f..2086cb12d3ec 100644
--- a/drivers/block/viodasd.c
+++ b/drivers/block/viodasd.c
@@ -252,7 +252,7 @@ static int send_request(struct request *req)
252 struct viodasd_device *d; 252 struct viodasd_device *d;
253 unsigned long flags; 253 unsigned long flags;
254 254
255 start = (u64)req->sector << 9; 255 start = (u64)blk_rq_pos(req) << 9;
256 256
257 if (rq_data_dir(req) == READ) { 257 if (rq_data_dir(req) == READ) {
258 direction = DMA_FROM_DEVICE; 258 direction = DMA_FROM_DEVICE;
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 50745e64414e..1980ab456356 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -85,7 +85,7 @@ static bool do_req(struct request_queue *q, struct virtio_blk *vblk,
85 vbr->req = req; 85 vbr->req = req;
86 if (blk_fs_request(vbr->req)) { 86 if (blk_fs_request(vbr->req)) {
87 vbr->out_hdr.type = 0; 87 vbr->out_hdr.type = 0;
88 vbr->out_hdr.sector = vbr->req->sector; 88 vbr->out_hdr.sector = blk_rq_pos(vbr->req);
89 vbr->out_hdr.ioprio = req_get_ioprio(vbr->req); 89 vbr->out_hdr.ioprio = req_get_ioprio(vbr->req);
90 } else if (blk_pc_request(vbr->req)) { 90 } else if (blk_pc_request(vbr->req)) {
91 vbr->out_hdr.type = VIRTIO_BLK_T_SCSI_CMD; 91 vbr->out_hdr.type = VIRTIO_BLK_T_SCSI_CMD;
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index 14be4c1ed1aa..4ef88018bcde 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -306,8 +306,8 @@ static void do_xd_request (struct request_queue * q)
306 return; 306 return;
307 307
308 while ((req = elv_next_request(q)) != NULL) { 308 while ((req = elv_next_request(q)) != NULL) {
309 unsigned block = req->sector; 309 unsigned block = blk_rq_pos(req);
310 unsigned count = req->nr_sectors; 310 unsigned count = blk_rq_sectors(req);
311 XD_INFO *disk = req->rq_disk->private_data; 311 XD_INFO *disk = req->rq_disk->private_data;
312 int res = 0; 312 int res = 0;
313 int retry; 313 int retry;
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index b4564479f641..91fc56597e9b 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -231,7 +231,7 @@ static int blkif_queue_request(struct request *req)
231 info->shadow[id].request = (unsigned long)req; 231 info->shadow[id].request = (unsigned long)req;
232 232
233 ring_req->id = id; 233 ring_req->id = id;
234 ring_req->sector_number = (blkif_sector_t)req->sector; 234 ring_req->sector_number = (blkif_sector_t)blk_rq_pos(req);
235 ring_req->handle = info->handle; 235 ring_req->handle = info->handle;
236 236
237 ring_req->operation = rq_data_dir(req) ? 237 ring_req->operation = rq_data_dir(req) ?
@@ -310,11 +310,10 @@ static void do_blkif_request(struct request_queue *rq)
310 goto wait; 310 goto wait;
311 311
312 pr_debug("do_blk_req %p: cmd %p, sec %lx, " 312 pr_debug("do_blk_req %p: cmd %p, sec %lx, "
313 "(%u/%li) buffer:%p [%s]\n", 313 "(%u/%u) buffer:%p [%s]\n",
314 req, req->cmd, (unsigned long)req->sector, 314 req, req->cmd, (unsigned long)blk_rq_pos(req),
315 req->current_nr_sectors, 315 blk_rq_cur_sectors(req), blk_rq_sectors(req),
316 req->nr_sectors, req->buffer, 316 req->buffer, rq_data_dir(req) ? "write" : "read");
317 rq_data_dir(req) ? "write" : "read");
318 317
319 318
320 blkdev_dequeue_request(req); 319 blkdev_dequeue_request(req);
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 5722931d14c5..97c99b43f881 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -646,13 +646,14 @@ static void ace_fsm_dostate(struct ace_device *ace)
646 /* Okay, it's a data request, set it up for transfer */ 646 /* Okay, it's a data request, set it up for transfer */
647 dev_dbg(ace->dev, 647 dev_dbg(ace->dev,
648 "request: sec=%llx hcnt=%x, ccnt=%x, dir=%i\n", 648 "request: sec=%llx hcnt=%x, ccnt=%x, dir=%i\n",
649 (unsigned long long) req->sector, blk_rq_sectors(req), 649 (unsigned long long)blk_rq_pos(req),
650 req->current_nr_sectors, rq_data_dir(req)); 650 blk_rq_sectors(req), blk_rq_cur_sectors(req),
651 rq_data_dir(req));
651 652
652 ace->req = req; 653 ace->req = req;
653 ace->data_ptr = req->buffer; 654 ace->data_ptr = req->buffer;
654 ace->data_count = req->current_nr_sectors * ACE_BUF_PER_SECTOR; 655 ace->data_count = blk_rq_cur_sectors(req) * ACE_BUF_PER_SECTOR;
655 ace_out32(ace, ACE_MPULBA, req->sector & 0x0FFFFFFF); 656 ace_out32(ace, ACE_MPULBA, blk_rq_pos(req) & 0x0FFFFFFF);
656 657
657 count = blk_rq_sectors(req); 658 count = blk_rq_sectors(req);
658 if (rq_data_dir(req)) { 659 if (rq_data_dir(req)) {
@@ -688,7 +689,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
688 dev_dbg(ace->dev, 689 dev_dbg(ace->dev,
689 "CFBSY set; t=%i iter=%i c=%i dc=%i irq=%i\n", 690 "CFBSY set; t=%i iter=%i c=%i dc=%i irq=%i\n",
690 ace->fsm_task, ace->fsm_iter_num, 691 ace->fsm_task, ace->fsm_iter_num,
691 ace->req->current_nr_sectors * 16, 692 blk_rq_cur_sectors(ace->req) * 16,
692 ace->data_count, ace->in_irq); 693 ace->data_count, ace->in_irq);
693 ace_fsm_yield(ace); /* need to poll CFBSY bit */ 694 ace_fsm_yield(ace); /* need to poll CFBSY bit */
694 break; 695 break;
@@ -697,7 +698,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
697 dev_dbg(ace->dev, 698 dev_dbg(ace->dev,
698 "DATABUF not set; t=%i iter=%i c=%i dc=%i irq=%i\n", 699 "DATABUF not set; t=%i iter=%i c=%i dc=%i irq=%i\n",
699 ace->fsm_task, ace->fsm_iter_num, 700 ace->fsm_task, ace->fsm_iter_num,
700 ace->req->current_nr_sectors * 16, 701 blk_rq_cur_sectors(ace->req) * 16,
701 ace->data_count, ace->in_irq); 702 ace->data_count, ace->in_irq);
702 ace_fsm_yieldirq(ace); 703 ace_fsm_yieldirq(ace);
703 break; 704 break;
@@ -721,10 +722,10 @@ static void ace_fsm_dostate(struct ace_device *ace)
721 blk_rq_cur_bytes(ace->req))) { 722 blk_rq_cur_bytes(ace->req))) {
722 /* dev_dbg(ace->dev, "next block; h=%u c=%u\n", 723 /* dev_dbg(ace->dev, "next block; h=%u c=%u\n",
723 * blk_rq_sectors(ace->req), 724 * blk_rq_sectors(ace->req),
724 * ace->req->current_nr_sectors); 725 * blk_rq_cur_sectors(ace->req));
725 */ 726 */
726 ace->data_ptr = ace->req->buffer; 727 ace->data_ptr = ace->req->buffer;
727 ace->data_count = ace->req->current_nr_sectors * 16; 728 ace->data_count = blk_rq_cur_sectors(ace->req) * 16;
728 ace_fsm_yieldirq(ace); 729 ace_fsm_yieldirq(ace);
729 break; 730 break;
730 } 731 }
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c
index b66ad58a3c38..d4e6b71f514a 100644
--- a/drivers/block/z2ram.c
+++ b/drivers/block/z2ram.c
@@ -71,12 +71,12 @@ static void do_z2_request(struct request_queue *q)
71{ 71{
72 struct request *req; 72 struct request *req;
73 while ((req = elv_next_request(q)) != NULL) { 73 while ((req = elv_next_request(q)) != NULL) {
74 unsigned long start = req->sector << 9; 74 unsigned long start = blk_rq_pos(req) << 9;
75 unsigned long len = req->current_nr_sectors << 9; 75 unsigned long len = blk_rq_cur_sectors(req) << 9;
76 76
77 if (start + len > z2ram_size) { 77 if (start + len > z2ram_size) {
78 printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n", 78 printk( KERN_ERR DEVICE_NAME ": bad access: block=%lu, count=%u\n",
79 req->sector, req->current_nr_sectors); 79 blk_rq_pos(req), blk_rq_cur_sectors(req));
80 __blk_end_request_cur(req, -EIO); 80 __blk_end_request_cur(req, -EIO);
81 continue; 81 continue;
82 } 82 }