diff options
author | Coly Li <colyli@suse.de> | 2019-12-22 15:34:53 +0800 |
---|---|---|
committer | Coly Li <colyli@suse.de> | 2019-12-22 15:34:53 +0800 |
commit | d927b0c9786ec8ed367f71b1d9cd387fba70a170 (patch) | |
tree | a033d5318723953ad532eb9ed5483eb77c2d2225 | |
parent | 12468a773fbe6b27ec70007ed33fd08a8d7df42b (diff) | |
download | bcache-patches-d927b0c9786ec8ed367f71b1d9cd387fba70a170.tar.gz |
for-next: add patches for 5.6
12 files changed, 36 insertions, 103 deletions
diff --git a/for-test/0001-bcache-add-code-comments-for-state-pool-in-__btree_s.patch b/for-next/0001-bcache-add-code-comments-for-state-pool-in-__btree_s.patch index 326ff0b..326ff0b 100644 --- a/for-test/0001-bcache-add-code-comments-for-state-pool-in-__btree_s.patch +++ b/for-next/0001-bcache-add-code-comments-for-state-pool-in-__btree_s.patch diff --git a/for-test/0001-bcache-avoid-unnecessary-btree-nodes-flushing-in-btr.patch b/for-next/0001-bcache-avoid-unnecessary-btree-nodes-flushing-in-btr.patch index d115875..d115875 100644 --- a/for-test/0001-bcache-avoid-unnecessary-btree-nodes-flushing-in-btr.patch +++ b/for-next/0001-bcache-avoid-unnecessary-btree-nodes-flushing-in-btr.patch diff --git a/for-next/0001-bcache-cached_dev_free-needs-to-put-the-sb-page.patch b/for-next/0001-bcache-cached_dev_free-needs-to-put-the-sb-page.patch index 70e1186..e8f27ea 100644 --- a/for-next/0001-bcache-cached_dev_free-needs-to-put-the-sb-page.patch +++ b/for-next/0001-bcache-cached_dev_free-needs-to-put-the-sb-page.patch @@ -1,6 +1,6 @@ -From f7976d4de8b95d80dfb7fddb1d99068411c71e35 Mon Sep 17 00:00:00 2001 +From ed73d444da14619638cd728ebcfa61830d4f81b1 Mon Sep 17 00:00:00 2001 From: Liang Chen <liangchen.linux@gmail.com> -Date: Mon, 9 Dec 2019 10:38:23 +0100 +Date: Thu, 12 Dec 2019 16:35:58 +0100 Subject: [PATCH 1/7] bcache: cached_dev_free needs to put the sb page Same as cache device, the buffer page needs to be put while @@ -9,6 +9,7 @@ time a cached_dev is stopped. Signed-off-by: Liang Chen <liangchen.linux@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de> +Signed-off-by: Coly Li <colyli@suse.de> --- drivers/md/bcache/super.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/for-test/0001-bcache-enable-zoned-device-support.patch b/for-next/0001-bcache-enable-zoned-device-support.patch index 34b22b6..34b22b6 100644 --- a/for-test/0001-bcache-enable-zoned-device-support.patch +++ b/for-next/0001-bcache-enable-zoned-device-support.patch diff --git a/for-test/0001-bcache-print-written-and-keys-in-trace_bcache_btree_.patch b/for-next/0001-bcache-print-written-and-keys-in-trace_bcache_btree_.patch index 5ccc157..5ccc157 100644 --- a/for-test/0001-bcache-print-written-and-keys-in-trace_bcache_btree_.patch +++ b/for-next/0001-bcache-print-written-and-keys-in-trace_bcache_btree_.patch diff --git a/for-next/0002-bcache-use-a-separate-data-structure-for-the-on-disk.patch b/for-next/0002-bcache-use-a-separate-data-structure-for-the-on-disk.patch index 76ce702..2ae1065 100644 --- a/for-next/0002-bcache-use-a-separate-data-structure-for-the-on-disk.patch +++ b/for-next/0002-bcache-use-a-separate-data-structure-for-the-on-disk.patch @@ -1,6 +1,6 @@ -From cc23d20ae96439e5f75cb0650ee14a5b313deb01 Mon Sep 17 00:00:00 2001 +From f52d2ae24d2f6f8c22c00b6104b5843d9eca3957 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@lst.de> -Date: Mon, 9 Dec 2019 10:38:24 +0100 +Date: Thu, 12 Dec 2019 16:35:59 +0100 Subject: [PATCH 2/7] bcache: use a separate data structure for the on-disk super block @@ -9,6 +9,7 @@ annotations. This fixes a fair chunk of sparse warnings, but there are some left due to the way the checksum is defined. Signed-off-by: Christoph Hellwig <hch@lst.de> +Signed-off-by: Coly Li <colyli@suse.de> --- drivers/md/bcache/super.c | 6 +++--- include/uapi/linux/bcache.h | 51 +++++++++++++++++++++++++++++++++++++++++++++ diff --git a/for-next/0003-bcache-rework-error-unwinding-in-register_bcache.patch b/for-next/0003-bcache-rework-error-unwinding-in-register_bcache.patch index 8085643..ed1ca1d 100644 --- a/for-next/0003-bcache-rework-error-unwinding-in-register_bcache.patch +++ b/for-next/0003-bcache-rework-error-unwinding-in-register_bcache.patch @@ -1,6 +1,6 @@ -From 4d6d1e1da24581aacfbb8addba1a951ada520e05 Mon Sep 17 00:00:00 2001 +From 10f0ce41e1e3b0286a7878cdb4d15a393d15a687 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@lst.de> -Date: Mon, 9 Dec 2019 10:38:25 +0100 +Date: Thu, 12 Dec 2019 16:36:00 +0100 Subject: [PATCH 3/7] bcache: rework error unwinding in register_bcache Split the successful and error return path, and use one goto label for each @@ -9,6 +9,7 @@ module reference count in the reboot case (which seems entirely harmless) or printing the wrong warning messages for early failures. Signed-off-by: Christoph Hellwig <hch@lst.de> +Signed-off-by: Coly Li <colyli@suse.de> --- drivers/md/bcache/super.c | 75 ++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/for-next/0004-bcache-transfer-the-sb_page-reference-to-register_-b.patch b/for-next/0004-bcache-transfer-the-sb_page-reference-to-register_-b.patch index 01ea562..0de66ca 100644 --- a/for-next/0004-bcache-transfer-the-sb_page-reference-to-register_-b.patch +++ b/for-next/0004-bcache-transfer-the-sb_page-reference-to-register_-b.patch @@ -1,6 +1,6 @@ -From b31dedabcdcd69e94939b019c3d4c84278e78064 Mon Sep 17 00:00:00 2001 +From 4789a3a9504b96a9e354a56edf44136d403be0e6 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@lst.de> -Date: Mon, 9 Dec 2019 10:38:26 +0100 +Date: Thu, 12 Dec 2019 16:36:01 +0100 Subject: [PATCH 4/7] bcache: transfer the sb_page reference to register_{bdev,cache} @@ -8,6 +8,7 @@ Avoid an extra reference count roundtrip by transferring the sb_page ownership to the lower level register helpers. Signed-off-by: Christoph Hellwig <hch@lst.de> +Signed-off-by: Coly Li <colyli@suse.de> --- drivers/md/bcache/super.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/for-next/0005-bcache-return-a-pointer-to-the-on-disk-sb-from-read_.patch b/for-next/0005-bcache-return-a-pointer-to-the-on-disk-sb-from-read_.patch index 4d292e0..5a2bb4a 100644 --- a/for-next/0005-bcache-return-a-pointer-to-the-on-disk-sb-from-read_.patch +++ b/for-next/0005-bcache-return-a-pointer-to-the-on-disk-sb-from-read_.patch @@ -1,6 +1,6 @@ -From da4f3e98f4328c5ada91f2fcab31403b61e88d5d Mon Sep 17 00:00:00 2001 +From d5bff91cda88b59a6efb651592bb6161e7291fa1 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@lst.de> -Date: Mon, 9 Dec 2019 10:38:27 +0100 +Date: Thu, 12 Dec 2019 16:36:02 +0100 Subject: [PATCH 5/7] bcache: return a pointer to the on-disk sb from read_super @@ -9,6 +9,7 @@ containing struct page will save the callers some work going forward. Signed-off-by: Christoph Hellwig <hch@lst.de> +Signed-off-by: Coly Li <colyli@suse.de> --- drivers/md/bcache/super.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/for-next/0006-bcache-store-a-pointer-to-the-on-disk-sb-in-the-cach.patch b/for-next/0006-bcache-store-a-pointer-to-the-on-disk-sb-in-the-cach.patch index 154c164..b20f5cc 100644 --- a/for-next/0006-bcache-store-a-pointer-to-the-on-disk-sb-in-the-cach.patch +++ b/for-next/0006-bcache-store-a-pointer-to-the-on-disk-sb-in-the-cach.patch @@ -1,6 +1,6 @@ -From 372e570951ab675cc172551cc5363246835f56ee Mon Sep 17 00:00:00 2001 +From 7a830c83f25fc1ac38d1aa34115da01920c998cd Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@lst.de> -Date: Mon, 9 Dec 2019 10:38:28 +0100 +Date: Thu, 12 Dec 2019 16:36:03 +0100 Subject: [PATCH 6/7] bcache: store a pointer to the on-disk sb in the cache and cached_dev structures @@ -10,10 +10,11 @@ page sizes larger than 4k where the sb write bio would need an offset in the bio_vec. Signed-off-by: Christoph Hellwig <hch@lst.de> +Signed-off-by: Coly Li <colyli@suse.de> --- drivers/md/bcache/bcache.h | 2 ++ - drivers/md/bcache/super.c | 32 +++++++++++++------------------- - 2 files changed, 15 insertions(+), 19 deletions(-) + drivers/md/bcache/super.c | 34 +++++++++++++++------------------- + 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 9198c1b480d9..adf26a21fcd1 100644 @@ -36,7 +37,7 @@ index 9198c1b480d9..adf26a21fcd1 100644 struct bio_vec sb_bv[1]; diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index 0b7620d9f087..df41d103fa34 100644 +index 0b7620d9f087..c3bfbc813daf 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -207,15 +207,15 @@ static void write_bdev_super_endio(struct bio *bio) @@ -104,17 +105,18 @@ index 0b7620d9f087..df41d103fa34 100644 if (!IS_ERR_OR_NULL(dc->bdev)) blkdev_put(dc->bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); -@@ -1366,9 +1366,6 @@ static int register_bdev(struct cache_sb *sb, struct cache_sb_disk *sb_disk, +@@ -1365,9 +1365,7 @@ static int register_bdev(struct cache_sb *sb, struct cache_sb_disk *sb_disk, + memcpy(&dc->sb, sb, sizeof(struct cache_sb)); dc->bdev = bdev; dc->bdev->bd_holder = dc; - +- - bio_init(&dc->sb_bio, dc->sb_bio.bi_inline_vecs, 1); - bio_first_bvec_all(&dc->sb_bio)->bv_page = virt_to_page(sb_disk); -- ++ dc->sb_disk = sb_disk; + if (cached_dev_init(dc, sb->block_size << 9)) goto err; - -@@ -2137,8 +2134,8 @@ void bch_cache_release(struct kobject *kobj) +@@ -2137,8 +2135,8 @@ void bch_cache_release(struct kobject *kobj) for (i = 0; i < RESERVE_NR; i++) free_fifo(&ca->free[i]); @@ -125,16 +127,17 @@ index 0b7620d9f087..df41d103fa34 100644 if (!IS_ERR_OR_NULL(ca->bdev)) blkdev_put(ca->bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); -@@ -2271,9 +2268,6 @@ static int register_cache(struct cache_sb *sb, struct cache_sb_disk *sb_disk, +@@ -2270,9 +2268,7 @@ static int register_cache(struct cache_sb *sb, struct cache_sb_disk *sb_disk, + memcpy(&ca->sb, sb, sizeof(struct cache_sb)); ca->bdev = bdev; ca->bdev->bd_holder = ca; - +- - bio_init(&ca->sb_bio, ca->sb_bio.bi_inline_vecs, 1); - bio_first_bvec_all(&ca->sb_bio)->bv_page = virt_to_page(sb_disk); -- ++ ca->sb_disk = sb_disk; + if (blk_queue_discard(bdev_get_queue(bdev))) ca->discard = CACHE_DISCARD(&ca->sb); - -- 2.16.4 diff --git a/for-next/0007-bcache-use-read_cache_page_gfp-to-read-the-superbloc.patch b/for-next/0007-bcache-use-read_cache_page_gfp-to-read-the-superbloc.patch index d58beb6..60c4791 100644 --- a/for-next/0007-bcache-use-read_cache_page_gfp-to-read-the-superbloc.patch +++ b/for-next/0007-bcache-use-read_cache_page_gfp-to-read-the-superbloc.patch @@ -1,6 +1,6 @@ -From 6c4c82232f339f15e7914d23111c2f3443c9a6f5 Mon Sep 17 00:00:00 2001 +From db4656c174bbd638bc95a0374f2649eab1304ad6 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@lst.de> -Date: Mon, 9 Dec 2019 10:38:29 +0100 +Date: Thu, 12 Dec 2019 16:36:04 +0100 Subject: [PATCH 7/7] bcache: use read_cache_page_gfp to read the superblock Avoid a pointless dependency on buffer heads in bcache by simply open @@ -8,13 +8,14 @@ coding reading a single page. Also add a SB_OFFSET define for the byte offset of the superblock instead of using magic numbers. Signed-off-by: Christoph Hellwig <hch@lst.de> +Signed-off-by: Coly Li <colyli@suse.de> --- drivers/md/bcache/super.c | 16 +++++++--------- include/uapi/linux/bcache.h | 1 + 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index df41d103fa34..ecb24316381f 100644 +index c3bfbc813daf..7ebd355f51b1 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -15,7 +15,6 @@ diff --git a/for-test/0001-bcache-check-return-value-of-prio_read.patch b/for-test/0001-bcache-check-return-value-of-prio_read.patch deleted file mode 100644 index 7d4c016..0000000 --- a/for-test/0001-bcache-check-return-value-of-prio_read.patch +++ /dev/null @@ -1,76 +0,0 @@ -From d6bda91f5c00320df4fc1dbdf5b95d5d1c22d606 Mon Sep 17 00:00:00 2001 -From: Coly Li <colyli@suse.de> -Date: Thu, 14 Feb 2019 15:44:57 +0800 -Subject: [PATCH] bcache: check return value of prio_read() - -Then we can print out error message in run_cache_set() properly. - -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/super.c | 21 ++++++++++++++++----- - 1 file changed, 16 insertions(+), 5 deletions(-) - -diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index 4dee119c3664..1147ed26febf 100644 ---- a/drivers/md/bcache/super.c -+++ b/drivers/md/bcache/super.c -@@ -591,12 +591,13 @@ void bch_prio_write(struct cache *ca) - } - } - --static void prio_read(struct cache *ca, uint64_t bucket) -+static int prio_read(struct cache *ca, uint64_t bucket) - { - struct prio_set *p = ca->disk_buckets; - struct bucket_disk *d = p->data + prios_per_bucket(ca), *end = d; - struct bucket *b; - unsigned int bucket_nr = 0; -+ int ret = -EIO; - - for (b = ca->buckets; - b < ca->buckets + ca->sb.nbuckets; -@@ -609,11 +610,15 @@ static void prio_read(struct cache *ca, uint64_t bucket) - prio_io(ca, bucket, REQ_OP_READ, 0); - - if (p->csum != -- bch_crc64(&p->magic, bucket_bytes(ca) - 8)) -+ bch_crc64(&p->magic, bucket_bytes(ca) - 8)) { - pr_warn("bad csum reading priorities"); -+ goto out; -+ } - -- if (p->magic != pset_magic(&ca->sb)) -+ if (p->magic != pset_magic(&ca->sb)) { - pr_warn("bad magic reading priorities"); -+ goto out; -+ } - - bucket = p->next_bucket; - d = p->data; -@@ -622,6 +627,10 @@ static void prio_read(struct cache *ca, uint64_t bucket) - b->prio = le16_to_cpu(d->prio); - b->gen = b->last_gc = d->gen; - } -+ -+ ret = 0; -+out: -+ return ret; - } - - /* Bcache device */ -@@ -1807,8 +1816,10 @@ static void run_cache_set(struct cache_set *c) - j = &list_entry(journal.prev, struct journal_replay, list)->j; - - err = "IO error reading priorities"; -- for_each_cache(ca, c, i) -- prio_read(ca, j->prio_bucket[ca->sb.nr_this_dev]); -+ for_each_cache(ca, c, i) { -+ if (prio_read(ca, j->prio_bucket[ca->sb.nr_this_dev])) -+ goto err; -+ } - - /* - * If prio_read() fails it'll call cache_set_error and we'll --- -2.16.4 - |