From patchwork Wed Sep 7 17:11:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 667102 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sTqpv23nHz9s3s for ; Thu, 8 Sep 2016 03:15:19 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=CxJe3XXP; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhgPN-0001mH-2l; Wed, 07 Sep 2016 17:13:09 +0000 Received: from mail-lf0-x244.google.com ([2a00:1450:4010:c07::244]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bhgOm-0001Z3-QH for lede-dev@lists.infradead.org; Wed, 07 Sep 2016 17:12:36 +0000 Received: by mail-lf0-x244.google.com with SMTP id s64so58471lfs.2 for ; Wed, 07 Sep 2016 10:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6B7lWfOFtU4zTyNRx+HSwwqfxqm0jkiHgYZ2fMeOTPg=; b=CxJe3XXPqZd9HvgsLN5DjyY6wP6i4c3kWtBMwaeNyST8nb5SUcUzAMC3XHjdA4WK9Y C33LTp1SwK+0gQO2zJCokSTLrCIS4Ux9xsaRm/S0KeEOC/HlqibKbFr4WNKJmlA71mU/ 9hp5AAdebSZ7+yeFM/kfEsCupoqg+mq/yoU9FtLGgyT5VL6A3rfi29mEO9ic+41k3gYD CYnAXfC6znamH418ioXW8r21B/XYUlq0ea5t7bMMVhNXFtmY08y32lrmVJS1sVbm6GzB 9Aa35Syrr02KPC6yRc7x5P3xuRBQoOz3P8DVxuIyav/sPvk8oBJl58jy1j36vlm2w9dL G4qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6B7lWfOFtU4zTyNRx+HSwwqfxqm0jkiHgYZ2fMeOTPg=; b=QkZ8uhC/A7e/7B9Yww8Ob8bizLqcise4r9G+7PxWH46pszwjEPKlnXSw2Z/RR5sM0N /syH581omfUEAhnCpzeCESD2kjLbSZBCbhHv6rCWM3zUuhPAMBlNvua9NHB7oWS8xQVO uSTcKgi0psCN/PuzWTMPsnxwkNxBjaq1/5lnaKHmOqUILAznLZGrN5Vuaw86NiYVpUXl pHDaSNWK+eERu4AMAfHXmcBqwBUgulW2Nb5AHs0TS70RWCduj5inNcYLVnhIoyCHPGx/ H4Diure9//22TYGMpqbOJr025+glvBVxtFVyQUc1BbS8ZGsKnEae97oqxqqagug/1fTs pLNQ== X-Gm-Message-State: AE9vXwN+JjpfCJEhzkfMvuF3h/opfRt7HV2MFFc0wSDCrBom7Yhy7+Q4kZu+ZUQuSohocA== X-Received: by 10.25.26.194 with SMTP id a185mr322916lfa.167.1473268334119; Wed, 07 Sep 2016 10:12:14 -0700 (PDT) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id s187sm173363lfd.3.2016.09.07.10.12.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Sep 2016 10:12:13 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: lede-dev@lists.infradead.org Date: Wed, 7 Sep 2016 19:11:55 +0200 Message-Id: <20160907171155.5336-3-zajec5@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160907171155.5336-1-zajec5@gmail.com> References: <20160907171155.5336-1-zajec5@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160907_101233_133217_5DA5F8AF X-CRM114-Status: GOOD ( 12.03 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:4010:c07:0:0:0:244 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (zajec5[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (zajec5[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid Subject: [LEDE-DEV] [RFC 2/2] ubifs: use dirty_writeback_interval value for wbuf timer X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Rafał Miłecki Right now wbuf timer has hardcoded timeouts and there is no place for manual adjustments. Some projects / cases many need that though. Few file systems allow doing that by respecting dirty_writeback_interval that can be set using sysctl (dirty_writeback_centisecs). Lowering dirty_writeback_interval could be some way of dealing with user space apps lacking proper fsyncs. This is definitely *not* a perfect solution but we don't have ideal (user space) world. There were already advanced discussions on this matter, mostly when ext4 was introduced and it wasn't behaving as ext3. Anyway, the final decision was to add some hacks to the ext4, as trying to fix whole user space or adding new API was pointless. We can't (and shouldn't?) just follow ext4. We can't e.g. sync on close as this would cause too many commits and flash wearing. On the other hand we still should allow some trade-off between -o sync and default wbuf timeout. Respecting dirty_writeback_interval should allow some sane cutomizations if used warily. Signed-off-by: Rafał Miłecki --- fs/ubifs/io.c | 7 ++----- fs/ubifs/ubifs.h | 4 ---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index 4d6ce4a..aced6ee 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c @@ -452,11 +452,8 @@ 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; + ktime_t softlimit = ms_to_ktime(dirty_writeback_interval * 10); + unsigned long long delta = dirty_writeback_interval; /* 10% delta */ ubifs_assert(!hrtimer_active(&wbuf->timer)); ubifs_assert(delta <= ULONG_MAX); diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 11bc8fa..26e6340 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -83,10 +83,6 @@ */ #define BGT_NAME_PATTERN "ubifs_bgt%d_%d" -/* Write-buffer synchronization timeout interval in seconds */ -#define WBUF_TIMEOUT_SOFTLIMIT 3 -#define WBUF_TIMEOUT_HARDLIMIT 5 - /* Maximum possible inode number (only 32-bit inodes are supported now) */ #define MAX_INUM 0xFFFFFFFF