mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
block: implement blk_rq_pos/[cur_]sectors() and convert obvious ones
Implement accessors - blk_rq_pos(), blk_rq_sectors() and blk_rq_cur_sectors() which return rq->hard_sector, rq->hard_nr_sectors and rq->hard_cur_sectors respectively and convert direct references of the said fields to the accessors. This is in preparation of request data length handling cleanup. Geert : suggested adding const to struct request * parameter to accessors Sergei : spotted error in patch description [ Impact: cleanup ] Signed-off-by: Tejun Heo <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Acked-by: Stephen Rothwell <[email protected]> Tested-by: Grant Likely <[email protected]> Acked-by: Grant Likely <[email protected]> Ackec-by: Sergei Shtylyov <[email protected]> Cc: Bartlomiej Zolnierkiewicz <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: James Bottomley <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
c3a4d78c58
commit
5b93629b45
12 changed files with 42 additions and 25 deletions
|
|
@ -136,7 +136,7 @@ static int ps3disk_submit_request_sg(struct ps3_storage_device *dev,
|
|||
dev_dbg(&dev->sbd.core,
|
||||
"%s:%u: %s req has %u bvecs for %lu sectors %lu hard sectors\n",
|
||||
__func__, __LINE__, op, n, req->nr_sectors,
|
||||
req->hard_nr_sectors);
|
||||
blk_rq_sectors(req));
|
||||
#endif
|
||||
|
||||
start_sector = req->sector * priv->blocking_factor;
|
||||
|
|
|
|||
|
|
@ -368,12 +368,12 @@ static void do_viodasd_request(struct request_queue *q)
|
|||
blkdev_dequeue_request(req);
|
||||
/* check that request contains a valid command */
|
||||
if (!blk_fs_request(req)) {
|
||||
viodasd_end_request(req, -EIO, req->hard_nr_sectors);
|
||||
viodasd_end_request(req, -EIO, blk_rq_sectors(req));
|
||||
continue;
|
||||
}
|
||||
/* Try sending the request */
|
||||
if (send_request(req) != 0)
|
||||
viodasd_end_request(req, -EIO, req->hard_nr_sectors);
|
||||
viodasd_end_request(req, -EIO, blk_rq_sectors(req));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -590,7 +590,7 @@ static int viodasd_handle_read_write(struct vioblocklpevent *bevent)
|
|||
err = vio_lookup_rc(viodasd_err_table, bevent->sub_result);
|
||||
printk(VIOD_KERN_WARNING "read/write error %d:0x%04x (%s)\n",
|
||||
event->xRc, bevent->sub_result, err->msg);
|
||||
num_sect = req->hard_nr_sectors;
|
||||
num_sect = blk_rq_sectors(req);
|
||||
}
|
||||
qlock = req->q->queue_lock;
|
||||
spin_lock_irqsave(qlock, irq_flags);
|
||||
|
|
|
|||
|
|
@ -645,8 +645,8 @@ static void ace_fsm_dostate(struct ace_device *ace)
|
|||
|
||||
/* Okay, it's a data request, set it up for transfer */
|
||||
dev_dbg(ace->dev,
|
||||
"request: sec=%llx hcnt=%lx, ccnt=%x, dir=%i\n",
|
||||
(unsigned long long) req->sector, req->hard_nr_sectors,
|
||||
"request: sec=%llx hcnt=%x, ccnt=%x, dir=%i\n",
|
||||
(unsigned long long) req->sector, blk_rq_sectors(req),
|
||||
req->current_nr_sectors, rq_data_dir(req));
|
||||
|
||||
ace->req = req;
|
||||
|
|
@ -654,7 +654,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
|
|||
ace->data_count = req->current_nr_sectors * ACE_BUF_PER_SECTOR;
|
||||
ace_out32(ace, ACE_MPULBA, req->sector & 0x0FFFFFFF);
|
||||
|
||||
count = req->hard_nr_sectors;
|
||||
count = blk_rq_sectors(req);
|
||||
if (rq_data_dir(req)) {
|
||||
/* Kick off write request */
|
||||
dev_dbg(ace->dev, "write data\n");
|
||||
|
|
@ -719,8 +719,8 @@ static void ace_fsm_dostate(struct ace_device *ace)
|
|||
/* bio finished; is there another one? */
|
||||
if (__blk_end_request(ace->req, 0,
|
||||
blk_rq_cur_bytes(ace->req))) {
|
||||
/* dev_dbg(ace->dev, "next block; h=%li c=%i\n",
|
||||
* ace->req->hard_nr_sectors,
|
||||
/* dev_dbg(ace->dev, "next block; h=%u c=%u\n",
|
||||
* blk_rq_sectors(ace->req),
|
||||
* ace->req->current_nr_sectors);
|
||||
*/
|
||||
ace->data_ptr = ace->req->buffer;
|
||||
|
|
|
|||
Loading…
Reference in a new issue