From patchwork Thu Feb 14 10:24:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 158336 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1172743jaa; Thu, 14 Feb 2019 02:25:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IYoOR1diiXxTVCMAFXw29CuqouKaxRdJ4cd+6drSZfb3HvcdVtHqbXwWJxzx7dvJYdzSWae X-Received: by 2002:a62:29c3:: with SMTP id p186mr3263104pfp.117.1550139929891; Thu, 14 Feb 2019 02:25:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550139929; cv=none; d=google.com; s=arc-20160816; b=FzHsjQxaByCNvTfOs/gfvnkfUapFaBt3Is6+Yn3EwCf1qNSQI/KZxp3jj1CdD/Iz1Q uBZ+tiaGeyam8dYKVCTjCQeMomtB4acx/GxejD2Y+xPMRetvj+eTsokNXVdC/1jKhGx6 bgscvnihE5RmefposqokHQcK+qx5dxUoODicR4kExLPLzkNIDJEQkdtUopPNvz0eDCvB OCKPdHtzUiVFe4UVk4i+HJ4TNKbQQHc/86nARNhD4Ie6zC57Wc1T6ZV4PJcOKUxNHbvF HPuiB6KQgKPk4rPYzWK/4ls81VOy0vJzU3uxdpSndpYaJo3XwVSvHs7vyhIhEyBAuBLD F1SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zIUpPuUxxTvQgisO+grlvI1p+2ynMJHS6/LKOJr5ydE=; b=lOesKCwULnwfWIeYCWaiFynu6MgZ7kWmgvTNh6TMH7+eDDQ4vQocg23/dNhMjQ/5FR Nn5CDVzM3T7xzvw5zAVpGp0zPbyZEkPpi/pwSo+FBe2aIk3DSOjkqUuK7Ajc+d0i3LQv p6fCfspougMZCZ2YKlzdG4bfkSHfTjw694QeQx+AM8SoERVczP87Ug0+fLMDx14xbbl+ +u9aa9oG8uQMowKKgcL4xMVnYH/gHnb2IR2OYmyvu+6XrO5WeDYyZQxQv6HmzD0byX2c 3oHCApkflTzJlHKGU8aVV+MIXjHDh8p3sJTw+gELvW2kDTey5Kl91A4vKIghsFhspGhS DiDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YKu/F/eg"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si2132062plv.258.2019.02.14.02.25.21; Thu, 14 Feb 2019 02:25:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YKu/F/eg"; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390555AbfBNKZV (ORCPT + 15 others); Thu, 14 Feb 2019 05:25:21 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:34124 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389001AbfBNKZV (ORCPT ); Thu, 14 Feb 2019 05:25:21 -0500 Received: by mail-lf1-f65.google.com with SMTP id u21so4155971lfu.1 for ; Thu, 14 Feb 2019 02:25:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zIUpPuUxxTvQgisO+grlvI1p+2ynMJHS6/LKOJr5ydE=; b=YKu/F/egmfYE0/lwjPrU2cukL/qS9YjnwyZK0AKDG37C1+hz4hKxgunSfecRwk1gza YVaajmNvC+eeSgzbZPPqoiBVE/HhlCEeK8lfE6txmbXi9KERlY/W36mdX0zKCUO/Y0t/ //bdAK7pFfpZbcuVs9tAX63SFcHOIYNAofqlaKgKlaocDyW0M7H5Scf4NZi653gA5NY+ eo9Snbed01olLJMBi3Z9EPmNJ4qcExypsbQcs9kNaB0T0N8OfF7P2Afxn783z32WpjGO BRiNapYOsjJMWJbNglH8dU9mYrvhpis/eHvIbYAOkIMim06GS7OGWMKBZ9w3Nj4NlI5u J0Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zIUpPuUxxTvQgisO+grlvI1p+2ynMJHS6/LKOJr5ydE=; b=WDGHLi5n0LjZVh0iwbPI+XH8e1V8vGJ/ZNwyUn59RJs7bGuA+tfIkINjUqeOqlXKid hmPoJ87YFxxxNvw4ZtpX9dFvoFhOslYdc5cghjjDe0FN50Tbtn1iKZ5RQbNKx7pI7E/m BQH6c4H+cUgrw9qd878gBWtY8f/gLykQGLdo2Wzd30KvJSiqWVSWjbS1bwzQM2HPkc3o 4zJ0Rq4s5Cvy4NxE+EZ559xf4DV2JMPbLtXUzHZoVlCq9Jlb818gyHECAJbR7sXQd3ON AOu6r9z++Cl7B3Gj/+XeZA2zC1PnAwRQVJrGIQChDr8SnMKTtZJP/KJcCBwoBinFK6AY H7ZQ== X-Gm-Message-State: AHQUAuYSoe9qBM/dwqfhepkX52sjV3brj+6VRHmdNRDXpwm3n0GiJOsJ XzeYIStAia/uzIvcCwj1lpQTmw== X-Received: by 2002:a19:7410:: with SMTP id v16mr1908275lfe.166.1550139918867; Thu, 14 Feb 2019 02:25:18 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n189sm380392lfn.82.2019.02.14.02.25.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 02:25:17 -0800 (PST) From: Linus Walleij To: Greg Kroah-Hartman , stable@vger.kernel.org, openwrt-devel@lists.openwrt.org Cc: "David S . Miller" , Eric Dumazet , Hauke Mehrtens , Dave Taht , Liping Zhang , John Youn , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , James Hughes , Felix Fietkau , Boris Brezillon , Richard Weinberger Subject: [PATCH 05/10] ubifs: Drop softlimit and delta fields from struct ubifs_wbuf Date: Thu, 14 Feb 2019 11:24:31 +0100 Message-Id: <20190214102436.5092-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190214102436.5092-1-linus.walleij@linaro.org> References: <20190214102436.5092-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Rafał Miłecki Values of these fields are set during init and never modified. They are used (read) in a single function only. There isn't really any reason to keep them in a struct. It only makes struct just a bit bigger without any visible gain. Signed-off-by: Rafał Miłecki Reviewed-by: Boris Brezillon Signed-off-by: Richard Weinberger --- fs/ubifs/io.c | 18 ++++++++++-------- fs/ubifs/ubifs.h | 5 ----- 2 files changed, 10 insertions(+), 13 deletions(-) -- 2.20.1 diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index 97be41215332..4d6ce4a2a4b6 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c @@ -452,16 +452,22 @@ static enum hrtimer_restart wbuf_timer_callback_nolock(struct hrtimer *timer) */ static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf) { + ktime_t softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0); + unsigned long long delta; + + delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT; + delta *= 1000000000ULL; + ubifs_assert(!hrtimer_active(&wbuf->timer)); + ubifs_assert(delta <= ULONG_MAX); if (wbuf->no_timer) return; dbg_io("set timer for jhead %s, %llu-%llu millisecs", dbg_jhead(wbuf->jhead), - div_u64(ktime_to_ns(wbuf->softlimit), USEC_PER_SEC), - div_u64(ktime_to_ns(wbuf->softlimit) + wbuf->delta, - USEC_PER_SEC)); - hrtimer_start_range_ns(&wbuf->timer, wbuf->softlimit, wbuf->delta, + div_u64(ktime_to_ns(softlimit), USEC_PER_SEC), + div_u64(ktime_to_ns(softlimit) + delta, USEC_PER_SEC)); + hrtimer_start_range_ns(&wbuf->timer, softlimit, delta, HRTIMER_MODE_REL); } @@ -1059,10 +1065,6 @@ int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf) hrtimer_init(&wbuf->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); wbuf->timer.function = wbuf_timer_callback_nolock; - wbuf->softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0); - wbuf->delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT; - wbuf->delta *= 1000000000ULL; - ubifs_assert(wbuf->delta <= ULONG_MAX); return 0; } diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 096035eb29d0..ade4b3137a1d 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -645,9 +645,6 @@ typedef int (*ubifs_lpt_scan_callback)(struct ubifs_info *c, * @io_mutex: serializes write-buffer I/O * @lock: serializes @buf, @lnum, @offs, @avail, @used, @next_ino and @inodes * fields - * @softlimit: soft write-buffer timeout interval - * @delta: hard and soft timeouts delta (the timer expire interval is @softlimit - * and @softlimit + @delta) * @timer: write-buffer timer * @no_timer: non-zero if this write-buffer does not have a timer * @need_sync: non-zero if the timer expired and the wbuf needs sync'ing @@ -676,8 +673,6 @@ struct ubifs_wbuf { int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); struct mutex io_mutex; spinlock_t lock; - ktime_t softlimit; - unsigned long long delta; struct hrtimer timer; unsigned int no_timer:1; unsigned int need_sync:1;