diff options
-rw-r--r-- | block/blk-barrier.c | 2 | ||||
-rw-r--r-- | block/blk-core.c | 2 | ||||
-rw-r--r-- | block/cfq-iosched.c | 2 | ||||
-rw-r--r-- | drivers/block/ps3disk.c | 2 | ||||
-rw-r--r-- | drivers/block/viodasd.c | 6 | ||||
-rw-r--r-- | drivers/block/xsysace.c | 10 | ||||
-rw-r--r-- | drivers/ide/ide-cd.c | 8 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 4 | ||||
-rw-r--r-- | drivers/message/i2o/i2o_block.c | 2 | ||||
-rw-r--r-- | drivers/scsi/scsi_lib.c | 2 | ||||
-rw-r--r-- | include/linux/blkdev.h | 23 | ||||
-rw-r--r-- | kernel/trace/blktrace.c | 4 |
12 files changed, 42 insertions, 25 deletions
diff --git a/block/blk-barrier.c b/block/blk-barrier.c index c8d087655eff..c167de5b9eff 100644 --- a/block/blk-barrier.c +++ b/block/blk-barrier.c | |||
@@ -163,7 +163,7 @@ static inline bool start_ordered(struct request_queue *q, struct request **rqp) | |||
163 | * For an empty barrier, there's no actual BAR request, which | 163 | * For an empty barrier, there's no actual BAR request, which |
164 | * in turn makes POSTFLUSH unnecessary. Mask them off. | 164 | * in turn makes POSTFLUSH unnecessary. Mask them off. |
165 | */ | 165 | */ |
166 | if (!rq->hard_nr_sectors) { | 166 | if (!blk_rq_sectors(rq)) { |
167 | q->ordered &= ~(QUEUE_ORDERED_DO_BAR | | 167 | q->ordered &= ~(QUEUE_ORDERED_DO_BAR | |
168 | QUEUE_ORDERED_DO_POSTFLUSH); | 168 | QUEUE_ORDERED_DO_POSTFLUSH); |
169 | /* | 169 | /* |
diff --git a/block/blk-core.c b/block/blk-core.c index 394c5bd81271..895e55b74a40 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1683,7 +1683,7 @@ static void blk_account_io_done(struct request *req) | |||
1683 | unsigned int blk_rq_bytes(struct request *rq) | 1683 | unsigned int blk_rq_bytes(struct request *rq) |
1684 | { | 1684 | { |
1685 | if (blk_fs_request(rq)) | 1685 | if (blk_fs_request(rq)) |
1686 | return rq->hard_nr_sectors << 9; | 1686 | return blk_rq_sectors(rq) << 9; |
1687 | 1687 | ||
1688 | return rq->data_len; | 1688 | return rq->data_len; |
1689 | } | 1689 | } |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index def0c698a4bc..575083a9ffe4 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -760,7 +760,7 @@ static void cfq_activate_request(struct request_queue *q, struct request *rq) | |||
760 | cfq_log_cfqq(cfqd, RQ_CFQQ(rq), "activate rq, drv=%d", | 760 | cfq_log_cfqq(cfqd, RQ_CFQQ(rq), "activate rq, drv=%d", |
761 | cfqd->rq_in_driver); | 761 | cfqd->rq_in_driver); |
762 | 762 | ||
763 | cfqd->last_position = rq->hard_sector + rq->hard_nr_sectors; | 763 | cfqd->last_position = blk_rq_pos(rq) + blk_rq_sectors(rq); |
764 | } | 764 | } |
765 | 765 | ||
766 | static void cfq_deactivate_request(struct request_queue *q, struct request *rq) | 766 | static void cfq_deactivate_request(struct request_queue *q, struct request *rq) |
diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c index f6586e4d351c..c2388673684e 100644 --- a/drivers/block/ps3disk.c +++ b/drivers/block/ps3disk.c | |||
@@ -136,7 +136,7 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev, | |||
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 %lu sectors %lu hard sectors\n", |
138 | __func__, __LINE__, op, n, req->nr_sectors, | 138 | __func__, __LINE__, op, n, req->nr_sectors, |
139 | req->hard_nr_sectors); | 139 | blk_rq_sectors(req)); |
140 | #endif | 140 | #endif |
141 | 141 | ||
142 | start_sector = req->sector * priv->blocking_factor; | 142 | start_sector = req->sector * priv->blocking_factor; |
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index ecccf65dce2f..e821eed7132f 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -368,12 +368,12 @@ static void do_viodasd_request(struct request_queue *q) | |||
368 | blkdev_dequeue_request(req); | 368 | blkdev_dequeue_request(req); |
369 | /* check that request contains a valid command */ | 369 | /* check that request contains a valid command */ |
370 | if (!blk_fs_request(req)) { | 370 | if (!blk_fs_request(req)) { |
371 | viodasd_end_request(req, -EIO, req->hard_nr_sectors); | 371 | viodasd_end_request(req, -EIO, blk_rq_sectors(req)); |
372 | continue; | 372 | continue; |
373 | } | 373 | } |
374 | /* Try sending the request */ | 374 | /* Try sending the request */ |
375 | if (send_request(req) != 0) | 375 | if (send_request(req) != 0) |
376 | viodasd_end_request(req, -EIO, req->hard_nr_sectors); | 376 | viodasd_end_request(req, -EIO, blk_rq_sectors(req)); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | 379 | ||
@@ -590,7 +590,7 @@ static int viodasd_handle_read_write(struct vioblocklpevent *bevent) | |||
590 | err = vio_lookup_rc(viodasd_err_table, bevent->sub_result); | 590 | err = vio_lookup_rc(viodasd_err_table, bevent->sub_result); |
591 | printk(VIOD_KERN_WARNING "read/write error %d:0x%04x (%s)\n", | 591 | printk(VIOD_KERN_WARNING "read/write error %d:0x%04x (%s)\n", |
592 | event->xRc, bevent->sub_result, err->msg); | 592 | event->xRc, bevent->sub_result, err->msg); |
593 | num_sect = req->hard_nr_sectors; | 593 | num_sect = blk_rq_sectors(req); |
594 | } | 594 | } |
595 | qlock = req->q->queue_lock; | 595 | qlock = req->q->queue_lock; |
596 | spin_lock_irqsave(qlock, irq_flags); | 596 | spin_lock_irqsave(qlock, irq_flags); |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index b1e1d7e5ab1e..5722931d14c5 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -645,8 +645,8 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
645 | 645 | ||
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=%lx, ccnt=%x, dir=%i\n", | 648 | "request: sec=%llx hcnt=%x, ccnt=%x, dir=%i\n", |
649 | (unsigned long long) req->sector, req->hard_nr_sectors, | 649 | (unsigned long long) req->sector, blk_rq_sectors(req), |
650 | req->current_nr_sectors, rq_data_dir(req)); | 650 | req->current_nr_sectors, rq_data_dir(req)); |
651 | 651 | ||
652 | ace->req = req; | 652 | ace->req = req; |
@@ -654,7 +654,7 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
654 | ace->data_count = req->current_nr_sectors * ACE_BUF_PER_SECTOR; | 654 | ace->data_count = req->current_nr_sectors * ACE_BUF_PER_SECTOR; |
655 | ace_out32(ace, ACE_MPULBA, req->sector & 0x0FFFFFFF); | 655 | ace_out32(ace, ACE_MPULBA, req->sector & 0x0FFFFFFF); |
656 | 656 | ||
657 | count = req->hard_nr_sectors; | 657 | count = blk_rq_sectors(req); |
658 | if (rq_data_dir(req)) { | 658 | if (rq_data_dir(req)) { |
659 | /* Kick off write request */ | 659 | /* Kick off write request */ |
660 | dev_dbg(ace->dev, "write data\n"); | 660 | dev_dbg(ace->dev, "write data\n"); |
@@ -719,8 +719,8 @@ static void ace_fsm_dostate(struct ace_device *ace) | |||
719 | /* bio finished; is there another one? */ | 719 | /* bio finished; is there another one? */ |
720 | if (__blk_end_request(ace->req, 0, | 720 | if (__blk_end_request(ace->req, 0, |
721 | blk_rq_cur_bytes(ace->req))) { | 721 | blk_rq_cur_bytes(ace->req))) { |
722 | /* dev_dbg(ace->dev, "next block; h=%li c=%i\n", | 722 | /* dev_dbg(ace->dev, "next block; h=%u c=%u\n", |
723 | * ace->req->hard_nr_sectors, | 723 | * blk_rq_sectors(ace->req), |
724 | * ace->req->current_nr_sectors); | 724 | * ace->req->current_nr_sectors); |
725 | */ | 725 | */ |
726 | ace->data_ptr = ace->req->buffer; | 726 | ace->data_ptr = ace->req->buffer; |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 8bbe222c5e42..182320dd6ea1 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -730,7 +730,7 @@ out_end: | |||
730 | if (blk_pc_request(rq)) | 730 | if (blk_pc_request(rq)) |
731 | nsectors = (rq->data_len + 511) >> 9; | 731 | nsectors = (rq->data_len + 511) >> 9; |
732 | else | 732 | else |
733 | nsectors = rq->hard_nr_sectors; | 733 | nsectors = blk_rq_sectors(rq); |
734 | 734 | ||
735 | if (nsectors == 0) | 735 | if (nsectors == 0) |
736 | nsectors = 1; | 736 | nsectors = 1; |
@@ -875,7 +875,7 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq, | |||
875 | 875 | ||
876 | return ide_issue_pc(drive, &cmd); | 876 | return ide_issue_pc(drive, &cmd); |
877 | out_end: | 877 | out_end: |
878 | nsectors = rq->hard_nr_sectors; | 878 | nsectors = blk_rq_sectors(rq); |
879 | 879 | ||
880 | if (nsectors == 0) | 880 | if (nsectors == 0) |
881 | nsectors = 1; | 881 | nsectors = 1; |
@@ -1359,8 +1359,8 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive) | |||
1359 | static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq) | 1359 | static int ide_cdrom_prep_fs(struct request_queue *q, struct request *rq) |
1360 | { | 1360 | { |
1361 | int hard_sect = queue_hardsect_size(q); | 1361 | int hard_sect = queue_hardsect_size(q); |
1362 | long block = (long)rq->hard_sector / (hard_sect >> 9); | 1362 | long block = (long)blk_rq_pos(rq) / (hard_sect >> 9); |
1363 | unsigned long blocks = rq->hard_nr_sectors / (hard_sect >> 9); | 1363 | unsigned long blocks = blk_rq_sectors(rq) / (hard_sect >> 9); |
1364 | 1364 | ||
1365 | memset(rq->cmd, 0, BLK_MAX_CDB); | 1365 | memset(rq->cmd, 0, BLK_MAX_CDB); |
1366 | 1366 | ||
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index a0309ea661ac..df23bcbd94b4 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -118,7 +118,7 @@ unsigned int ide_rq_bytes(struct request *rq) | |||
118 | if (blk_pc_request(rq)) | 118 | if (blk_pc_request(rq)) |
119 | return rq->data_len; | 119 | return rq->data_len; |
120 | else | 120 | else |
121 | return rq->hard_cur_sectors << 9; | 121 | return blk_rq_cur_sectors(rq) << 9; |
122 | } | 122 | } |
123 | EXPORT_SYMBOL_GPL(ide_rq_bytes); | 123 | EXPORT_SYMBOL_GPL(ide_rq_bytes); |
124 | 124 | ||
@@ -133,7 +133,7 @@ int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes) | |||
133 | * and complete the whole request right now | 133 | * and complete the whole request right now |
134 | */ | 134 | */ |
135 | if (blk_noretry_request(rq) && error <= 0) | 135 | if (blk_noretry_request(rq) && error <= 0) |
136 | nr_bytes = rq->hard_nr_sectors << 9; | 136 | nr_bytes = blk_rq_sectors(rq) << 9; |
137 | 137 | ||
138 | rc = ide_end_rq(drive, rq, error, nr_bytes); | 138 | rc = ide_end_rq(drive, rq, error, nr_bytes); |
139 | if (rc == 0) | 139 | if (rc == 0) |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index 221317e6a006..56e60f0d5312 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -427,7 +427,7 @@ static void i2o_block_end_request(struct request *req, int error, | |||
427 | unsigned long flags; | 427 | unsigned long flags; |
428 | 428 | ||
429 | if (blk_end_request(req, error, nr_bytes)) { | 429 | if (blk_end_request(req, error, nr_bytes)) { |
430 | int leftover = (req->hard_nr_sectors << KERNEL_SECTOR_SHIFT); | 430 | int leftover = (blk_rq_sectors(req) << KERNEL_SECTOR_SHIFT); |
431 | 431 | ||
432 | if (blk_pc_request(req)) | 432 | if (blk_pc_request(req)) |
433 | leftover = req->data_len; | 433 | leftover = req->data_len; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 7d49ef589f33..9ff0ca9988a9 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -546,7 +546,7 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error, | |||
546 | * to queue the remainder of them. | 546 | * to queue the remainder of them. |
547 | */ | 547 | */ |
548 | if (blk_end_request(req, error, bytes)) { | 548 | if (blk_end_request(req, error, bytes)) { |
549 | int leftover = (req->hard_nr_sectors << 9); | 549 | int leftover = blk_rq_sectors(req) << 9; |
550 | 550 | ||
551 | if (blk_pc_request(req)) | 551 | if (blk_pc_request(req)) |
552 | leftover = req->resid_len; | 552 | leftover = req->resid_len; |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 6a967cad89fa..4e5f85598728 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -832,13 +832,30 @@ static inline void blk_run_address_space(struct address_space *mapping) | |||
832 | extern void blkdev_dequeue_request(struct request *req); | 832 | extern void blkdev_dequeue_request(struct request *req); |
833 | 833 | ||
834 | /* | 834 | /* |
835 | * blk_end_request() takes bytes instead of sectors as a complete size. | 835 | * blk_rq_pos() : the current sector |
836 | * blk_rq_bytes() returns bytes left to complete in the entire request. | 836 | * blk_rq_bytes() : bytes left in the entire request |
837 | * blk_rq_cur_bytes() returns bytes left to complete in the current segment. | 837 | * blk_rq_cur_bytes() : bytes left in the current segment |
838 | * blk_rq_sectors() : sectors left in the entire request | ||
839 | * blk_rq_cur_sectors() : sectors left in the current segment | ||
838 | */ | 840 | */ |
841 | static inline sector_t blk_rq_pos(const struct request *rq) | ||
842 | { | ||
843 | return rq->hard_sector; | ||
844 | } | ||
845 | |||
839 | extern unsigned int blk_rq_bytes(struct request *rq); | 846 | extern unsigned int blk_rq_bytes(struct request *rq); |
840 | extern unsigned int blk_rq_cur_bytes(struct request *rq); | 847 | extern unsigned int blk_rq_cur_bytes(struct request *rq); |
841 | 848 | ||
849 | static inline unsigned int blk_rq_sectors(const struct request *rq) | ||
850 | { | ||
851 | return rq->hard_nr_sectors; | ||
852 | } | ||
853 | |||
854 | static inline unsigned int blk_rq_cur_sectors(const struct request *rq) | ||
855 | { | ||
856 | return rq->hard_cur_sectors; | ||
857 | } | ||
858 | |||
842 | /* | 859 | /* |
843 | * Request completion related functions. | 860 | * Request completion related functions. |
844 | * | 861 | * |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 921ef5d1f0ba..42f1c11e754c 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -646,7 +646,7 @@ static void blk_add_trace_rq(struct request_queue *q, struct request *rq, | |||
646 | rq->cmd_len, rq->cmd); | 646 | rq->cmd_len, rq->cmd); |
647 | } else { | 647 | } else { |
648 | what |= BLK_TC_ACT(BLK_TC_FS); | 648 | what |= BLK_TC_ACT(BLK_TC_FS); |
649 | __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, | 649 | __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_sectors(rq) << 9, |
650 | rw, what, rq->errors, 0, NULL); | 650 | rw, what, rq->errors, 0, NULL); |
651 | } | 651 | } |
652 | } | 652 | } |
@@ -857,7 +857,7 @@ void blk_add_driver_data(struct request_queue *q, | |||
857 | __blk_add_trace(bt, 0, rq->data_len, 0, BLK_TA_DRV_DATA, | 857 | __blk_add_trace(bt, 0, rq->data_len, 0, BLK_TA_DRV_DATA, |
858 | rq->errors, len, data); | 858 | rq->errors, len, data); |
859 | else | 859 | else |
860 | __blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, | 860 | __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_sectors(rq) << 9, |
861 | 0, BLK_TA_DRV_DATA, rq->errors, len, data); | 861 | 0, BLK_TA_DRV_DATA, rq->errors, len, data); |
862 | } | 862 | } |
863 | EXPORT_SYMBOL_GPL(blk_add_driver_data); | 863 | EXPORT_SYMBOL_GPL(blk_add_driver_data); |