]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
blk-mq: simplify blk_mq_rq_timed_out
authorChristoph Hellwig <hch@lst.de>
Tue, 29 May 2018 13:52:39 +0000 (15:52 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 29 May 2018 14:59:21 +0000 (08:59 -0600)
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index 51edbbb91369231f6170e78e520e33622d01b7af..3d3952301b3e1e7674339fe588e0c092872d5d14 100644 (file)
@@ -770,22 +770,16 @@ EXPORT_SYMBOL(blk_mq_tag_to_rq);
 
 static void blk_mq_rq_timed_out(struct request *req, bool reserved)
 {
-       const struct blk_mq_ops *ops = req->q->mq_ops;
-       enum blk_eh_timer_return ret = BLK_EH_RESET_TIMER;
+       if (req->q->mq_ops->timeout) {
+               enum blk_eh_timer_return ret;
 
-       if (ops->timeout)
-               ret = ops->timeout(req, reserved);
-
-       switch (ret) {
-       case BLK_EH_RESET_TIMER:
-               blk_add_timer(req);
-               break;
-       case BLK_EH_DONE:
-               break;
-       default:
-               printk(KERN_ERR "block: bad eh return: %d\n", ret);
-               break;
+               ret = req->q->mq_ops->timeout(req, reserved);
+               if (ret == BLK_EH_DONE)
+                       return;
+               WARN_ON_ONCE(ret != BLK_EH_RESET_TIMER);
        }
+
+       blk_add_timer(req);
 }
 
 static bool blk_mq_req_expired(struct request *rq, unsigned long *next)