ide: convert to rq pos and nr_sectors accessors
authorTejun Heo <tj@kernel.org>
Thu, 7 May 2009 13:24:40 +0000 (22:24 +0900)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 11 May 2009 07:50:54 +0000 (09:50 +0200)
ide doesn't manipulate request fields anymore and thus all hard and
their soft equivalents are always equal.  Convert all references to
accessors.

[ Impact: use pos and nr_sectors accessors ]

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>
drivers/ide/ide-cd.c
drivers/ide/ide-disk.c
drivers/ide/ide-dma.c
drivers/ide/ide-floppy.c
drivers/ide/ide-io.c
drivers/ide/ide-lib.c
drivers/ide/ide-tape.c
drivers/ide/ide-taskfile.c
drivers/ide/pdc202xx_old.c
drivers/ide/tc86c001.c
drivers/ide/tx4939ide.c

index 182320dd6ea140a0724558f451322e23301a6f95..eb4f3dc9f182456e41dc6922d232f22c88721623 100644 (file)
@@ -775,8 +775,8 @@ static ide_startstop_t cdrom_start_rw(ide_drive_t *drive, struct request *rq)
        }
 
        /* fs requests *must* be hardware frame aligned */
-       if ((rq->nr_sectors & (sectors_per_frame - 1)) ||
-           (rq->sector & (sectors_per_frame - 1)))
+       if ((blk_rq_sectors(rq) & (sectors_per_frame - 1)) ||
+           (blk_rq_pos(rq) & (sectors_per_frame - 1)))
                return ide_stopped;
 
        /* use DMA, if possible */
@@ -868,8 +868,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) ? (rq->nr_sectors << 9)
-                                                        : rq->data_len);
+               ide_init_sg_cmd(&cmd, blk_fs_request(rq) ?
+                               (blk_rq_sectors(rq) << 9) : rq->data_len);
                ide_map_sg(drive, &cmd);
        }
 
