summaryrefslogtreecommitdiff
path: root/drivers/md/bcache/util.h
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-09-24 10:17:31 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-09-25 01:41:43 +0400
commitc2a4f3183a1248f615a695fbd8905da55ad11bba (patch)
tree51233866301869506c0728c812fe3668ae1e94ce /drivers/md/bcache/util.h
parent61cbd250f867f98bb4738000afc6002d6f2b14bd (diff)
downloadlinux-c2a4f3183a1248f615a695fbd8905da55ad11bba.tar.xz
bcache: Fix a writeback performance regression
Background writeback works by scanning the btree for dirty data and adding those keys into a fixed size buffer, then for each dirty key in the keybuf writing it to the backing device. When read_dirty() finishes and it's time to scan for more dirty data, we need to wait for the outstanding writeback IO to finish - they still take up slots in the keybuf (so that foreground writes can check for them to avoid races) - without that wait, we'll continually rescan when we'll be able to add at most a key or two to the keybuf, and that takes locks that starves foreground IO. Doh. Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: linux-stable <stable@vger.kernel.org> # >= v3.10 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/md/bcache/util.h')
-rw-r--r--drivers/md/bcache/util.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h
index 1ae2a73ad85f..ea345c6896f4 100644
--- a/drivers/md/bcache/util.h
+++ b/drivers/md/bcache/util.h
@@ -450,17 +450,23 @@ read_attribute(name ## _last_ ## frequency_units)
(ewma) >> factor; \
})
-struct ratelimit {
+struct bch_ratelimit {
+ /* Next time we want to do some work, in nanoseconds */
uint64_t next;
+
+ /*
+ * Rate at which we want to do work, in units per nanosecond
+ * The units here correspond to the units passed to bch_next_delay()
+ */
unsigned rate;
};
-static inline void ratelimit_reset(struct ratelimit *d)
+static inline void bch_ratelimit_reset(struct bch_ratelimit *d)
{
d->next = local_clock();
}
-unsigned bch_next_delay(struct ratelimit *d, uint64_t done);
+uint64_t bch_next_delay(struct bch_ratelimit *d, uint64_t done);
#define __DIV_SAFE(n, d, zero) \
({ \