aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/blkdev.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2009-07-03 04:48:17 -0400
committerJens Axboe <jens.axboe@oracle.com>2009-09-11 08:33:30 -0400
commit80a761fd33cf812f771e212139157bf8f58d4b3f (patch)
tree21ea67ad749c15f25cb8a9278fe9bd7643c0ba31 /include/linux/blkdev.h
parenta82afdfcb8c0df09776b6458af6b68fc58b2e87b (diff)
block: implement mixed merge of different failfast requests
Failfast has characteristics from other attributes. When issuing, executing and successuflly completing requests, failfast doesn't make any difference. It only affects how a request is handled on failure. Allowing requests with different failfast settings to be merged cause normal IOs to fail prematurely while not allowing has performance penalties as failfast is used for read aheads which are likely to be located near in-flight or to-be-issued normal IOs. This patch introduces the concept of 'mixed merge'. A request is a mixed merge if it is merge of segments which require different handling on failure. Currently the only mixable attributes are failfast ones (or lack thereof). When a bio with different failfast settings is added to an existing request or requests of different failfast settings are merged, the merged request is marked mixed. Each bio carries failfast settings and the request always tracks failfast state of the first bio. When the request fails, blk_rq_err_bytes() can be used to determine how many bytes can be safely failed without crossing into an area which requires further retrials. This allows request merging regardless of failfast settings while keeping the failure handling correct. This patch only implements mixed merge but doesn't enable it. The next one will update SCSI to make use of mixed merge. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Niel Lambrechts <niel.lambrechts@gmail.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r--include/linux/blkdev.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index c3015736d814..650b6a9cb679 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -115,6 +115,7 @@ enum rq_flag_bits {
115 __REQ_INTEGRITY, /* integrity metadata has been remapped */ 115 __REQ_INTEGRITY, /* integrity metadata has been remapped */
116 __REQ_NOIDLE, /* Don't anticipate more IO after this one */ 116 __REQ_NOIDLE, /* Don't anticipate more IO after this one */
117 __REQ_IO_STAT, /* account I/O stat */ 117 __REQ_IO_STAT, /* account I/O stat */
118 __REQ_MIXED_MERGE, /* merge of different types, fail separately */
118 __REQ_NR_BITS, /* stops here */ 119 __REQ_NR_BITS, /* stops here */
119}; 120};
120 121
@@ -143,6 +144,7 @@ enum rq_flag_bits {
143#define REQ_INTEGRITY (1 << __REQ_INTEGRITY) 144#define REQ_INTEGRITY (1 << __REQ_INTEGRITY)
144#define REQ_NOIDLE (1 << __REQ_NOIDLE) 145#define REQ_NOIDLE (1 << __REQ_NOIDLE)
145#define REQ_IO_STAT (1 << __REQ_IO_STAT) 146#define REQ_IO_STAT (1 << __REQ_IO_STAT)
147#define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE)
146 148
147#define REQ_FAILFAST_MASK (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | \ 149#define REQ_FAILFAST_MASK (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | \
148 REQ_FAILFAST_DRIVER) 150 REQ_FAILFAST_DRIVER)
@@ -832,11 +834,13 @@ static inline void blk_run_address_space(struct address_space *mapping)
832} 834}
833 835
834/* 836/*
835 * blk_rq_pos() : the current sector 837 * blk_rq_pos() : the current sector
836 * blk_rq_bytes() : bytes left in the entire request 838 * blk_rq_bytes() : bytes left in the entire request
837 * blk_rq_cur_bytes() : bytes left in the current segment 839 * blk_rq_cur_bytes() : bytes left in the current segment
838 * blk_rq_sectors() : sectors left in the entire request 840 * blk_rq_err_bytes() : bytes left till the next error boundary
839 * blk_rq_cur_sectors() : sectors left in the current segment 841 * blk_rq_sectors() : sectors left in the entire request
842 * blk_rq_cur_sectors() : sectors left in the current segment
843 * blk_rq_err_sectors() : sectors left till the next error boundary
840 */ 844 */
841static inline sector_t blk_rq_pos(const struct request *rq) 845static inline sector_t blk_rq_pos(const struct request *rq)
842{ 846{
@@ -853,6 +857,8 @@ static inline int blk_rq_cur_bytes(const struct request *rq)
853 return rq->bio ? bio_cur_bytes(rq->bio) : 0; 857 return rq->bio ? bio_cur_bytes(rq->bio) : 0;
854} 858}
855 859
860extern unsigned int blk_rq_err_bytes(const struct request *rq);
861
856static inline unsigned int blk_rq_sectors(const struct request *rq) 862static inline unsigned int blk_rq_sectors(const struct request *rq)
857{ 863{
858 return blk_rq_bytes(rq) >> 9; 864 return blk_rq_bytes(rq) >> 9;
@@ -863,6 +869,11 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq)
863 return blk_rq_cur_bytes(rq) >> 9; 869 return blk_rq_cur_bytes(rq) >> 9;
864} 870}
865 871
872static inline unsigned int blk_rq_err_sectors(const struct request *rq)
873{
874 return blk_rq_err_bytes(rq) >> 9;
875}
876
866/* 877/*
867 * Request issue related functions. 878 * Request issue related functions.
868 */ 879 */
@@ -889,10 +900,12 @@ extern bool blk_end_request(struct request *rq, int error,
889 unsigned int nr_bytes); 900 unsigned int nr_bytes);
890extern void blk_end_request_all(struct request *rq, int error); 901extern void blk_end_request_all(struct request *rq, int error);
891extern bool blk_end_request_cur(struct request *rq, int error); 902extern bool blk_end_request_cur(struct request *rq, int error);
903extern bool blk_end_request_err(struct request *rq, int error);
892extern bool __blk_end_request(struct request *rq, int error, 904extern bool __blk_end_request(struct request *rq, int error,
893 unsigned int nr_bytes); 905 unsigned int nr_bytes);
894extern void __blk_end_request_all(struct request *rq, int error); 906extern void __blk_end_request_all(struct request *rq, int error);
895extern bool __blk_end_request_cur(struct request *rq, int error); 907extern bool __blk_end_request_cur(struct request *rq, int error);
908extern bool __blk_end_request_err(struct request *rq, int error);
896 909
897extern void blk_complete_request(struct request *); 910extern void blk_complete_request(struct request *);
898extern void __blk_complete_request(struct request *); 911extern void __blk_complete_request(struct request *);