From: pkalever@redhat.com
To: linux-kernel@vger.kernel.org
Cc: linux-block@vger.kernel.org, nbd@other.debian.org,
josef@toxicpanda.com, axboe@kernel.dk, idryomov@redhat.com,
xiubli@redhat.com,
Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
Subject: [PATCH v1 1/2] block: cleanup: define default command timeout and use it
Date: Fri, 6 Aug 2021 19:59:13 +0530 [thread overview]
Message-ID: <20210806142914.70556-2-pkalever@redhat.com> (raw)
In-Reply-To: <20210806142914.70556-1-pkalever@redhat.com>
From: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
defined BLK_DEFAULT_CMD_TIMEOUT and reuse it everywhere else.
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
---
block/blk-mq.c | 2 +-
drivers/block/nbd.c | 2 +-
include/linux/blkdev.h | 2 ++
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 2c4ac51e54eb..1cba91eca6ee 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3289,7 +3289,7 @@ int blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
goto err_hctxs;
INIT_WORK(&q->timeout_work, blk_mq_timeout_work);
- blk_queue_rq_timeout(q, set->timeout ? set->timeout : 30 * HZ);
+ blk_queue_rq_timeout(q, set->timeout ? set->timeout : BLK_DEFAULT_CMD_TIMEOUT);
q->tag_set = set;
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index c38317979f74..16a1a14b1fd1 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1376,7 +1376,7 @@ static void nbd_set_cmd_timeout(struct nbd_device *nbd, u64 timeout)
if (timeout)
blk_queue_rq_timeout(nbd->disk->queue, timeout * HZ);
else
- blk_queue_rq_timeout(nbd->disk->queue, 30 * HZ);
+ blk_queue_rq_timeout(nbd->disk->queue, BLK_DEFAULT_CMD_TIMEOUT);
}
/* Must be called with config_lock held */
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d3afea47ade6..e50a9a5356d3 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -378,6 +378,8 @@ static inline int blkdev_zone_mgmt_ioctl(struct block_device *bdev,
#endif /* CONFIG_BLK_DEV_ZONED */
+#define BLK_DEFAULT_CMD_TIMEOUT (30*HZ) /* 30 seconds */
+
struct request_queue {
struct request *last_merge;
struct elevator_queue *elevator;
--
2.31.1
next prev parent reply other threads:[~2021-08-06 14:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-06 14:29 [PATCH v1 0/2] nbd: reset the queue/io_timeout to default on disconnect pkalever
2021-08-06 14:29 ` pkalever [this message]
2021-09-16 8:22 ` [PATCH v1 1/2] block: cleanup: define default command timeout and use it Ming Lei
2021-10-27 2:18 ` Prasanna Kalever
2021-10-27 2:20 ` Prasanna Kalever
2021-08-06 14:29 ` [PATCH v1 2/2] nbd: reset the queue/io_timeout to default on disconnect pkalever
2021-09-16 8:23 ` Ming Lei
2021-10-27 2:25 ` Prasanna Kalever
2021-09-16 6:25 ` [PATCH v1 0/2] " Prasanna Kalever
2021-10-27 2:41 ` Xiubo Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210806142914.70556-2-pkalever@redhat.com \
--to=pkalever@redhat.com \
--cc=axboe@kernel.dk \
--cc=idryomov@redhat.com \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd@other.debian.org \
--cc=prasanna.kalever@redhat.com \
--cc=xiubli@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).