diff options
author | Tejun Heo <tj@kernel.org> | 2009-05-07 09:24:45 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-05-11 03:50:55 -0400 |
commit | 1011c1b9f2e45ce7c6e38888d2b83936aec38771 (patch) | |
tree | 63f1f8f604631f37df9917a941531de0148f8379 /drivers/block/floppy.c | |
parent | a2dec7b36364a5cc564c4d76cf16d2e7d33f5c05 (diff) |
block: blk_rq_[cur_]_{sectors|bytes}() usage cleanup
With the previous changes, the followings are now guaranteed for all
requests in any valid state.
* blk_rq_sectors() == blk_rq_bytes() >> 9
* blk_rq_cur_sectors() == blk_rq_cur_bytes() >> 9
Clean up accessor usages. Notable changes are
* nbd,i2o_block: end_all used instead of explicit byte count
* scsi_lib: unnecessary conditional on request type removed
[ Impact: cleanup ]
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Paul Clements <paul.clements@steeleye.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block/floppy.c')
-rw-r--r-- | drivers/block/floppy.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 452486283386..1e27ed9208b4 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -2512,8 +2512,7 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) | |||
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) > blk_rq_sectors(current_req) && | 2515 | if (remaining > blk_rq_bytes(current_req) && CT(COMMAND) == FD_WRITE) { |
2516 | CT(COMMAND) == FD_WRITE) { | ||
2517 | DPRINT("in copy buffer\n"); | 2516 | DPRINT("in copy buffer\n"); |
2518 | printk("current_count_sectors=%ld\n", current_count_sectors); | 2517 | printk("current_count_sectors=%ld\n", current_count_sectors); |
2519 | printk("remaining=%d\n", remaining >> 9); | 2518 | printk("remaining=%d\n", remaining >> 9); |
@@ -2530,7 +2529,7 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) | |||
2530 | 2529 | ||
2531 | dma_buffer = floppy_track_buffer + ((fsector_t - buffer_min) << 9); | 2530 | dma_buffer = floppy_track_buffer + ((fsector_t - buffer_min) << 9); |
2532 | 2531 | ||
2533 | size = blk_rq_cur_sectors(current_req) << 9; | 2532 | size = blk_rq_cur_bytes(current_req); |
2534 | 2533 | ||
2535 | rq_for_each_segment(bv, current_req, iter) { | 2534 | rq_for_each_segment(bv, current_req, iter) { |
2536 | if (!remaining) | 2535 | if (!remaining) |
@@ -2879,7 +2878,7 @@ static int make_raw_rw_request(void) | |||
2879 | printk("write\n"); | 2878 | printk("write\n"); |
2880 | return 0; | 2879 | return 0; |
2881 | } | 2880 | } |
2882 | } else if (raw_cmd->length > blk_rq_sectors(current_req) << 9 || | 2881 | } else if (raw_cmd->length > blk_rq_bytes(current_req) || |
2883 | current_count_sectors > blk_rq_sectors(current_req)) { | 2882 | current_count_sectors > blk_rq_sectors(current_req)) { |
2884 | DPRINT("buffer overrun in direct transfer\n"); | 2883 | DPRINT("buffer overrun in direct transfer\n"); |
2885 | return 0; | 2884 | return 0; |