index c2438804d3c4a074ae1ea6d95a39a2df325a0869..ad18e14043c57b5ae52bb9015efb8e7588cbcfdc 100644 (file)
@@ -82,7 +82,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
                                        sector_t block)
 {
        ide_hwif_t *hwif        = drive->hwif;
-       u16 nsectors            = (u16)rq->nr_sectors;
+       u16 nsectors            = (u16)blk_rq_sectors(rq);
        u8 lba48                = !!(drive->dev_flags & IDE_DFLAG_LBA48);
        u8 dma                  = !!(drive->dev_flags & IDE_DFLAG_USING_DMA);
        struct ide_cmd          cmd;
@@ -90,7 +90,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
        ide_startstop_t         rc;
 
        if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) {
-               if (block + rq->nr_sectors > 1ULL << 28)
+               if (block + blk_rq_sectors(rq) > 1ULL << 28)
                        dma = 0;
                else
                        lba48 = 0;
@@ -195,9 +195,9 @@ static ide_startstop_t ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
 
        ledtrig_ide_activity();
 
-       pr_debug("%s: %sing: block=%llu, sectors=%lu, buffer=0x%08lx\n",
+       pr_debug("%s: %sing: block=%llu, sectors=%u, buffer=0x%08lx\n",
                 drive->name, rq_data_dir(rq) == READ ? "read" : "writ",
-                (unsigned long long)block, rq->nr_sectors,
+                (unsigned long long)block, blk_rq_sectors(rq),
                 (unsigned long)rq->buffer);
 
        if (hwif->rw_disk)
index d9123ecae4a9829bcbee1e1d0f889bf5b20a6fa2..001f68f0bb285c62d0b42b6dbb1508d92182923a 100644 (file)
@@ -103,7 +103,7 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive)
                                ide_finish_cmd(drive, cmd, stat);
                        else
                                ide_complete_rq(drive, 0,
-                                               cmd->rq->nr_sectors << 9);
+                                               blk_rq_sectors(cmd->rq) << 9);
                        return ide_stopped;
                }
                printk(KERN_ERR "%s: %s: bad DMA status (0x%02x)\n",
index 537b7c5580339faea334f59f68c425895ed0263e..1c460bd563752b74da151c5e1cd10c77a958c162 100644 (file)
@@ -194,7 +194,7 @@ static void idefloppy_create_rw_cmd(ide_drive_t *drive,
 {
        struct ide_disk_obj *floppy = drive->driver_data;
        int block = sector / floppy->bs_factor;
-       int blocks = rq->nr_sectors / floppy->bs_factor;
+       int blocks = blk_rq_sectors(rq) / floppy->bs_factor;
        int cmd = rq_data_dir(rq);
 
        ide_debug_log(IDE_DBG_FUNC, "block: %d, blocks: %d", block, blocks);
@@ -259,8 +259,8 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
                        goto out_end;
        }
        if (blk_fs_request(rq)) {
-               if (((long)rq->sector % floppy->bs_factor) ||
-                   (rq->nr_sectors % floppy->bs_factor)) {
+               if (((long)blk_rq_pos(rq) % floppy->bs_factor) ||
+                   (blk_rq_sectors(rq) % floppy->bs_factor)) {
                        printk(KERN_ERR PFX "%s: unsupported r/w rq size\n",
                                drive->name);
                        goto out_end;
index df23bcbd94b4a6fe48fb8b157a1e14ef753adc55..59799ca552460aa43debbfa22144e91635eca17d 100644 (file)
@@ -279,7 +279,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
 
        if (cmd) {
                if (cmd->protocol == ATA_PROT_PIO) {
-                       ide_init_sg_cmd(cmd, rq->nr_sectors << 9);
+                       ide_init_sg_cmd(cmd, blk_rq_sectors(rq) << 9);
                        ide_map_sg(drive, cmd);
                }
 
@@ -387,7 +387,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
 
                drv = *(struct ide_driver **)rq->rq_disk->private_data;
 
-               return drv->do_request(drive, rq, rq->sector);
+               return drv->do_request(drive, rq, blk_rq_pos(rq));
        }
        return do_special(drive);
 kill_rq:
index 56ff8c46c7d10a4cf0eefa27bd69769ac52c7953..05b7fbc7ead54d3c41f00cc30310368dccaf70f8 100644 (file)
@@ -114,7 +114,7 @@ static void ide_dump_ata_error(ide_drive_t *drive, u8 err)
 
                if (rq)
                        printk(KERN_CONT ", sector=%llu",
-                              (unsigned long long)rq->sector);
+                              (unsigned long long)blk_rq_pos(rq));
        }
        printk(KERN_CONT "\n");
 }
index 65c5b705883aba80eb20d68d3a89c1f1cb98261e..c6cf3a951f28adaccbe2f1db756d198d8b71f449 100644 (file)
@@ -586,7 +586,7 @@ static void ide_tape_create_rw_cmd(idetape_tape_t *tape,
                                   struct ide_atapi_pc *pc, struct request *rq,
                                   u8 opcode)
 {
-       unsigned int length = rq->nr_sectors;
+       unsigned int length = blk_rq_sectors(rq);
 
        ide_init_pc(pc);
        put_unaligned(cpu_to_be32(length), (unsigned int *) &pc->c[1]);
@@ -617,8 +617,8 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
        struct ide_cmd cmd;
        u8 stat;
 
-       debug_log(DBG_SENSE, "sector: %llu, nr_sectors: %lu\n"
-                 (unsigned long long)rq->sector, rq->nr_sectors);
+       debug_log(DBG_SENSE, "sector: %llu, nr_sectors: %u\n"
+                 (unsigned long long)blk_rq_pos(rq), blk_rq_sectors(rq));
 
        if (!(blk_special_request(rq) || blk_sense_request(rq))) {
                /* We do not support buffer cache originated requests. */
index f400eb4d4aff73414a2e7b2d0e9739ce0969de46..a0c3e1b2f73c20b6b005eb9ce2b35ea61bbb42f1 100644 (file)
@@ -385,7 +385,7 @@ out_end:
        if ((cmd->tf_flags & IDE_TFLAG_FS) == 0)
                ide_finish_cmd(drive, cmd, stat);
        else
-               ide_complete_rq(drive, 0, cmd->rq->nr_sectors << 9);
+               ide_complete_rq(drive, 0, blk_rq_sectors(cmd->rq) << 9);
        return ide_stopped;
 out_err:
        ide_error_cmd(drive, cmd);
index 248a54bd2386f346e155c19a74f1c635215170a3..c2a16a8f486dea1525d75a2ac6a037d2fe96bc04 100644 (file)
@@ -177,7 +177,7 @@ static void pdc202xx_dma_start(ide_drive_t *drive)
                u8 clock = inb(high_16 + 0x11);
 
                outb(clock | (hwif->channel ? 0x08 : 0x02), high_16 + 0x11);
-               word_count = (rq->nr_sectors << 8);
+               word_count = (blk_rq_sectors(rq) << 8);
                word_count = (rq_data_dir(rq) == READ) ?
                                        word_count | 0x05000000 :
                                        word_count | 0x06000000;
index b4cf42dc8a6fcf4cd155ae0bd3f7ad9868a10106..05a93d6baecc60edf3ba587ab26c0947907915aa 100644 (file)
@@ -112,7 +112,7 @@ static void tc86c001_dma_start(ide_drive_t *drive)
        ide_hwif_t *hwif        = drive->hwif;
        unsigned long sc_base   = hwif->config_data;
        unsigned long twcr_port = sc_base + (drive->dn ? 0x06 : 0x04);
-       unsigned long nsectors  = hwif->rq->nr_sectors;
+       unsigned long nsectors  = blk_rq_sectors(hwif->rq);
 
        /*
         * We have to manually load the sector count and size into
index 564422d239766a97debc65ff45546d0bbfa9095b..5ca76224f6d11a731b585f98a35ea8e2661c4e5e 100644 (file)
@@ -307,7 +307,7 @@ static int tx4939ide_dma_setup(ide_drive_t *drive, struct ide_cmd *cmd)
        tx4939ide_writew(SECTOR_SIZE / 2, base, drive->dn ?
                         TX4939IDE_Xfer_Cnt_2 : TX4939IDE_Xfer_Cnt_1);
 
-       tx4939ide_writew(cmd->rq->nr_sectors, base, TX4939IDE_Sec_Cnt);
+       tx4939ide_writew(blk_rq_sectors(cmd->rq), base, TX4939IDE_Sec_Cnt);
 
        return 0;
 }