aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-05-07 09:24:38 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-05-11 03:50:53 -0400
commit5b93629b4509c03ffa87a9316412fedf6f58cb37 (patch)
treead5ceda3f718361b8df3057b4f9edcc79aa4cd9d /include
parentc3a4d78c580de4edc9ef0f7c59812fb02ceb037f (diff)
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 <tj@kernel.org> Acked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Acked-by: Stephen Rothwell <sfr@canb.auug.org.au> Tested-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Grant Likely <grant.likely@secretlab.ca> Ackec-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Cc: Borislav Petkov <petkovbb@googlemail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/blkdev.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 6a967cad89fa..4e5f85598728 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -832,13 +832,30 @@ static inline void blk_run_address_space(struct address_space *mapping)
832extern void blkdev_dequeue_request(struct request *req); 832extern void blkdev_dequeue_request(struct request *req);
833 833
834/* 834/*
835 * blk_end_request() takes bytes instead of sectors as a complete size. 835 * blk_rq_pos() : the current sector
836 * blk_rq_bytes() returns bytes left to complete in the entire request. 836 * blk_rq_bytes() : bytes left in the entire request
837 * blk_rq_cur_bytes() returns bytes left to complete in the current segment. 837 * blk_rq_cur_bytes() : bytes left in the current segment
838 * blk_rq_sectors() : sectors left in the entire request
839 * blk_rq_cur_sectors() : sectors left in the current segment
838 */ 840 */
841static inline sector_t blk_rq_pos(const struct request *rq)
842{
843 return rq->hard_sector;
844}
845
839extern unsigned int blk_rq_bytes(struct request *rq); 846extern unsigned int blk_rq_bytes(struct request *rq);
840extern unsigned int blk_rq_cur_bytes(struct request *rq); 847extern unsigned int blk_rq_cur_bytes(struct request *rq);
841 848
849static inline unsigned int blk_rq_sectors(const struct request *rq)
850{
851 return rq->hard_nr_sectors;
852}
853
854static inline unsigned int blk_rq_cur_sectors(const struct request *rq)
855{
856 return rq->hard_cur_sectors;
857}
858
842/* 859/*
843 * Request completion related functions. 860 * Request completion related functions.
844 * 861 *