aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-timeout.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-04-25 08:14:48 -0400
committerJens Axboe <axboe@fb.com>2014-04-25 10:24:40 -0400
commitc4a634f432376a28c9639b35746e33168ab97709 (patch)
tree85a9ae79b1df53e1549d04196309d95b7d6144ac /block/blk-timeout.c
parent38535201633077cbaf8b32886b5e3005b36c9024 (diff)
block: fold __blk_add_timer into blk_add_timer
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block/blk-timeout.c')
-rw-r--r--block/blk-timeout.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/block/blk-timeout.c b/block/blk-timeout.c
index 49988a3ca85c..448745683d28 100644
--- a/block/blk-timeout.c
+++ b/block/blk-timeout.c
@@ -166,8 +166,15 @@ void blk_abort_request(struct request *req)
166} 166}
167EXPORT_SYMBOL_GPL(blk_abort_request); 167EXPORT_SYMBOL_GPL(blk_abort_request);
168 168
169static void __blk_add_timer(struct request *req, 169/**
170 struct list_head *timeout_list) 170 * blk_add_timer - Start timeout timer for a single request
171 * @req: request that is about to start running.
172 *
173 * Notes:
174 * Each request has its own timer, and as it is added to the queue, we
175 * set up the timer. When the request completes, we cancel the timer.
176 */
177void blk_add_timer(struct request *req)
171{ 178{
172 struct request_queue *q = req->q; 179 struct request_queue *q = req->q;
173 unsigned long expiry; 180 unsigned long expiry;
@@ -185,8 +192,8 @@ static void __blk_add_timer(struct request *req,
185 req->timeout = q->rq_timeout; 192 req->timeout = q->rq_timeout;
186 193
187 req->deadline = jiffies + req->timeout; 194 req->deadline = jiffies + req->timeout;
188 if (timeout_list) 195 if (!q->mq_ops)
189 list_add_tail(&req->timeout_list, timeout_list); 196 list_add_tail(&req->timeout_list, &req->q->timeout_list);
190 197
191 /* 198 /*
192 * If the timer isn't already pending or this timeout is earlier 199 * If the timer isn't already pending or this timeout is earlier
@@ -211,22 +218,3 @@ static void __blk_add_timer(struct request *req,
211 } 218 }
212 219
213} 220}
214
215/**
216 * blk_add_timer - Start timeout timer for a single request
217 * @req: request that is about to start running.
218 *
219 * Notes:
220 * Each request has its own timer, and as it is added to the queue, we
221 * set up the timer. When the request completes, we cancel the timer.
222 */
223void blk_add_timer(struct request *req)
224{
225 struct request_queue *q = req->q;
226
227 if (q->mq_ops)
228 __blk_add_timer(req, NULL);
229 else
230 __blk_add_timer(req, &req->q->timeout_list);
231}
232