summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/io.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-06-23 11:30:43 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-07-05 17:45:16 +0200
commit0b335b9d7d5f0b832e90ac469480789c07be80ad (patch)
tree5001522f18092e1cafb538a74eedae3087c17145 /fs/ubifs/io.c
parentUBIFS: improve debugging messaged (diff)
downloadlinux-0b335b9d7d5f0b832e90ac469480789c07be80ad.tar.xz
linux-0b335b9d7d5f0b832e90ac469480789c07be80ad.zip
UBIFS: slightly optimize write-buffer timer usage
This patch adds the following minor optimization: 1. If write-buffer does not use the timer, indicate it with the wbuf->no_timer variable, instead of using the wbuf->softlimit variable. This is better because wbuf->softlimit is of ktime_t type, and the ktime_to_ns function contains 64-bit multiplication. 2. Do not call the 'hrtimer_cancel()' function for write-buffers which do not use timers. 3. Do not cancel the timer in 'ubifs_put_super()' because the synchronization function does this. This patch also removes a confusing comment. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/io.c')
-rw-r--r--fs/ubifs/io.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 2ef689a9a363..9fcf6c38c1bc 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -312,7 +312,7 @@ static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf)
{
ubifs_assert(!hrtimer_active(&wbuf->timer));
- if (!ktime_to_ns(wbuf->softlimit))
+ if (wbuf->no_timer)
return;
dbg_io("set timer for jhead %d, %llu-%llu millisecs", wbuf->jhead,
ktime_to_ns(wbuf->softlimit)/USEC_PER_SEC,
@@ -327,11 +327,8 @@ static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf)
*/
static void cancel_wbuf_timer_nolock(struct ubifs_wbuf *wbuf)
{
- /*
- * If the syncer is waiting for the lock (from the background thread's
- * context) and another task is changing write-buffer then the syncing
- * should be canceled.
- */
+ if (wbuf->no_timer)
+ return;
wbuf->need_sync = 0;
hrtimer_cancel(&wbuf->timer);
}