summaryrefslogtreecommitdiffstats
path: root/block/blk-timeout.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2018-11-14 11:02:05 -0500
committerJens Axboe <axboe@kernel.dk>2018-11-15 14:13:16 -0500
commit079076b3416e78ba2bb3ce38e05e320c388c3120 (patch)
tree9542a0f94fc2fcf98be8be557148904f8a55e58e /block/blk-timeout.c
parent8f4236d9008b0973a8281256ccfde6913cdec6cb (diff)
block: remove deadline __deadline manipulation helpers
No users left since the removal of the legacy request interface, we can remove all the magic bit stealing now and make it a normal field. But use WRITE_ONCE/READ_ONCE on the new deadline field, given that we don't seem to have any mechanism to guarantee a new value actually gets seen by other threads. Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-timeout.c')
-rw-r--r--block/blk-timeout.c8
1 files changed, 5 insertions, 3 deletions
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}
90EXPORT_SYMBOL_GPL(blk_abort_request); 90EXPORT_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)) {