[PATCH v1 1/2] block: cleanup: define default command timeout and use it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prasanna Kumar Kalever <prasanna.kalever@xxxxxxxxxx>

defined BLK_DEFAULT_CMD_TIMEOUT and reuse it everywhere else.

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@xxxxxxxxxx>
---
 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




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux