1 From 854826c9d526fd81077742c3b000e3f7fcaef3ce Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Tue, 20 Sep 2016 10:36:14 +0200
4 Subject: [PATCH] ubifs: Drop softlimit and delta fields from struct ubifs_wbuf
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Values of these fields are set during init and never modified. They are
10 used (read) in a single function only. There isn't really any reason to
11 keep them in a struct. It only makes struct just a bit bigger without
14 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
15 Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
16 Signed-off-by: Richard Weinberger <richard@nod.at>
18 fs/ubifs/io.c | 18 ++++++++++--------
19 fs/ubifs/ubifs.h | 5 -----
20 2 files changed, 10 insertions(+), 13 deletions(-)
24 @@ -452,16 +452,22 @@ static enum hrtimer_restart wbuf_timer_c
26 static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf)
28 + ktime_t softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0);
29 + unsigned long long delta;
31 + delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT;
32 + delta *= 1000000000ULL;
34 ubifs_assert(!hrtimer_active(&wbuf->timer));
35 + ubifs_assert(delta <= ULONG_MAX);
39 dbg_io("set timer for jhead %s, %llu-%llu millisecs",
40 dbg_jhead(wbuf->jhead),
41 - div_u64(ktime_to_ns(wbuf->softlimit), USEC_PER_SEC),
42 - div_u64(ktime_to_ns(wbuf->softlimit) + wbuf->delta,
44 - hrtimer_start_range_ns(&wbuf->timer, wbuf->softlimit, wbuf->delta,
45 + div_u64(ktime_to_ns(softlimit), USEC_PER_SEC),
46 + div_u64(ktime_to_ns(softlimit) + delta, USEC_PER_SEC));
47 + hrtimer_start_range_ns(&wbuf->timer, softlimit, delta,
51 @@ -1059,10 +1065,6 @@ int ubifs_wbuf_init(struct ubifs_info *c
53 hrtimer_init(&wbuf->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
54 wbuf->timer.function = wbuf_timer_callback_nolock;
55 - wbuf->softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0);
56 - wbuf->delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT;
57 - wbuf->delta *= 1000000000ULL;
58 - ubifs_assert(wbuf->delta <= ULONG_MAX);
62 --- a/fs/ubifs/ubifs.h
63 +++ b/fs/ubifs/ubifs.h
64 @@ -668,9 +668,6 @@ typedef int (*ubifs_lpt_scan_callback)(s
65 * @io_mutex: serializes write-buffer I/O
66 * @lock: serializes @buf, @lnum, @offs, @avail, @used, @next_ino and @inodes
68 - * @softlimit: soft write-buffer timeout interval
69 - * @delta: hard and soft timeouts delta (the timer expire interval is @softlimit
70 - * and @softlimit + @delta)
71 * @timer: write-buffer timer
72 * @no_timer: non-zero if this write-buffer does not have a timer
73 * @need_sync: non-zero if the timer expired and the wbuf needs sync'ing
74 @@ -699,8 +696,6 @@ struct ubifs_wbuf {
75 int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad);
76 struct mutex io_mutex;
79 - unsigned long long delta;
81 unsigned int no_timer:1;
82 unsigned int need_sync:1;