From patchwork Thu Feb 14 12:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 158361 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1324400jaa; Thu, 14 Feb 2019 04:49:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IZNRsjWWeosXWd/aNsw5xAd0oxE1iFn/r/yAmm719e/1nvGjG94Za4243vKOpKJ4Hc3JXE2 X-Received: by 2002:a63:d703:: with SMTP id d3mr3655997pgg.167.1550148591324; Thu, 14 Feb 2019 04:49:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550148591; cv=none; d=google.com; s=arc-20160816; b=nlpRH6lNDRrA8MUqDppzLJ0/NdRunvQkaTGklZrWPyEt1dZrvdR7fa9fNx2eAsdhDs NggykJJd70O/yFZ9QKNYijQlx4d7t/La9G7NMGsRcEtTkqt5PNE7a7/60e8djW53Q5Q9 AvgF9VrHCkpOi7qNl3lySCLLAIBcaCJrNZiIQuqNWIR855eLyruYWladtDKL0mKcQAxa 5lXHjvEX71Fhqrsz+EZrgUwSEFhpupMtaXTg89hqg/XSB51aYAUK5RfurCBL8EBlvJgv AZczm6HRS7EaKUM2ENvXXMGg/FVedCQrbGzYQnpPfGUwfTSJIOTeJvOnGQVI229szVnC PtdA== 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=czvD/5aRHbfC6FnZcru5EiNTfQ62VgX0N26NRRFAiM0=; b=QuFpsfhrUE3vZW4VuKtKl/x2Yj5PyKPPdCbhMwIBec2QD1zX3G6QzTtVphCxM5QJ+7 bstvY2ffK3Gexd4Y16J9vhRxQi8n/VV8P7M0GpMB40t/Vu2nQzlrRShItVSBbXd2btei g4EqCLhKooPyNjlN3gWoNTq6BLaRE70dWfABXTymML0uvzo+/WUZFah1VX8QKcZ22Dzz Tnfvq42nQwmC0OBnmwVlTQVR/ho8RDzcANXuZeY/OYwdGnZL+Kcs4iQFIYX4UofFmQ+3 ipL2fsInMWUjagDRaUvG/6YQ1So2oSImMJzFELHvoQocQvPr8YuXlZoGdXBzpLqptZD4 yHVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ip4ZCXtZ; 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 g26si2310745pfi.184.2019.02.14.04.49.51; Thu, 14 Feb 2019 04:49:51 -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=Ip4ZCXtZ; 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 S2438103AbfBNMtu (ORCPT + 15 others); Thu, 14 Feb 2019 07:49:50 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:36673 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438534AbfBNMtu (ORCPT ); Thu, 14 Feb 2019 07:49:50 -0500 Received: by mail-lf1-f65.google.com with SMTP id q11so4456858lfd.3 for ; Thu, 14 Feb 2019 04:49:49 -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=czvD/5aRHbfC6FnZcru5EiNTfQ62VgX0N26NRRFAiM0=; b=Ip4ZCXtZ0G9QmjxnJVxYftsWGax1/HZ/PQLLWZtYjRdOLgmC42eV+BogakBIxhCCa3 QcfFbDUe5pILB0jNph7wxmomu0HNxuVZ9w67s92oFXhzQYSY5CYaLjp5W+PC6V+Uv+x5 PB6C+fg3Tj3Eoue8Pp59CQ0dQCfq9YyQicioLsjsORxr/lhBz6ngP26MaM+EgVfR/XX1 nmqWH5nD3s4LC9mcqmTOC5mFSlgTkdUN5pr7O2i+obEhaypaWQwXdy5rBOVCCEiPVoDq 5Xg0/oi7FP0zQi4nmhchPPkMUfQvCeovqiAFG1kamUtfs4zlIook/kzUhBZe5DszNdgi vE/Q== 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=czvD/5aRHbfC6FnZcru5EiNTfQ62VgX0N26NRRFAiM0=; b=l+DISM+cGJZNBauV6mjAzRlNcl0Qjcu78b1P/eucy5KiXGJT4V0mmJ+MfgUuTyPpRp lXDiHOugybo64CMn8BTCjlk6Yda8ef8JftdmexWjjmx81BbEA5CVs+l+DmMxSP3HepTL BOcKWIdVwIA43C992AAodVQstpGvUDG3hMfxXVT9iPIFocg0FnRccDfDQFhhv0U58a2K CxsmxgzI5cmSdbXOfX8pKONQOpmrWbPYkznizk2yU3/3BwtOtKs442hZilpE8pQeh6xx iezAbOH3H7EiGdsMBfpMylyCtHcBr9E+c861IHC4gJIEFW5wV4ddROj3Nkj8fVaCjOX9 EArQ== X-Gm-Message-State: AHQUAuYj6hsxe7ghw1JIgK+yAm2u/F0WrY0G/ilGm0BU5Z7OnBFJmAVQ M3lYk+UU30UoPUyt4N3DLdICqQ== X-Received: by 2002:a19:9dd1:: with SMTP id g200mr2222500lfe.127.1550148588287; Thu, 14 Feb 2019 04:49:48 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id r7-v6sm410853ljg.85.2019.02.14.04.49.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Feb 2019 04:49:47 -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 Subject: [PATCH 5/8 v2] ubifs: Drop softlimit and delta fields from struct ubifs_wbuf Date: Thu, 14 Feb 2019 13:49:07 +0100 Message-Id: <20190214124910.1753-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190214124910.1753-1-linus.walleij@linaro.org> References: <20190214124910.1753-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 --- - 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;