* [PATCH 02/15] bcache: trace missed reading by cache_missed
[not found] <20181008124121.20192-1-colyli@suse.de>
@ 2018-10-08 12:41 ` Coly Li
2018-10-08 12:41 ` [PATCH 04/15] bcache: fix ioctl in flash device Coly Li
` (2 subsequent siblings)
3 siblings, 0 replies; 4+ messages in thread
From: Coly Li @ 2018-10-08 12:41 UTC (permalink / raw)
To: axboe; +Cc: linux-bcache, linux-block, Tang Junhui, stable, Coly Li
From: Tang Junhui <tang.junhui.linux@gmail.com>
Missed reading IOs are identified by s->cache_missed, not the
s->cache_miss, so in trace_bcache_read() using trace_bcache_read
to identify whether the IO is missed or not.
Signed-off-by: Tang Junhui <tang.junhui.linux@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Coly Li <colyli@suse.de>
---
drivers/md/bcache/request.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 51be355a3309..4946d486f734 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -850,7 +850,7 @@ static void cached_dev_read_done_bh(struct closure *cl)
bch_mark_cache_accounting(s->iop.c, s->d,
!s->cache_missed, s->iop.bypass);
- trace_bcache_read(s->orig_bio, !s->cache_miss, s->iop.bypass);
+ trace_bcache_read(s->orig_bio, !s->cache_missed, s->iop.bypass);
if (s->iop.status)
continue_at_nobarrier(cl, cached_dev_read_error, bcache_wq);
--
2.19.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 04/15] bcache: fix ioctl in flash device
[not found] <20181008124121.20192-1-colyli@suse.de>
2018-10-08 12:41 ` [PATCH 02/15] bcache: trace missed reading by cache_missed Coly Li
@ 2018-10-08 12:41 ` Coly Li
2018-10-08 12:41 ` [PATCH 06/15] bcache: correct dirty data statistics Coly Li
2018-10-08 12:41 ` [PATCH 08/15] bcache: fix miss key refill->end in writeback Coly Li
3 siblings, 0 replies; 4+ messages in thread
From: Coly Li @ 2018-10-08 12:41 UTC (permalink / raw)
To: axboe; +Cc: linux-bcache, linux-block, Tang Junhui, stable, Coly Li
From: Tang Junhui <tang.junhui.linux@gmail.com>
When doing ioctl in flash device, it will call ioctl_dev() in super.c,
then we should not to get cached device since flash only device has
no backend device. This patch just move the jugement dc->io_disable
to cached_dev_ioctl() to make ioctl in flash device correctly.
Fixes: 0f0709e6bfc3c ("bcache: stop bcache device when backing device is offline")
Signed-off-by: Tang Junhui <tang.junhui.linux@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Coly Li <colyli@suse.de>
---
drivers/md/bcache/request.c | 3 +++
drivers/md/bcache/super.c | 4 ----
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index ee15fb039fd0..3bf35914bb57 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1218,6 +1218,9 @@ static int cached_dev_ioctl(struct bcache_device *d, fmode_t mode,
{
struct cached_dev *dc = container_of(d, struct cached_dev, disk);
+ if (dc->io_disable)
+ return -EIO;
+
return __blkdev_driver_ioctl(dc->bdev, mode, cmd, arg);
}
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 448e531e8c2d..a99af19d2f91 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -647,10 +647,6 @@ static int ioctl_dev(struct block_device *b, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
struct bcache_device *d = b->bd_disk->private_data;
- struct cached_dev *dc = container_of(d, struct cached_dev, disk);
-
- if (dc->io_disable)
- return -EIO;
return d->ioctl(d, mode, cmd, arg);
}
--
2.19.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 06/15] bcache: correct dirty data statistics
[not found] <20181008124121.20192-1-colyli@suse.de>
2018-10-08 12:41 ` [PATCH 02/15] bcache: trace missed reading by cache_missed Coly Li
2018-10-08 12:41 ` [PATCH 04/15] bcache: fix ioctl in flash device Coly Li
@ 2018-10-08 12:41 ` Coly Li
2018-10-08 12:41 ` [PATCH 08/15] bcache: fix miss key refill->end in writeback Coly Li
3 siblings, 0 replies; 4+ messages in thread
From: Coly Li @ 2018-10-08 12:41 UTC (permalink / raw)
To: axboe; +Cc: linux-bcache, linux-block, Tang Junhui, stable, Coly Li
From: Tang Junhui <tang.junhui.linux@gmail.com>
When bcache device is clean, dirty keys may still exist after
journal replay, so we need to count these dirty keys even
device in clean status, otherwise after writeback, the amount
of dirty data would be incorrect.
Signed-off-by: Tang Junhui <tang.junhui.linux@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Coly Li <colyli@suse.de>
---
drivers/md/bcache/super.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index a99af19d2f91..4989c7d4d4d0 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1152,11 +1152,12 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
}
if (BDEV_STATE(&dc->sb) == BDEV_STATE_DIRTY) {
- bch_sectors_dirty_init(&dc->disk);
atomic_set(&dc->has_dirty, 1);
bch_writeback_queue(dc);
}
+ bch_sectors_dirty_init(&dc->disk);
+
bch_cached_dev_run(dc);
bcache_device_link(&dc->disk, c, "bdev");
atomic_inc(&c->attached_dev_nr);
--
2.19.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 08/15] bcache: fix miss key refill->end in writeback
[not found] <20181008124121.20192-1-colyli@suse.de>
` (2 preceding siblings ...)
2018-10-08 12:41 ` [PATCH 06/15] bcache: correct dirty data statistics Coly Li
@ 2018-10-08 12:41 ` Coly Li
3 siblings, 0 replies; 4+ messages in thread
From: Coly Li @ 2018-10-08 12:41 UTC (permalink / raw)
To: axboe; +Cc: linux-bcache, linux-block, Tang Junhui, stable, Coly Li
From: Tang Junhui <tang.junhui.linux@gmail.com>
refill->end record the last key of writeback, for example, at the first
time, keys (1,128K) to (1,1024K) are flush to the backend device, but
the end key (1,1024K) is not included, since the bellow code:
if (bkey_cmp(k, refill->end) >= 0) {
ret = MAP_DONE;
goto out;
}
And in the next time when we refill writeback keybuf again, we searched
key start from (1,1024K), and got a key bigger than it, so the key
(1,1024K) missed.
This patch modify the above code, and let the end key to be included to
the writeback key buffer.
Signed-off-by: Tang Junhui <tang.junhui.linux@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Coly Li <colyli@suse.de>
---
drivers/md/bcache/btree.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index e7d4817681f2..3f4211b5cd33 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -2434,7 +2434,7 @@ static int refill_keybuf_fn(struct btree_op *op, struct btree *b,
struct keybuf *buf = refill->buf;
int ret = MAP_CONTINUE;
- if (bkey_cmp(k, refill->end) >= 0) {
+ if (bkey_cmp(k, refill->end) > 0) {
ret = MAP_DONE;
goto out;
}
--
2.19.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-08 12:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20181008124121.20192-1-colyli@suse.de>
2018-10-08 12:41 ` [PATCH 02/15] bcache: trace missed reading by cache_missed Coly Li
2018-10-08 12:41 ` [PATCH 04/15] bcache: fix ioctl in flash device Coly Li
2018-10-08 12:41 ` [PATCH 06/15] bcache: correct dirty data statistics Coly Li
2018-10-08 12:41 ` [PATCH 08/15] bcache: fix miss key refill->end in writeback Coly Li
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).