linux-bcache.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Kent Overstreet <kmo@daterainc.com>
Cc: linux-bcache@vger.kernel.org
Subject: [PATCH] bcache: let the writeback thread run at least once at startup
Date: Fri, 11 Apr 2014 19:33:25 -0700	[thread overview]
Message-ID: <20140412023325.GD9176@birch.djwong.org> (raw)
In-Reply-To: <20140412023101.GC9176@birch.djwong.org>

Change bch_cached_dev_attach() to always wake up the writeback thread,
because the newly created wb thread remains in uninterruptible sleep
state until something explicitly wakes it up.  This wakeup allows the
thread to call bch_writeback_thread(), whereupon it will most likely
end up in interruptible sleep.  In theory we could just let the first
write take care of this, but there's really no reason not to do the
transition quickly.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 drivers/md/bcache/super.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 24a3a15..3ffe970 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1048,8 +1048,8 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)
 		bch_sectors_dirty_init(dc);
 		atomic_set(&dc->has_dirty, 1);
 		atomic_inc(&dc->count);
-		bch_writeback_queue(dc);
 	}
+	bch_writeback_queue(dc);
 
 	bch_cached_dev_run(dc);
 	bcache_device_link(&dc->disk, c, "bdev");

  reply	other threads:[~2014-04-12  2:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-11  0:26 [PATCH] bcache: fix writeback thread to sleep less intrusively Darrick J. Wong
2014-04-11  0:46 ` Kent Overstreet
2014-04-11  1:41   ` Darrick J. Wong
2014-04-12  2:31     ` Darrick J. Wong
2014-04-12  2:33       ` Darrick J. Wong [this message]
2014-04-30 11:51       ` Daniel Smedegaard Buus
2014-04-30 17:24         ` Darrick J. Wong
2014-05-01  9:38           ` Daniel Smedegaard Buus
2014-05-01 21:54             ` Slava Pestov
2014-05-20  7:07               ` Daniel J Blueman
     [not found]             ` <CACHGV4+mNu_KV7JazT-34D++3S2NKhDkOmc_wo0QfrfdqpccoQ@mail.gmail.com>
2014-07-09 10:27               ` Daniel Smedegaard Buus
2014-07-09 15:53                 ` Peter Kieser
2014-07-09 18:02                   ` Daniel Smedegaard Buus
2014-07-09 18:19                     ` Slava Pestov
2014-07-09 19:18                       ` Daniel Smedegaard Buus
2014-04-11  7:26   ` Francis Moreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140412023325.GD9176@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=kmo@daterainc.com \
    --cc=linux-bcache@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).