1
0

053-0001-ubifs-Drop-softlimit-and-delta-fields-from-struct-ub.patch 3.1 KB

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