diff options
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4e5f85598728..ce2bf5efa9ba 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -166,19 +166,8 @@ struct request { | |||
166 | enum rq_cmd_type_bits cmd_type; | 166 | enum rq_cmd_type_bits cmd_type; |
167 | unsigned long atomic_flags; | 167 | unsigned long atomic_flags; |
168 | 168 | ||
169 | /* Maintain bio traversal state for part by part I/O submission. | 169 | sector_t sector; /* sector cursor */ |
170 | * hard_* are block layer internals, no driver should touch them! | 170 | unsigned int data_len; /* total data len, don't access directly */ |
171 | */ | ||
172 | |||
173 | sector_t sector; /* next sector to submit */ | ||
174 | sector_t hard_sector; /* next sector to complete */ | ||
175 | unsigned long nr_sectors; /* no. of sectors left to submit */ | ||
176 | unsigned long hard_nr_sectors; /* no. of sectors left to complete */ | ||
177 | /* no. of sectors left to submit in the current segment */ | ||
178 | unsigned int current_nr_sectors; | ||
179 | |||
180 | /* no. of sectors left to complete in the current segment */ | ||
181 | unsigned int hard_cur_sectors; | ||
182 | 171 | ||
183 | struct bio *bio; | 172 | struct bio *bio; |
184 | struct bio *biotail; | 173 | struct bio *biotail; |
@@ -226,7 +215,6 @@ struct request { | |||
226 | unsigned char __cmd[BLK_MAX_CDB]; | 215 | unsigned char __cmd[BLK_MAX_CDB]; |
227 | unsigned char *cmd; | 216 | unsigned char *cmd; |
228 | 217 | ||
229 | unsigned int data_len; | ||
230 | unsigned int extra_len; /* length of alignment and padding */ | 218 | unsigned int extra_len; /* length of alignment and padding */ |
231 | unsigned int sense_len; | 219 | unsigned int sense_len; |
232 | unsigned int resid_len; /* residual count */ | 220 | unsigned int resid_len; /* residual count */ |
@@ -840,20 +828,27 @@ extern void blkdev_dequeue_request(struct request *req); | |||
840 | */ | 828 | */ |
841 | static inline sector_t blk_rq_pos(const struct request *rq) | 829 | static inline sector_t blk_rq_pos(const struct request *rq) |
842 | { | 830 | { |
843 | return rq->hard_sector; | 831 | return rq->sector; |
832 | } | ||
833 | |||
834 | static inline unsigned int blk_rq_bytes(const struct request *rq) | ||
835 | { | ||
836 | return rq->data_len; | ||
844 | } | 837 | } |
845 | 838 | ||
846 | extern unsigned int blk_rq_bytes(struct request *rq); | 839 | static inline int blk_rq_cur_bytes(const struct request *rq) |
847 | extern unsigned int blk_rq_cur_bytes(struct request *rq); | 840 | { |
841 | return rq->bio ? bio_cur_bytes(rq->bio) : 0; | ||
842 | } | ||
848 | 843 | ||
849 | static inline unsigned int blk_rq_sectors(const struct request *rq) | 844 | static inline unsigned int blk_rq_sectors(const struct request *rq) |
850 | { | 845 | { |
851 | return rq->hard_nr_sectors; | 846 | return blk_rq_bytes(rq) >> 9; |
852 | } | 847 | } |
853 | 848 | ||
854 | static inline unsigned int blk_rq_cur_sectors(const struct request *rq) | 849 | static inline unsigned int blk_rq_cur_sectors(const struct request *rq) |
855 | { | 850 | { |
856 | return rq->hard_cur_sectors; | 851 | return blk_rq_cur_bytes(rq) >> 9; |
857 | } | 852 | } |
858 | 853 | ||
859 | /* | 854 | /* |
@@ -928,7 +923,7 @@ static inline void blk_end_request_all(struct request *rq, int error) | |||
928 | */ | 923 | */ |
929 | static inline bool blk_end_request_cur(struct request *rq, int error) | 924 | static inline bool blk_end_request_cur(struct request *rq, int error) |
930 | { | 925 | { |
931 | return blk_end_request(rq, error, rq->hard_cur_sectors << 9); | 926 | return blk_end_request(rq, error, blk_rq_cur_bytes(rq)); |
932 | } | 927 | } |
933 | 928 | ||
934 | /** | 929 | /** |
@@ -981,7 +976,7 @@ static inline void __blk_end_request_all(struct request *rq, int error) | |||
981 | */ | 976 | */ |
982 | static inline bool __blk_end_request_cur(struct request *rq, int error) | 977 | static inline bool __blk_end_request_cur(struct request *rq, int error) |
983 | { | 978 | { |
984 | return __blk_end_request(rq, error, rq->hard_cur_sectors << 9); | 979 | return __blk_end_request(rq, error, blk_rq_cur_bytes(rq)); |
985 | } | 980 | } |
986 | 981 | ||
987 | extern void blk_complete_request(struct request *); | 982 | extern void blk_complete_request(struct request *); |