diff options
-rw-r--r-- | block/blk-mq.c | 4 | ||||
-rw-r--r-- | block/blk-timeout.c | 8 | ||||
-rw-r--r-- | block/blk.h | 35 | ||||
-rw-r--r-- | include/linux/blkdev.h | 4 |
4 files changed, 8 insertions, 43 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c index 411be60d0cb6..4c82b4b4fa3e 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -325,7 +325,7 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, | |||
325 | rq->special = NULL; | 325 | rq->special = NULL; |
326 | /* tag was already set */ | 326 | /* tag was already set */ |
327 | rq->extra_len = 0; | 327 | rq->extra_len = 0; |
328 | rq->__deadline = 0; | 328 | WRITE_ONCE(rq->deadline, 0); |
329 | 329 | ||
330 | rq->timeout = 0; | 330 | rq->timeout = 0; |
331 | 331 | ||
@@ -839,7 +839,7 @@ static bool blk_mq_req_expired(struct request *rq, unsigned long *next) | |||
839 | if (rq->rq_flags & RQF_TIMED_OUT) | 839 | if (rq->rq_flags & RQF_TIMED_OUT) |
840 | return false; | 840 | return false; |
841 | 841 | ||
842 | deadline = blk_rq_deadline(rq); | 842 | deadline = READ_ONCE(rq->deadline); |
843 | if (time_after_eq(jiffies, deadline)) | 843 | if (time_after_eq(jiffies, deadline)) |
844 | return true; | 844 | return true; |
845 | 845 | ||
diff --git a/block/blk-timeout.c b/block/blk-timeout.c index 006cff4390c0..3b0179fbdd6a 100644 --- a/block/blk-timeout.c +++ b/block/blk-timeout.c | |||
@@ -84,7 +84,7 @@ void blk_abort_request(struct request *req) | |||
84 | * immediately and that scan sees the new timeout value. | 84 | * immediately and that scan sees the new timeout value. |
85 | * No need for fancy synchronizations. | 85 | * No need for fancy synchronizations. |
86 | */ | 86 | */ |
87 | blk_rq_set_deadline(req, jiffies); | 87 | WRITE_ONCE(req->deadline, jiffies); |
88 | kblockd_schedule_work(&req->q->timeout_work); | 88 | kblockd_schedule_work(&req->q->timeout_work); |
89 | } | 89 | } |
90 | EXPORT_SYMBOL_GPL(blk_abort_request); | 90 | EXPORT_SYMBOL_GPL(blk_abort_request); |
@@ -121,14 +121,16 @@ void blk_add_timer(struct request *req) | |||
121 | req->timeout = q->rq_timeout; | 121 | req->timeout = q->rq_timeout; |
122 | 122 | ||
123 | req->rq_flags &= ~RQF_TIMED_OUT; | 123 | req->rq_flags &= ~RQF_TIMED_OUT; |
124 | blk_rq_set_deadline(req, jiffies + req->timeout); | 124 | |
125 | expiry = jiffies + req->timeout; | ||
126 | WRITE_ONCE(req->deadline, expiry); | ||
125 | 127 | ||
126 | /* | 128 | /* |
127 | * If the timer isn't already pending or this timeout is earlier | 129 | * If the timer isn't already pending or this timeout is earlier |
128 | * than an existing one, modify the timer. Round up to next nearest | 130 | * than an existing one, modify the timer. Round up to next nearest |
129 | * second. | 131 | * second. |
130 | */ | 132 | */ |
131 | expiry = blk_rq_timeout(round_jiffies_up(blk_rq_deadline(req))); | 133 | expiry = blk_rq_timeout(round_jiffies_up(expiry)); |
132 | 134 | ||
133 | if (!timer_pending(&q->timeout) || | 135 | if (!timer_pending(&q->timeout) || |
134 | time_before(expiry, q->timeout.expires)) { | 136 | time_before(expiry, q->timeout.expires)) { |
diff --git a/block/blk.h b/block/blk.h index 41b64e6e101b..08a5845b03ba 100644 --- a/block/blk.h +++ b/block/blk.h | |||
@@ -239,26 +239,6 @@ void blk_account_io_completion(struct request *req, unsigned int bytes); | |||
239 | void blk_account_io_done(struct request *req, u64 now); | 239 | void blk_account_io_done(struct request *req, u64 now); |
240 | 240 | ||
241 | /* | 241 | /* |
242 | * EH timer and IO completion will both attempt to 'grab' the request, make | ||
243 | * sure that only one of them succeeds. Steal the bottom bit of the | ||
244 | * __deadline field for this. | ||
245 | */ | ||
246 | static inline int blk_mark_rq_complete(struct request *rq) | ||
247 | { | ||
248 | return test_and_set_bit(0, &rq->__deadline); | ||
249 | } | ||
250 | |||
251 | static inline void blk_clear_rq_complete(struct request *rq) | ||
252 | { | ||
253 | clear_bit(0, &rq->__deadline); | ||
254 | } | ||
255 | |||
256 | static inline bool blk_rq_is_complete(struct request *rq) | ||
257 | { | ||
258 | return test_bit(0, &rq->__deadline); | ||
259 | } | ||
260 | |||
261 | /* | ||
262 | * Internal elevator interface | 242 | * Internal elevator interface |
263 | */ | 243 | */ |
264 | #define ELV_ON_HASH(rq) ((rq)->rq_flags & RQF_HASHED) | 244 | #define ELV_ON_HASH(rq) ((rq)->rq_flags & RQF_HASHED) |
@@ -323,21 +303,6 @@ static inline void req_set_nomerge(struct request_queue *q, struct request *req) | |||
323 | } | 303 | } |
324 | 304 | ||
325 | /* | 305 | /* |
326 | * Steal a bit from this field for legacy IO path atomic IO marking. Note that | ||
327 | * setting the deadline clears the bottom bit, potentially clearing the | ||
328 | * completed bit. The user has to be OK with this (current ones are fine). | ||
329 | */ | ||
330 | static inline void blk_rq_set_deadline(struct request *rq, unsigned long time) | ||
331 | { | ||
332 | rq->__deadline = time & ~0x1UL; | ||
333 | } | ||
334 | |||
335 | static inline unsigned long blk_rq_deadline(struct request *rq) | ||
336 | { | ||
337 | return rq->__deadline & ~0x1UL; | ||
338 | } | ||
339 | |||
340 | /* | ||
341 | * Internal io_context interface | 306 | * Internal io_context interface |
342 | */ | 307 | */ |
343 | void get_io_context(struct io_context *ioc); | 308 | void get_io_context(struct io_context *ioc); |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index dd1e53fd4acf..60507ab7b358 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -224,9 +224,7 @@ struct request { | |||
224 | refcount_t ref; | 224 | refcount_t ref; |
225 | 225 | ||
226 | unsigned int timeout; | 226 | unsigned int timeout; |
227 | 227 | unsigned long deadline; | |
228 | /* access through blk_rq_set_deadline, blk_rq_deadline */ | ||
229 | unsigned long __deadline; | ||
230 | 228 | ||
231 | union { | 229 | union { |
232 | struct __call_single_data csd; | 230 | struct __call_single_data csd; |