Commit 34b7d2c957199834c474c9d46739265643f4d9c7
Committed by
Jens Axboe
1 parent
b079041030
Exists in
master
and in
7 other branches
ide: cleanup rq->data_len usages
With recent unification of fields, it's now guaranteed that rq->data_len always equals blk_rq_bytes(). Convert all direct users to accessors. [ Impact: convert direct rq->data_len usages to blk_rq_bytes() ] Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Cc: Borislav Petkov <petkovbb@googlemail.com> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Showing 5 changed files with 13 additions and 24 deletions Side-by-side Diff
drivers/ide/ide-atapi.c
... | ... | @@ -255,7 +255,7 @@ |
255 | 255 | ide_init_pc(pc); |
256 | 256 | memcpy(pc->c, sense_rq->cmd, 12); |
257 | 257 | pc->buf = bio_data(sense_rq->bio); /* pointer to mapped address */ |
258 | - pc->req_xfer = sense_rq->data_len; | |
258 | + pc->req_xfer = blk_rq_bytes(sense_rq); | |
259 | 259 | |
260 | 260 | if (drive->media == ide_tape) |
261 | 261 | set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags); |
... | ... | @@ -303,7 +303,7 @@ |
303 | 303 | return 32768; |
304 | 304 | else if (blk_sense_request(rq) || blk_pc_request(rq) || |
305 | 305 | rq->cmd_type == REQ_TYPE_ATA_PC) |
306 | - return rq->data_len; | |
306 | + return blk_rq_bytes(rq); | |
307 | 307 | else |
308 | 308 | return 0; |
309 | 309 | } |
drivers/ide/ide-cd.c
... | ... | @@ -577,7 +577,7 @@ |
577 | 577 | struct request *rq = hwif->rq; |
578 | 578 | ide_expiry_t *expiry = NULL; |
579 | 579 | int dma_error = 0, dma, thislen, uptodate = 0; |
580 | - int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0, nsectors; | |
580 | + int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0; | |
581 | 581 | int sense = blk_sense_request(rq); |
582 | 582 | unsigned int timeout; |
583 | 583 | u16 len; |
... | ... | @@ -707,9 +707,7 @@ |
707 | 707 | |
708 | 708 | out_end: |
709 | 709 | if (blk_pc_request(rq) && rc == 0) { |
710 | - if (blk_end_request(rq, 0, rq->data_len)) | |
711 | - BUG(); | |
712 | - | |
710 | + blk_end_request_all(rq, 0); | |
713 | 711 | hwif->rq = NULL; |
714 | 712 | } else { |
715 | 713 | if (sense && uptodate) |
716 | 714 | |
717 | 715 | |
... | ... | @@ -727,22 +725,14 @@ |
727 | 725 | ide_cd_error_cmd(drive, cmd); |
728 | 726 | |
729 | 727 | /* make sure it's fully ended */ |
730 | - if (blk_pc_request(rq)) | |
731 | - nsectors = (rq->data_len + 511) >> 9; | |
732 | - else | |
733 | - nsectors = blk_rq_sectors(rq); | |
734 | - | |
735 | - if (nsectors == 0) | |
736 | - nsectors = 1; | |
737 | - | |
738 | 728 | if (blk_fs_request(rq) == 0) { |
739 | - rq->resid_len = rq->data_len - | |
729 | + rq->resid_len = blk_rq_bytes(rq) - | |
740 | 730 | (cmd->nbytes - cmd->nleft); |
741 | 731 | if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE)) |
742 | 732 | rq->resid_len += cmd->last_xfer_len; |
743 | 733 | } |
744 | 734 | |
745 | - ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9); | |
735 | + ide_complete_rq(drive, uptodate ? 0 : -EIO, blk_rq_bytes(rq)); | |
746 | 736 | |
747 | 737 | if (sense && rc == 2) |
748 | 738 | ide_error(drive, "request sense failure", stat); |
... | ... | @@ -819,7 +809,7 @@ |
819 | 809 | */ |
820 | 810 | alignment = queue_dma_alignment(q) | q->dma_pad_mask; |
821 | 811 | if ((unsigned long)buf & alignment |
822 | - || rq->data_len & q->dma_pad_mask | |
812 | + || blk_rq_bytes(rq) & q->dma_pad_mask | |
823 | 813 | || object_is_on_stack(buf)) |
824 | 814 | drive->dma = 0; |
825 | 815 | } |
... | ... | @@ -867,9 +857,8 @@ |
867 | 857 | |
868 | 858 | cmd.rq = rq; |
869 | 859 | |
870 | - if (blk_fs_request(rq) || rq->data_len) { | |
871 | - ide_init_sg_cmd(&cmd, blk_fs_request(rq) ? | |
872 | - (blk_rq_sectors(rq) << 9) : rq->data_len); | |
860 | + if (blk_fs_request(rq) || blk_rq_bytes(rq)) { | |
861 | + ide_init_sg_cmd(&cmd, blk_rq_bytes(rq)); | |
873 | 862 | ide_map_sg(drive, &cmd); |
874 | 863 | } |
875 | 864 |
drivers/ide/ide-floppy.c
... | ... | @@ -220,14 +220,14 @@ |
220 | 220 | ide_init_pc(pc); |
221 | 221 | memcpy(pc->c, rq->cmd, sizeof(pc->c)); |
222 | 222 | pc->rq = rq; |
223 | - if (rq->data_len) { | |
223 | + if (blk_rq_bytes(rq)) { | |
224 | 224 | pc->flags |= PC_FLAG_DMA_OK; |
225 | 225 | if (rq_data_dir(rq) == WRITE) |
226 | 226 | pc->flags |= PC_FLAG_WRITING; |
227 | 227 | } |
228 | 228 | /* pio will be performed by ide_pio_bytes() which handles sg fine */ |
229 | 229 | pc->buf = NULL; |
230 | - pc->req_xfer = pc->buf_size = rq->data_len; | |
230 | + pc->req_xfer = pc->buf_size = blk_rq_bytes(rq); | |
231 | 231 | } |
232 | 232 | |
233 | 233 | static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive, |
drivers/ide/ide-io.c
drivers/ide/ide-tape.c