diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-12-10 19:10:46 -0500 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-01-08 16:05:07 -0500 |
commit | 5775e2133dfa0dc1f4c7f233e2144d32cb516f54 (patch) | |
tree | 0551435b581a0edf3cc0c17a85eb98962252374c /drivers/md | |
parent | b3fa7e77e67e647db3db2166b65083a427d84ed3 (diff) |
bcache: Performance fix for when journal entry is full
We were unnecessarily waiting on a journal write to complete when we just needed
to start a journal write and start setting up the next one.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/bcache/journal.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 29cccc510eb6..ad687285c2df 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c | |||
@@ -673,6 +673,7 @@ static struct journal_write *journal_wait_for_write(struct cache_set *c, | |||
673 | { | 673 | { |
674 | size_t sectors; | 674 | size_t sectors; |
675 | struct closure cl; | 675 | struct closure cl; |
676 | bool wait = false; | ||
676 | 677 | ||
677 | closure_init_stack(&cl); | 678 | closure_init_stack(&cl); |
678 | 679 | ||
@@ -689,9 +690,12 @@ static struct journal_write *journal_wait_for_write(struct cache_set *c, | |||
689 | PAGE_SECTORS << JSET_BITS)) | 690 | PAGE_SECTORS << JSET_BITS)) |
690 | return w; | 691 | return w; |
691 | 692 | ||
692 | /* XXX: tracepoint */ | 693 | if (wait) |
694 | closure_wait(&c->journal.wait, &cl); | ||
695 | |||
693 | if (!journal_full(&c->journal)) { | 696 | if (!journal_full(&c->journal)) { |
694 | trace_bcache_journal_entry_full(c); | 697 | if (wait) |
698 | trace_bcache_journal_entry_full(c); | ||
695 | 699 | ||
696 | /* | 700 | /* |
697 | * XXX: If we were inserting so many keys that they | 701 | * XXX: If we were inserting so many keys that they |
@@ -701,12 +705,11 @@ static struct journal_write *journal_wait_for_write(struct cache_set *c, | |||
701 | */ | 705 | */ |
702 | BUG_ON(!w->data->keys); | 706 | BUG_ON(!w->data->keys); |
703 | 707 | ||
704 | closure_wait(&w->wait, &cl); | ||
705 | journal_try_write(c); /* unlocks */ | 708 | journal_try_write(c); /* unlocks */ |
706 | } else { | 709 | } else { |
707 | trace_bcache_journal_full(c); | 710 | if (wait) |
711 | trace_bcache_journal_full(c); | ||
708 | 712 | ||
709 | closure_wait(&c->journal.wait, &cl); | ||
710 | journal_reclaim(c); | 713 | journal_reclaim(c); |
711 | spin_unlock(&c->journal.lock); | 714 | spin_unlock(&c->journal.lock); |
712 | 715 | ||
@@ -715,6 +718,7 @@ static struct journal_write *journal_wait_for_write(struct cache_set *c, | |||
715 | 718 | ||
716 | closure_sync(&cl); | 719 | closure_sync(&cl); |
717 | spin_lock(&c->journal.lock); | 720 | spin_lock(&c->journal.lock); |
721 | wait = true; | ||
718 | } | 722 | } |
719 | } | 723 | } |
720 | 724 | ||