From patchwork Thu Feb 14 13:24:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 158388 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1366902jaa; Thu, 14 Feb 2019 05:24:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IaARbzD8OqnoLWzqZZ6s6+9D3TmYGyaH8qyxGkPe6gsLYkK92YOl2gxKHzlXeJA/Ej1X0/I X-Received: by 2002:a62:1303:: with SMTP id b3mr4140009pfj.147.1550150684431; Thu, 14 Feb 2019 05:24:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550150684; cv=none; d=google.com; s=arc-20160816; b=eZk36CQxIHjdRxGk1pxaMzNh0x8cAKgiMQFdFhuPfazXKOaqZgS9a/HCdqSnmFhfYE jdZ3OOK0gXlAhhZBMmtVC80TUvok7ER4L1sk7xLStnQ0Izirwvl3oNJqQVkq3VqNz7pw FJPmbwVZ0MluWRlpFriQR4qZmadzc3Ew8gpR0jjwQB3Q2BeMrKGAEHgaeg3Q5glz6l3G D3apTE11BxTC8aJOPoDmxmTNrmQ2JB/2/45Lfa8qHQnCJ5E8AxrVm42H4T0EGfqxtOnJ 4kHn8sDpUC+FqMYWaBeCDC1/QpowoXxJIoiqrNqMPHofESJLLCfSMSI2XmVUTb4yHfOo 6Ccw== 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=i2YxxveFV+VRScKWCCilYlww+c4OOmrY0aP8ToD73I4=; b=JLDnY3MLfjZ6jecC+zqP5v8v2KzBRhWxWD8tnSl/B+vLwJlN1dgRmnPcIs+dffNE0R 22ctio2pM+XSdI3jeE1dlIaNHOQ3+xvTY2ssdYqMKRANoWvVsppt0M88oRW5mShilM3J b2U7Wik0XZP8WWKPJsPyS4FbtcL0413yArwXH3Eep6Y7pQ4Ypgehfe0Q2OsnrUIzyC3o R5801h0aQV6sBO3DyvFUfoM04T2TUfvW3YLMnaKIdneoNQBPGDrAhv0ZFBfT6I1Dp0gG DDSUTkoHuovbnvbIg0bXJ4V9BOxaBC3ikQWl5ide+MnVXYEn8TFCS1ti1+zJhYJYwCrA A/hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qnqO7Kpq; 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 36si2748782plc.250.2019.02.14.05.24.44; Thu, 14 Feb 2019 05:24:44 -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=qnqO7Kpq; 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 S2438860AbfBNNYn (ORCPT + 15 others); Thu, 14 Feb 2019 08:24:43 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35389 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2436698AbfBNNYn (ORCPT ); Thu, 14 Feb 2019 08:24:43 -0500 Received: by mail-lj1-f194.google.com with SMTP id j13-v6so5235082ljc.2 for ; Thu, 14 Feb 2019 05:24:42 -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=i2YxxveFV+VRScKWCCilYlww+c4OOmrY0aP8ToD73I4=; b=qnqO7KpqDkoF8IqEuT7dDevmpnbASgD+x6K7x+YXNC1yojhEWfnWNW5lTC2QROVDZh jk0JI8zf9ZVvlT6NFij/8ne+BseENME0WccQAQBf8rT8DY7xFw3TgcPlOVKemUYBySMR 6maTyuB2d9FHCFzyBVdZ7Ej44OhM7Llc7QL5AXi7OWMp3rtpHwTTtnVg30bUwYRUaU1G nA7KBlquMdM5vuH8WB6u2JbIbTM6UvaPtKwJZSSwWkpMvG2S4/4o/ghoYJi30ExOyAjh mH60tIEpERKW7Q98j7X4axROUEPdVx36fV1Sk+jAxvAKjhTw6GrfGa4bULfH+OSflkJL 5YPw== 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=i2YxxveFV+VRScKWCCilYlww+c4OOmrY0aP8ToD73I4=; b=Rd+55d4rxF6a7Tmabe3Pv0OAL5iQ0btgdpsIG/TCmIddtoib71TNFLcTrdbcHmvhMf ueOp0CSuTY1sXdcvVptVd0yM84dqhfRCnzlH5naNaaJhB1OFWc2CWEpvH0inFORUo2xT +C+MONU0VsaMm0cTWRBGceL9dh/p/TW6YAStltwF0vKuFrQIZBRcmz2GW4UF7QDipPSl qehhDOkZ5sr4syisUxlCu9d2sZ2IGJb7asnqfApxsyOhB5XKQNMHE/tQ6WBml8iWAHte V7ptrRqfxp4ROxt0d5NWGrw2tZLSnDHONJ+vukMUNTEXtQbzhc5ro/b/E5w/xG6ht5Fc 2jZA== X-Gm-Message-State: AHQUAubuaYSEuFxf/BHo8zn4Gg0cmBGb3+9fk3RH3wlKm+d6F9ZYmjjb U4du8Ibt2JSFbwvg2KXeJPbFMQ== X-Received: by 2002:a2e:81c7:: with SMTP id s7mr1129450ljg.146.1550150681348; Thu, 14 Feb 2019 05:24:41 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id k13-v6sm427752ljg.84.2019.02.14.05.24.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 05:24:40 -0800 (PST) From: Linus Walleij To: Greg Kroah-Hartman , stable@vger.kernel.org, openwrt-devel@lists.openwrt.org Cc: "David S . Miller" , Eric Dumazet , Liping Zhang , John Youn , =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= , James Hughes , Felix Fietkau , Boris Brezillon , Richard Weinberger , Linus Walleij Subject: [PATCH 5/8 v3] ubifs: Drop softlimit and delta fields from struct ubifs_wbuf Date: Thu, 14 Feb 2019 14:24:00 +0100 Message-Id: <20190214132403.10687-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190214132403.10687-1-linus.walleij@linaro.org> References: <20190214132403.10687-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 commit 854826c9d526fd81077742c3b000e3f7fcaef3ce upstream. 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 Signed-off-by: Linus Walleij --- - This was applied upstream in v4.10 - Should be applied to stable v4.9.y --- 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;