Commit d56d000a authored by Kent Overstreet's avatar Kent Overstreet

bcache: Don't touch bucket gen for dirty ptrs

Unnecessary since a bucket that has dirty pointers pointing to it can
never be invalidated - and skipping it is a measurable performance
boost, since the bucket gen will usually be a cache miss.
Signed-off-by: default avatarKent Overstreet <kmo@daterainc.com>
parent b0f32a56
...@@ -176,10 +176,14 @@ bool bch_ptr_bad(struct btree *b, const struct bkey *k) ...@@ -176,10 +176,14 @@ bool bch_ptr_bad(struct btree *b, const struct bkey *k)
bch_ptr_invalid(b, k)) bch_ptr_invalid(b, k))
return true; return true;
for (i = 0; i < KEY_PTRS(k); i++) { for (i = 0; i < KEY_PTRS(k); i++)
if (!ptr_available(b->c, k, i)) if (!ptr_available(b->c, k, i))
return true; return true;
if (!expensive_debug_checks(b->c) && KEY_DIRTY(k))
return false;
for (i = 0; i < KEY_PTRS(k); i++) {
g = PTR_BUCKET(b->c, k, i); g = PTR_BUCKET(b->c, k, i);
stale = ptr_stale(b->c, k, i); stale = ptr_stale(b->c, k, i);
......
...@@ -630,7 +630,8 @@ static void bch_cache_read_endio(struct bio *bio, int error) ...@@ -630,7 +630,8 @@ static void bch_cache_read_endio(struct bio *bio, int error)
if (error) if (error)
s->iop.error = error; s->iop.error = error;
else if (ptr_stale(s->iop.c, &b->key, 0)) { else if (!KEY_DIRTY(&b->key) &&
ptr_stale(s->iop.c, &b->key, 0)) {
atomic_long_inc(&s->iop.c->cache_read_races); atomic_long_inc(&s->iop.c->cache_read_races);
s->iop.error = -EINTR; s->iop.error = -EINTR;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment