From patchwork Mon Aug 26 18:47:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Mostafa X-Patchwork-Id: 1153400 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46HLcC1mmpz9sP8; Tue, 27 Aug 2019 04:48:09 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1i2K29-0004hu-9I; Mon, 26 Aug 2019 18:48:05 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1i2K26-0004gK-7O for kernel-team@lists.ubuntu.com; Mon, 26 Aug 2019 18:48:02 +0000 Received: from 1.general.kamal.us.vpn ([10.172.68.52] helo=fourier) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1i2K25-0004wc-OT for kernel-team@lists.ubuntu.com; Mon, 26 Aug 2019 18:48:01 +0000 Received: from kamal by fourier with local (Exim 4.90_1) (envelope-from ) id 1i2K23-0005kB-HE for kernel-team@lists.ubuntu.com; Mon, 26 Aug 2019 11:47:59 -0700 From: Kamal Mostafa To: kernel-team@lists.ubuntu.com Subject: [SRU][linux-aws-bionic][PATCH 1/2] block: add io timeout to sysfs Date: Mon, 26 Aug 2019 11:47:54 -0700 Message-Id: <20190826184756.21995-4-kamal@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190826184756.21995-1-kamal@canonical.com> References: <20190826184756.21995-1-kamal@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Weiping Zhang BugLink: https://bugs.launchpad.net/bugs/1841461 Give a interface to adjust io timeout(ms) by device. Signed-off-by: Weiping Zhang Signed-off-by: Jens Axboe (cherry picked from commit 65cd1d13b880920054d6c750679baa80b7f9c072) Signed-off-by: Kamal Mostafa --- block/blk-sysfs.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 870484eaed1f..06eb8ea600e5 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -424,6 +424,26 @@ static ssize_t queue_poll_store(struct request_queue *q, const char *page, return ret; } +static ssize_t queue_io_timeout_show(struct request_queue *q, char *page) +{ + return sprintf(page, "%u\n", jiffies_to_msecs(q->rq_timeout)); +} + +static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page, + size_t count) +{ + unsigned int val; + int err; + + err = kstrtou32(page, 10, &val); + if (err || val == 0) + return -EINVAL; + + blk_queue_rq_timeout(q, msecs_to_jiffies(val)); + + return count; +} + static ssize_t queue_wb_lat_show(struct request_queue *q, char *page) { if (!q->rq_wb) @@ -670,6 +690,12 @@ static struct queue_sysfs_entry queue_dax_entry = { .show = queue_dax_show, }; +static struct queue_sysfs_entry queue_io_timeout_entry = { + .attr = {.name = "io_timeout", .mode = 0644 }, + .show = queue_io_timeout_show, + .store = queue_io_timeout_store, +}; + static struct queue_sysfs_entry queue_wb_lat_entry = { .attr = {.name = "wbt_lat_usec", .mode = S_IRUGO | S_IWUSR }, .show = queue_wb_lat_show, @@ -717,6 +743,7 @@ static struct attribute *default_attrs[] = { &queue_dax_entry.attr, &queue_wb_lat_entry.attr, &queue_poll_delay_entry.attr, + &queue_io_timeout_entry.attr, #ifdef CONFIG_BLK_DEV_THROTTLING_LOW &throtl_sample_time_entry.attr, #endif