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/scsi | |
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/scsi')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 3d16c70fbde0..ee308f6f7982 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 = blk_rq_sectors(req) << 9; | 549 | int leftover = blk_rq_bytes(req); |
550 | 550 | ||
551 | if (blk_pc_request(req)) | 551 | if (blk_pc_request(req)) |
552 | leftover = req->resid_len; | 552 | leftover = req->resid_len; |
@@ -964,10 +964,7 @@ static int scsi_init_sgtable(struct request *req, struct scsi_data_buffer *sdb, | |||
964 | count = blk_rq_map_sg(req->q, req, sdb->table.sgl); | 964 | count = blk_rq_map_sg(req->q, req, sdb->table.sgl); |
965 | BUG_ON(count > sdb->table.nents); | 965 | BUG_ON(count > sdb->table.nents); |
966 | sdb->table.nents = count; | 966 | sdb->table.nents = count; |
967 | if (blk_pc_request(req)) | 967 | sdb->length = blk_rq_bytes(req); |
968 | sdb->length = blk_rq_bytes(req); | ||
969 | else | ||
970 | sdb->length = blk_rq_sectors(req) << 9; | ||
971 | return BLKPREP_OK; | 968 | return BLKPREP_OK; |
972 | } | 969 | } |
973 | 970 | ||