diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2008-08-19 19:45:30 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-10-13 09:28:52 -0400 |
commit | 6000a368cd8e6da1caf101411bdb494cd6fb8b09 (patch) | |
tree | 4cd3333af00182e915aa96ffa49069f5f76976dc /include/linux | |
parent | 056a44834950ffa51fafa6c76a720fa32e86851a (diff) |
[SCSI] block: separate failfast into multiple bits.
Multipath is best at handling transport errors. If it gets a device
error then there is not much the multipath layer can do. It will just
access the same device but from a different path.
This patch breaks up failfast into device, transport and driver errors.
The multipath layers (md and dm mutlipath) only ask the lower levels to
fast fail transport errors. The user of failfast, read ahead, will ask
to fast fail on all errors.
Note that blk_noretry_request will return true if any failfast bit
is set. This allows drivers that do not support the multipath failfast
bits to continue to fail on any failfast error like before. Drivers
like scsi that are able to fail fast specific errors can check
for the specific fail fast type. In the next patch I will convert
scsi.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bio.h | 26 | ||||
-rw-r--r-- | include/linux/blkdev.h | 15 |
2 files changed, 29 insertions, 12 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index ff5b4cf9e2da..1beda208cbfb 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -129,25 +129,30 @@ struct bio { | |||
129 | * bit 2 -- barrier | 129 | * bit 2 -- barrier |
130 | * Insert a serialization point in the IO queue, forcing previously | 130 | * Insert a serialization point in the IO queue, forcing previously |
131 | * submitted IO to be completed before this oen is issued. | 131 | * submitted IO to be completed before this oen is issued. |
132 | * bit 3 -- fail fast, don't want low level driver retries | 132 | * bit 3 -- synchronous I/O hint: the block layer will unplug immediately |
133 | * bit 4 -- synchronous I/O hint: the block layer will unplug immediately | ||
134 | * Note that this does NOT indicate that the IO itself is sync, just | 133 | * Note that this does NOT indicate that the IO itself is sync, just |
135 | * that the block layer will not postpone issue of this IO by plugging. | 134 | * that the block layer will not postpone issue of this IO by plugging. |
136 | * bit 5 -- metadata request | 135 | * bit 4 -- metadata request |
137 | * Used for tracing to differentiate metadata and data IO. May also | 136 | * Used for tracing to differentiate metadata and data IO. May also |
138 | * get some preferential treatment in the IO scheduler | 137 | * get some preferential treatment in the IO scheduler |
139 | * bit 6 -- discard sectors | 138 | * bit 5 -- discard sectors |
140 | * Informs the lower level device that this range of sectors is no longer | 139 | * Informs the lower level device that this range of sectors is no longer |
141 | * used by the file system and may thus be freed by the device. Used | 140 | * used by the file system and may thus be freed by the device. Used |
142 | * for flash based storage. | 141 | * for flash based storage. |
142 | * bit 6 -- fail fast device errors | ||
143 | * bit 7 -- fail fast transport errors | ||
144 | * bit 8 -- fail fast driver errors | ||
145 | * Don't want driver retries for any fast fail whatever the reason. | ||
143 | */ | 146 | */ |
144 | #define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ | 147 | #define BIO_RW 0 /* Must match RW in req flags (blkdev.h) */ |
145 | #define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ | 148 | #define BIO_RW_AHEAD 1 /* Must match FAILFAST in req flags */ |
146 | #define BIO_RW_BARRIER 2 | 149 | #define BIO_RW_BARRIER 2 |
147 | #define BIO_RW_FAILFAST 3 | 150 | #define BIO_RW_SYNC 3 |
148 | #define BIO_RW_SYNC 4 | 151 | #define BIO_RW_META 4 |
149 | #define BIO_RW_META 5 | 152 | #define BIO_RW_DISCARD 5 |
150 | #define BIO_RW_DISCARD 6 | 153 | #define BIO_RW_FAILFAST_DEV 6 |
154 | #define BIO_RW_FAILFAST_TRANSPORT 7 | ||
155 | #define BIO_RW_FAILFAST_DRIVER 8 | ||
151 | 156 | ||
152 | /* | 157 | /* |
153 | * upper 16 bits of bi_rw define the io priority of this bio | 158 | * upper 16 bits of bi_rw define the io priority of this bio |
@@ -174,7 +179,10 @@ struct bio { | |||
174 | #define bio_sectors(bio) ((bio)->bi_size >> 9) | 179 | #define bio_sectors(bio) ((bio)->bi_size >> 9) |
175 | #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) | 180 | #define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER)) |
176 | #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) | 181 | #define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC)) |
177 | #define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST)) | 182 | #define bio_failfast_dev(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DEV)) |
183 | #define bio_failfast_transport(bio) \ | ||
184 | ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_TRANSPORT)) | ||
185 | #define bio_failfast_driver(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST_DRIVER)) | ||
178 | #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) | 186 | #define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD)) |
179 | #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) | 187 | #define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META)) |
180 | #define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD)) | 188 | #define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD)) |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index a92d9e4ea96e..f3491d225268 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -87,7 +87,9 @@ enum { | |||
87 | */ | 87 | */ |
88 | enum rq_flag_bits { | 88 | enum rq_flag_bits { |
89 | __REQ_RW, /* not set, read. set, write */ | 89 | __REQ_RW, /* not set, read. set, write */ |
90 | __REQ_FAILFAST, /* no low level driver retries */ | 90 | __REQ_FAILFAST_DEV, /* no driver retries of device errors */ |
91 | __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */ | ||
92 | __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */ | ||
91 | __REQ_DISCARD, /* request to discard sectors */ | 93 | __REQ_DISCARD, /* request to discard sectors */ |
92 | __REQ_SORTED, /* elevator knows about this request */ | 94 | __REQ_SORTED, /* elevator knows about this request */ |
93 | __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ | 95 | __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ |
@@ -111,8 +113,10 @@ enum rq_flag_bits { | |||
111 | }; | 113 | }; |
112 | 114 | ||
113 | #define REQ_RW (1 << __REQ_RW) | 115 | #define REQ_RW (1 << __REQ_RW) |
116 | #define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV) | ||
117 | #define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT) | ||
118 | #define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER) | ||
114 | #define REQ_DISCARD (1 << __REQ_DISCARD) | 119 | #define REQ_DISCARD (1 << __REQ_DISCARD) |
115 | #define REQ_FAILFAST (1 << __REQ_FAILFAST) | ||
116 | #define REQ_SORTED (1 << __REQ_SORTED) | 120 | #define REQ_SORTED (1 << __REQ_SORTED) |
117 | #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) | 121 | #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) |
118 | #define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) | 122 | #define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) |
@@ -560,7 +564,12 @@ enum { | |||
560 | #define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) | 564 | #define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) |
561 | #define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) | 565 | #define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) |
562 | 566 | ||
563 | #define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST) | 567 | #define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV) |
568 | #define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT) | ||
569 | #define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER) | ||
570 | #define blk_noretry_request(rq) (blk_failfast_dev(rq) || \ | ||
571 | blk_failfast_transport(rq) || \ | ||
572 | blk_failfast_driver(rq)) | ||
564 | #define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) | 573 | #define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) |
565 | 574 | ||
566 | #define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq))) | 575 | #define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq))) |