From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk, linux-kernel@vger.kernel.org, jeff@garzik.org,
linux-ide@vger.kernel.org, James.Bottomley@HansenPartnership.com,
linux-scsi@vger.kernel.org, bzolnier@gmail.com, petko
Cc: Tejun Heo <tj@kernel.org>
Subject: [PATCH 09/11] ide: cleanup rq->data_len usages
Date: Mon, 4 May 2009 16:58:45 +0900 [thread overview]
Message-ID: <1241423927-11871-10-git-send-email-tj@kernel.org> (raw)
In-Reply-To: <1241423927-11871-1-git-send-email-tj@kernel.org>
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>
---
drivers/ide/ide-atapi.c | 4 ++--
drivers/ide/ide-cd.c | 25 +++++++------------------
drivers/ide/ide-floppy.c | 4 ++--
drivers/ide/ide-io.c | 2 +-
4 files changed, 12 insertions(+), 23 deletions(-)
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index e4a02a0..792534d 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -255,7 +255,7 @@ void ide_retry_pc(ide_drive_t *drive)
ide_init_pc(pc);
memcpy(pc->c, sense_rq->cmd, 12);
pc->buf = bio_data(sense_rq->bio); /* pointer to mapped address */
- pc->req_xfer = sense_rq->data_len;
+ pc->req_xfer = blk_rq_bytes(sense_rq);
if (drive->media == ide_tape)
set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
@@ -303,7 +303,7 @@ int ide_cd_get_xferlen(struct request *rq)
return 32768;
else if (blk_sense_request(rq) || blk_pc_request(rq) ||
rq->cmd_type == REQ_TYPE_ATA_PC)
- return rq->data_len;
+ return blk_rq_bytes(rq);
else
return 0;
}
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 94a341b..1a58b38 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -576,7 +576,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
struct request *rq = hwif->rq;
ide_expiry_t *expiry = NULL;
int dma_error = 0, dma, thislen, uptodate = 0;
- int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0, nsectors;
+ int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0;
int sense = blk_sense_request(rq);
unsigned int timeout;
u16 len;
@@ -706,9 +706,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
out_end:
if (blk_pc_request(rq) && rc == 0) {
- if (blk_end_request(rq, 0, rq->data_len))
- BUG();
-
+ blk_end_request_all(rq, 0);
hwif->rq = NULL;
} else {
if (sense && uptodate)
@@ -726,22 +724,14 @@ out_end:
ide_cd_error_cmd(drive, cmd);
/* make sure it's fully ended */
- if (blk_pc_request(rq))
- nsectors = (rq->data_len + 511) >> 9;
- else
- nsectors = blk_rq_sectors(rq);
-
- if (nsectors == 0)
- nsectors = 1;
-
if (blk_fs_request(rq) == 0) {
- rq->resid_len = rq->data_len -
+ rq->resid_len = blk_rq_bytes(rq) -
(cmd->nbytes - cmd->nleft);
if (uptodate == 0 && (cmd->tf_flags & IDE_TFLAG_WRITE))
rq->resid_len += cmd->last_xfer_len;
}
- ide_complete_rq(drive, uptodate ? 0 : -EIO, nsectors << 9);
+ ide_complete_rq(drive, uptodate ? 0 : -EIO, blk_rq_bytes(rq));
if (sense && rc == 2)
ide_error(drive, "request sense failure", stat);
@@ -818,7 +808,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
*/
alignment = queue_dma_alignment(q) | q->dma_pad_mask;
if ((unsigned long)buf & alignment
- || rq->data_len & q->dma_pad_mask
+ || blk_rq_bytes(rq) & q->dma_pad_mask
|| object_is_on_stack(buf))
drive->dma = 0;
}
@@ -866,9 +856,8 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
cmd.rq = rq;
- if (blk_fs_request(rq) || rq->data_len) {
- ide_init_sg_cmd(&cmd, blk_fs_request(rq) ?
- (blk_rq_sectors(rq) << 9) : rq->data_len);
+ if (blk_fs_request(rq) || blk_rq_bytes(rq)) {
+ ide_init_sg_cmd(&cmd, blk_rq_bytes(rq));
ide_map_sg(drive, &cmd);
}
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 1c460bd..6509817 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -220,14 +220,14 @@ static void idefloppy_blockpc_cmd(struct ide_disk_obj *floppy,
ide_init_pc(pc);
memcpy(pc->c, rq->cmd, sizeof(pc->c));
pc->rq = rq;
- if (rq->data_len) {
+ if (blk_rq_bytes(rq)) {
pc->flags |= PC_FLAG_DMA_OK;
if (rq_data_dir(rq) == WRITE)
pc->flags |= PC_FLAG_WRITING;
}
/* pio will be performed by ide_pio_bytes() which handles sg fine */
pc->buf = NULL;
- pc->req_xfer = pc->buf_size = rq->data_len;
+ pc->req_xfer = pc->buf_size = blk_rq_bytes(rq);
}
static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 59799ca..ca2519d 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -116,7 +116,7 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
unsigned int ide_rq_bytes(struct request *rq)
{
if (blk_pc_request(rq))
- return rq->data_len;
+ return blk_rq_bytes(rq);
else
return blk_rq_cur_sectors(rq) << 9;
}
--
1.6.0.2
next prev parent reply other threads:[~2009-05-04 7:58 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-04 7:58 [GIT PATCH] block,scsi,ide: unify sector and data_len, take#2 Tejun Heo
2009-05-04 7:58 ` [PATCH 01/11] nbd: don't clear rq->sector and nr_sectors unnecessarily Tejun Heo
2009-05-04 7:58 ` [PATCH 02/11] ide-tape: don't initialize rq->sector for rw requests Tejun Heo
2009-05-04 7:58 ` [PATCH 03/11] block: add rq->resid_len Tejun Heo
2009-05-04 12:08 ` Sergei Shtylyov
2009-05-05 3:41 ` Tejun Heo
2009-05-07 10:23 ` FUJITA Tomonori
2009-05-10 14:07 ` Boaz Harrosh
2009-05-10 23:48 ` Tejun Heo
2009-05-11 5:49 ` FUJITA Tomonori
2009-05-11 14:18 ` James Bottomley
2009-05-11 15:03 ` FUJITA Tomonori
2009-05-11 15:13 ` James Bottomley
2009-05-11 23:47 ` FUJITA Tomonori
2009-05-12 0:19 ` Tejun Heo
2009-05-12 3:43 ` James Bottomley
2009-05-12 6:04 ` Tejun Heo
2009-05-12 14:08 ` James Bottomley
2009-05-12 14:34 ` Alan Stern
2009-05-12 15:17 ` Tejun Heo
2009-05-12 15:45 ` James Bottomley
2009-05-13 6:30 ` Tejun Heo
2009-05-11 11:31 ` Boaz Harrosh
2009-05-11 14:59 ` FUJITA Tomonori
2009-05-12 8:58 ` Boaz Harrosh
2009-05-12 15:00 ` FUJITA Tomonori
2009-05-12 15:08 ` Boaz Harrosh
2009-05-12 15:16 ` FUJITA Tomonori
2009-05-12 0:27 ` Tejun Heo
2009-05-12 8:46 ` Boaz Harrosh
2009-05-12 9:07 ` Tejun Heo
2009-05-12 9:10 ` Tejun Heo
2009-05-12 9:52 ` Boaz Harrosh
2009-05-12 10:06 ` Tejun Heo
2009-05-12 11:08 ` Boaz Harrosh
2009-05-12 15:20 ` Tejun Heo
2009-05-12 15:53 ` Boaz Harrosh
2009-05-04 7:58 ` [PATCH 04/11] block: implement blk_rq_pos/[cur_]sectors() and convert obvious ones Tejun Heo
2009-05-04 13:45 ` Sergei Shtylyov
2009-05-05 3:42 ` Tejun Heo
2009-05-04 7:58 ` [PATCH 05/11] block: convert to pos and nr_sectors accessors Tejun Heo
2009-05-04 19:48 ` Adrian McMenamin
2009-05-05 3:42 ` Tejun Heo
2009-05-04 7:58 ` [PATCH 06/11] ide: convert to rq " Tejun Heo
2009-05-04 7:58 ` [PATCH 07/11] block: drop request->hard_* and *nr_sectors Tejun Heo
2009-05-04 7:58 ` [PATCH 08/11] block: cleanup rq->data_len usages Tejun Heo
2009-05-04 14:41 ` Sergei Shtylyov
2009-05-11 12:02 ` Boaz Harrosh
2009-05-04 7:58 ` Tejun Heo [this message]
2009-05-04 7:58 ` [PATCH 10/11] block: hide request sector and data_len Tejun Heo
2009-05-04 7:58 ` [PATCH 11/11] block: blk_rq_[cur_]_{sectors|bytes}() usage cleanup Tejun Heo
2009-05-05 3:59 ` [GIT PATCH] block,scsi,ide: unify sector and data_len, take#2 Tejun Heo
2009-05-07 2:48 ` Tejun Heo
2009-05-07 10:23 ` FUJITA Tomonori
2009-05-08 2:06 ` FUJITA Tomonori
2009-05-08 9:11 ` Tejun Heo
2009-05-11 12:06 ` Boaz Harrosh
2009-05-12 0:49 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1241423927-11871-10-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@kernel.dk \
--cc=bzolnier@gmail.com \
--cc=jeff@garzik.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).