diff options
author | Coly Li <colyli@suse.de> | 2018-08-02 20:16:51 +0800 |
---|---|---|
committer | Coly Li <colyli@suse.de> | 2018-08-02 20:16:51 +0800 |
commit | 3dff17dc50789d1e8616de4a96804915f67c2f79 (patch) | |
tree | efebf7e0f37a21f055f0db23498def072c67edcd | |
parent | 07af5c2aab865ea43eba576a81547bb3b5408954 (diff) | |
download | bcache-patches-3dff17dc50789d1e8616de4a96804915f67c2f79.tar.gz |
for-next: removed the applied ones
11 files changed, 0 insertions, 775 deletions
diff --git a/for-next/0000-cover-letter.patch b/for-next/0000-cover-letter.patch deleted file mode 100644 index 8d9df12..0000000 --- a/for-next/0000-cover-letter.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 6150428433cdbf345e1cbfb9408986865b5bc29e Mon Sep 17 00:00:00 2001 -From: Coly Li <colyli@suse.de> -Date: Thu, 26 Jul 2018 00:56:23 +0800 -Subject: [PATCH 0/9] bcache patches for Linux v4.19 - -Hi Jenns, - -Here is the first wave bcache patches for Linnux v4.19. - -Florian Schmaus contributes useful chagnes for code cleanup, and -Arnd Bergmann replaces get_seconds() by ktime_get_real_seconds(). - -Shenghui Wang contributes a patch to fix a memory leak in bcache. And -patches from Tang Junhui are for recoganized performance improvement, -these patches are posted for monthes and good to me. - -Please pick the first wave for 4.19. Thanks in advance. - -Coly Li ---- -Arnd Bergmann (1): - bcache: stop using the deprecated get_seconds() - -Florian Schmaus (3): - bcache: do not assign in if condition register_bcache() - bcache: do not assign in if condition in bcache_init() - bcache: do not assign in if condition in bcache_device_init() - -Shenghui Wang (1): - bcache: free heap cache_set->flush_btree in bch_journal_free - -Tang Junhui (4): - bcache: simplify the calculation of the total amount of flash dirty - data - bcache: finish incremental GC - bcache: calculate the number of incremental GC nodes according to the - total of btree nodes - bcache: fix I/O significant decline while backend devices registering - - drivers/md/bcache/bcache.h | 6 +++++ - drivers/md/bcache/btree.c | 49 ++++++++++++++++++++++++++++++++-- - drivers/md/bcache/journal.c | 1 + - drivers/md/bcache/request.c | 3 +++ - drivers/md/bcache/super.c | 50 ++++++++++++++++++++++++----------- - drivers/md/bcache/writeback.c | 34 +++++++++++++++++++++--- - drivers/md/bcache/writeback.h | 19 ------------- - include/uapi/linux/bcache.h | 4 +-- - 8 files changed, 123 insertions(+), 43 deletions(-) - --- -2.17.1 - diff --git a/for-next/0001-bcache-simplify-the-calculation-of-the-total-amount-.patch b/for-next/0001-bcache-simplify-the-calculation-of-the-total-amount-.patch deleted file mode 100644 index bce21fa..0000000 --- a/for-next/0001-bcache-simplify-the-calculation-of-the-total-amount-.patch +++ /dev/null @@ -1,104 +0,0 @@ -From cc663b89c534259446d0e9ed5f3f413412b488ed Mon Sep 17 00:00:00 2001 -From: Tang Junhui <tang.junhui@zte.com.cn> -Date: Thu, 26 Jul 2018 00:20:49 +0800 -Subject: [PATCH 1/9] bcache: simplify the calculation of the total amount of - flash dirty data - -Currently we calculate the total amount of flash only devices dirty data -by adding the dirty data of each flash only device under registering -locker. It is very inefficient. - -In this patch, we add a member flash_dev_dirty_sectors in struct cache_set -to record the total amount of flash only devices dirty data in real time, -so we didn't need to calculate the total amount of dirty data any more. - -Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn> -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/bcache.h | 1 + - drivers/md/bcache/super.c | 2 ++ - drivers/md/bcache/writeback.c | 5 ++++- - drivers/md/bcache/writeback.h | 19 ------------------- - 4 files changed, 7 insertions(+), 20 deletions(-) - -diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h -index d6bf294f3907..3226d38bf859 100644 ---- a/drivers/md/bcache/bcache.h -+++ b/drivers/md/bcache/bcache.h -@@ -525,6 +525,7 @@ struct cache_set { - unsigned devices_max_used; - struct list_head cached_devs; - uint64_t cached_dev_sectors; -+ atomic_long_t flash_dev_dirty_sectors; - struct closure caching; - - struct closure sb_write; -diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index fa4058e43202..cea2a42ea276 100644 ---- a/drivers/md/bcache/super.c -+++ b/drivers/md/bcache/super.c -@@ -1311,6 +1311,8 @@ static void flash_dev_free(struct closure *cl) - { - struct bcache_device *d = container_of(cl, struct bcache_device, cl); - mutex_lock(&bch_register_lock); -+ atomic_long_sub(bcache_dev_sectors_dirty(d), -+ &d->c->flash_dev_dirty_sectors); - bcache_device_free(d); - mutex_unlock(&bch_register_lock); - kobject_put(&d->kobj); -diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c -index ad45ebe1a74b..0d2a05074a81 100644 ---- a/drivers/md/bcache/writeback.c -+++ b/drivers/md/bcache/writeback.c -@@ -27,7 +27,7 @@ static uint64_t __calc_target_rate(struct cached_dev *dc) - * flash-only devices - */ - uint64_t cache_sectors = c->nbuckets * c->sb.bucket_size - -- bcache_flash_devs_sectors_dirty(c); -+ atomic_long_read(&c->flash_dev_dirty_sectors); - - /* - * Unfortunately there is no control of global dirty data. If the -@@ -476,6 +476,9 @@ void bcache_dev_sectors_dirty_add(struct cache_set *c, unsigned inode, - if (!d) - return; - -+ if (UUID_FLASH_ONLY(&c->uuids[inode])) -+ atomic_long_add(nr_sectors, &c->flash_dev_dirty_sectors); -+ - stripe = offset_to_stripe(d, offset); - stripe_offset = offset & (d->stripe_size - 1); - -diff --git a/drivers/md/bcache/writeback.h b/drivers/md/bcache/writeback.h -index 610fb01de629..3745d7004c47 100644 ---- a/drivers/md/bcache/writeback.h -+++ b/drivers/md/bcache/writeback.h -@@ -28,25 +28,6 @@ static inline uint64_t bcache_dev_sectors_dirty(struct bcache_device *d) - return ret; - } - --static inline uint64_t bcache_flash_devs_sectors_dirty(struct cache_set *c) --{ -- uint64_t i, ret = 0; -- -- mutex_lock(&bch_register_lock); -- -- for (i = 0; i < c->devices_max_used; i++) { -- struct bcache_device *d = c->devices[i]; -- -- if (!d || !UUID_FLASH_ONLY(&c->uuids[i])) -- continue; -- ret += bcache_dev_sectors_dirty(d); -- } -- -- mutex_unlock(&bch_register_lock); -- -- return ret; --} -- - static inline unsigned offset_to_stripe(struct bcache_device *d, - uint64_t offset) - { --- -2.17.1 - diff --git a/for-next/0002-bcache-finish-incremental-GC.patch b/for-next/0002-bcache-finish-incremental-GC.patch deleted file mode 100644 index c15d27f..0000000 --- a/for-next/0002-bcache-finish-incremental-GC.patch +++ /dev/null @@ -1,114 +0,0 @@ -From 05cd7b291b08c28fddb5f2edabe5deeb544ec0a1 Mon Sep 17 00:00:00 2001 -From: Tang Junhui <tang.junhui@zte.com.cn> -Date: Thu, 26 Jul 2018 00:33:24 +0800 -Subject: [PATCH 2/9] bcache: finish incremental GC - -In GC thread, we record the latest GC key in gc_done, which is expected -to be used for incremental GC, but in currently code, we didn't realize -it. When GC runs, front side IO would be blocked until the GC over, it -would be a long time if there is a lot of btree nodes. - -This patch realizes incremental GC, the main ideal is that, when there -are front side I/Os, after GC some nodes (100), we stop GC, release locker -of the btree node, and go to process the front side I/Os for some times -(100 ms), then go back to GC again. - -By this patch, when we doing GC, I/Os are not blocked all the time, and -there is no obvious I/Os zero jump problem any more. - -Patch v2: Rename some variables and macros name as Coly suggested. - -Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn> -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/bcache.h | 5 +++++ - drivers/md/bcache/btree.c | 14 +++++++++++++- - drivers/md/bcache/request.c | 3 +++ - 3 files changed, 21 insertions(+), 1 deletion(-) - -diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h -index 3226d38bf859..872ef4d67711 100644 ---- a/drivers/md/bcache/bcache.h -+++ b/drivers/md/bcache/bcache.h -@@ -474,6 +474,7 @@ struct cache { - - struct gc_stat { - size_t nodes; -+ size_t nodes_pre; - size_t key_bytes; - - size_t nkeys; -@@ -603,6 +604,10 @@ struct cache_set { - * rescale; when it hits 0 we rescale all the bucket priorities. - */ - atomic_t rescale; -+ /* -+ * used for GC, identify if any front side I/Os is inflight -+ */ -+ atomic_t search_inflight; - /* - * When we invalidate buckets, we use both the priority and the amount - * of good data to determine which buckets to reuse first - to weight -diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c -index 547c9eedc2f4..b4407ba12667 100644 ---- a/drivers/md/bcache/btree.c -+++ b/drivers/md/bcache/btree.c -@@ -90,6 +90,8 @@ - - #define MAX_NEED_GC 64 - #define MAX_SAVE_PRIO 72 -+#define MIN_GC_NODES 100 -+#define GC_SLEEP_MS 100 - - #define PTR_DIRTY_BIT (((uint64_t) 1 << 36)) - -@@ -1585,6 +1587,13 @@ static int btree_gc_recurse(struct btree *b, struct btree_op *op, - memmove(r + 1, r, sizeof(r[0]) * (GC_MERGE_NODES - 1)); - r->b = NULL; - -+ if (atomic_read(&b->c->search_inflight) && -+ gc->nodes >= gc->nodes_pre + MIN_GC_NODES) { -+ gc->nodes_pre = gc->nodes; -+ ret = -EAGAIN; -+ break; -+ } -+ - if (need_resched()) { - ret = -EAGAIN; - break; -@@ -1753,7 +1762,10 @@ static void bch_btree_gc(struct cache_set *c) - closure_sync(&writes); - cond_resched(); - -- if (ret && ret != -EAGAIN) -+ if (ret == -EAGAIN) -+ schedule_timeout_interruptible(msecs_to_jiffies -+ (GC_SLEEP_MS)); -+ else if (ret) - pr_warn("gc failed!"); - } while (ret && !test_bit(CACHE_SET_IO_DISABLE, &c->flags)); - -diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c -index ae67f5fa8047..8eece9ef9f46 100644 ---- a/drivers/md/bcache/request.c -+++ b/drivers/md/bcache/request.c -@@ -702,6 +702,8 @@ static void search_free(struct closure *cl) - { - struct search *s = container_of(cl, struct search, cl); - -+ atomic_dec(&s->d->c->search_inflight); -+ - if (s->iop.bio) - bio_put(s->iop.bio); - -@@ -719,6 +721,7 @@ static inline struct search *search_alloc(struct bio *bio, - - closure_init(&s->cl, NULL); - do_bio_hook(s, bio, request_endio); -+ atomic_inc(&d->c->search_inflight); - - s->orig_bio = bio; - s->cache_miss = NULL; --- -2.17.1 - diff --git a/for-next/0003-bcache-calculate-the-number-of-incremental-GC-nodes-.patch b/for-next/0003-bcache-calculate-the-number-of-incremental-GC-nodes-.patch deleted file mode 100644 index 0680049..0000000 --- a/for-next/0003-bcache-calculate-the-number-of-incremental-GC-nodes-.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 888e542fcbcaca7a5c050a98fdd847a94c49e18f Mon Sep 17 00:00:00 2001 -From: Tang Junhui <tang.junhui@zte.com.cn> -Date: Thu, 26 Jul 2018 00:39:45 +0800 -Subject: [PATCH 3/9] bcache: calculate the number of incremental GC nodes - according to the total of btree nodes - -This patch base on "[PATCH] bcache: finish incremental GC". - -Since incremental GC would stop 100ms when front side I/O comes, so when -there are many btree nodes, if GC only processes constant (100) nodes each -time, GC would last a long time, and the front I/Os would run out of the -buckets (since no new bucket can be allocated during GC), and I/Os be -blocked again. - -So GC should not process constant nodes, but varied nodes according to the -number of btree nodes. In this patch, GC is divided into constant (100) -times, so when there are many btree nodes, GC can process more nodes each -time, otherwise GC will process less nodes each time (but no less than -MIN_GC_NODES). - -Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn> -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/btree.c | 37 +++++++++++++++++++++++++++++++++++-- - 1 file changed, 35 insertions(+), 2 deletions(-) - -diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c -index b4407ba12667..475008fbbaab 100644 ---- a/drivers/md/bcache/btree.c -+++ b/drivers/md/bcache/btree.c -@@ -90,6 +90,7 @@ - - #define MAX_NEED_GC 64 - #define MAX_SAVE_PRIO 72 -+#define MAX_GC_TIMES 100 - #define MIN_GC_NODES 100 - #define GC_SLEEP_MS 100 - -@@ -1522,6 +1523,32 @@ static unsigned btree_gc_count_keys(struct btree *b) - return ret; - } - -+static size_t btree_gc_min_nodes(struct cache_set *c) -+{ -+ size_t min_nodes; -+ -+ /* -+ * Since incremental GC would stop 100ms when front -+ * side I/O comes, so when there are many btree nodes, -+ * if GC only processes constant (100) nodes each time, -+ * GC would last a long time, and the front side I/Os -+ * would run out of the buckets (since no new bucket -+ * can be allocated during GC), and be blocked again. -+ * So GC should not process constant nodes, but varied -+ * nodes according to the number of btree nodes, which -+ * realized by dividing GC into constant(100) times, -+ * so when there are many btree nodes, GC can process -+ * more nodes each time, otherwise, GC will process less -+ * nodes each time (but no less than MIN_GC_NODES) -+ */ -+ min_nodes = c->gc_stats.nodes / MAX_GC_TIMES; -+ if (min_nodes < MIN_GC_NODES) -+ min_nodes = MIN_GC_NODES; -+ -+ return min_nodes; -+} -+ -+ - static int btree_gc_recurse(struct btree *b, struct btree_op *op, - struct closure *writes, struct gc_stat *gc) - { -@@ -1588,7 +1615,7 @@ static int btree_gc_recurse(struct btree *b, struct btree_op *op, - r->b = NULL; - - if (atomic_read(&b->c->search_inflight) && -- gc->nodes >= gc->nodes_pre + MIN_GC_NODES) { -+ gc->nodes >= gc->nodes_pre + btree_gc_min_nodes(b->c)) { - gc->nodes_pre = gc->nodes; - ret = -EAGAIN; - break; -@@ -1846,8 +1873,14 @@ static int bch_btree_check_recurse(struct btree *b, struct btree_op *op) - do { - k = bch_btree_iter_next_filter(&iter, &b->keys, - bch_ptr_bad); -- if (k) -+ if (k) { - btree_node_prefetch(b, k); -+ /* -+ * initiallize c->gc_stats.nodes -+ * for incremental GC -+ */ -+ b->c->gc_stats.nodes++; -+ } - - if (p) - ret = btree(check_recurse, p, b, op); --- -2.17.1 - diff --git a/for-next/0004-bcache-fix-I-O-significant-decline-while-backend-dev.patch b/for-next/0004-bcache-fix-I-O-significant-decline-while-backend-dev.patch deleted file mode 100644 index a17f50c..0000000 --- a/for-next/0004-bcache-fix-I-O-significant-decline-while-backend-dev.patch +++ /dev/null @@ -1,95 +0,0 @@ -From de7763bc2d426e40ee54e3a2aa1722903c2589e0 Mon Sep 17 00:00:00 2001 -From: Tang Junhui <tang.junhui@zte.com.cn> -Date: Thu, 26 Jul 2018 00:50:04 +0800 -Subject: [PATCH 4/9] bcache: fix I/O significant decline while backend devices - registering - -I attached several backend devices in the same cache set, and produced lots -of dirty data by running small rand I/O writes in a long time, then I -continue run I/O in the others cached devices, and stopped a cached device, -after a mean while, I register the stopped device again, I see the running -I/O in the others cached devices dropped significantly, sometimes even -jumps to zero. - -In currently code, bcache would traverse each keys and btree node to count -the dirty data under read locker, and the writes threads can not get the -btree write locker, and when there is a lot of keys and btree node in the -registering device, it would last several seconds, so the write I/Os in -others cached device are blocked and declined significantly. - -In this patch, when a device registering to a ache set, which exist others -cached devices with running I/Os, we get the amount of dirty data of the -device in an incremental way, and do not block other cached devices all the -time. - -Patch v2: Rename some variables and macros name as Coly suggested. - -Signed-off-by: Tang Junhui <tang.junhui@zte.com.cn> -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/writeback.c | 29 ++++++++++++++++++++++++++--- - 1 file changed, 26 insertions(+), 3 deletions(-) - -diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c -index 0d2a05074a81..912e969fedba 100644 ---- a/drivers/md/bcache/writeback.c -+++ b/drivers/md/bcache/writeback.c -@@ -676,10 +676,14 @@ static int bch_writeback_thread(void *arg) - } - - /* Init */ -+#define INIT_KEYS_EACH_TIME 500000 -+#define INIT_KEYS_SLEEP_MS 100 - - struct sectors_dirty_init { - struct btree_op op; - unsigned inode; -+ size_t count; -+ struct bkey start; - }; - - static int sectors_dirty_init_fn(struct btree_op *_op, struct btree *b, -@@ -694,18 +698,37 @@ static int sectors_dirty_init_fn(struct btree_op *_op, struct btree *b, - bcache_dev_sectors_dirty_add(b->c, KEY_INODE(k), - KEY_START(k), KEY_SIZE(k)); - -+ op->count++; -+ if (atomic_read(&b->c->search_inflight) && -+ !(op->count % INIT_KEYS_EACH_TIME)) { -+ bkey_copy_key(&op->start, k); -+ return -EAGAIN; -+ } -+ - return MAP_CONTINUE; - } - - void bch_sectors_dirty_init(struct bcache_device *d) - { - struct sectors_dirty_init op; -+ int ret; - - bch_btree_op_init(&op.op, -1); - op.inode = d->id; -- -- bch_btree_map_keys(&op.op, d->c, &KEY(op.inode, 0, 0), -- sectors_dirty_init_fn, 0); -+ op.count = 0; -+ op.start = KEY(op.inode, 0, 0); -+ -+ do { -+ ret = bch_btree_map_keys(&op.op, d->c, &op.start, -+ sectors_dirty_init_fn, 0); -+ if (ret == -EAGAIN) -+ schedule_timeout_interruptible( -+ msecs_to_jiffies(INIT_KEYS_SLEEP_MS)); -+ else if (ret < 0) { -+ pr_warn("sectors dirty init failed, ret=%d!", ret); -+ break; -+ } -+ } while (ret == -EAGAIN); - } - - void bch_cached_dev_writeback_init(struct cached_dev *dc) --- -2.17.1 - diff --git a/for-next/0005-bcache-do-not-assign-in-if-condition-register_bcache.patch b/for-next/0005-bcache-do-not-assign-in-if-condition-register_bcache.patch deleted file mode 100644 index 7f50105..0000000 --- a/for-next/0005-bcache-do-not-assign-in-if-condition-register_bcache.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 7ece786c0f10c9eb1267d5166db1b6b64f49db77 Mon Sep 17 00:00:00 2001 -From: Florian Schmaus <flo@geekplace.eu> -Date: Mon, 18 Jun 2018 12:09:00 +0200 -Subject: [PATCH 5/9] bcache: do not assign in if condition register_bcache() - -Fixes an error condition reported by checkpatch.pl which is caused by -assigning a variable in an if condition. - -Signed-off-by: Florian Schmaus <flo@geekplace.eu> -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/super.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index cea2a42ea276..093b3789ce05 100644 ---- a/drivers/md/bcache/super.c -+++ b/drivers/md/bcache/super.c -@@ -2165,8 +2165,12 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, - if (!try_module_get(THIS_MODULE)) - return -EBUSY; - -- if (!(path = kstrndup(buffer, size, GFP_KERNEL)) || -- !(sb = kmalloc(sizeof(struct cache_sb), GFP_KERNEL))) -+ path = kstrndup(buffer, size, GFP_KERNEL); -+ if (!path) -+ goto err; -+ -+ sb = kmalloc(sizeof(struct cache_sb), GFP_KERNEL); -+ if (!sb) - goto err; - - err = "failed to open device"; --- -2.17.1 - diff --git a/for-next/0006-bcache-free-heap-cache_set-flush_btree-in-bch_journa.patch b/for-next/0006-bcache-free-heap-cache_set-flush_btree-in-bch_journa.patch deleted file mode 100644 index 53c6a04..0000000 --- a/for-next/0006-bcache-free-heap-cache_set-flush_btree-in-bch_journa.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 893d7bd84ea561c418b3cf4bdd775ca0dd9c35b7 Mon Sep 17 00:00:00 2001 -From: Shenghui Wang <shhuiw@foxmail.com> -Date: Thu, 28 Jun 2018 15:16:51 +0800 -Subject: [PATCH 6/9] bcache: free heap cache_set->flush_btree in - bch_journal_free - -Free the cache_set->flush_bree heap memory on journal free. - -Signed-off-by: Wang Sheng-Hui <shhuiw@foxmail.com> -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/journal.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c -index 18f1b5239620..10748c626a1d 100644 ---- a/drivers/md/bcache/journal.c -+++ b/drivers/md/bcache/journal.c -@@ -828,6 +828,7 @@ void bch_journal_free(struct cache_set *c) - free_pages((unsigned long) c->journal.w[1].data, JSET_BITS); - free_pages((unsigned long) c->journal.w[0].data, JSET_BITS); - free_fifo(&c->journal.pin); -+ free_heap(&c->flush_btree); - } - - int bch_journal_alloc(struct cache_set *c) --- -2.17.1 - diff --git a/for-next/0007-bcache-do-not-assign-in-if-condition-in-bcache_init.patch b/for-next/0007-bcache-do-not-assign-in-if-condition-in-bcache_init.patch deleted file mode 100644 index a3bd0a8..0000000 --- a/for-next/0007-bcache-do-not-assign-in-if-condition-in-bcache_init.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 8d177a69a52f5013cefeff0201c7d4553aa32d9e Mon Sep 17 00:00:00 2001 -From: Florian Schmaus <flo@geekplace.eu> -Date: Mon, 18 Jun 2018 12:09:01 +0200 -Subject: [PATCH 7/9] bcache: do not assign in if condition in bcache_init() - -Fixes an error condition reported by checkpatch.pl which is caused by -assigning a variable in an if condition. - -Signed-off-by: Florian Schmaus <flo@geekplace.eu> -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/super.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index 093b3789ce05..a852018964ad 100644 ---- a/drivers/md/bcache/super.c -+++ b/drivers/md/bcache/super.c -@@ -2330,9 +2330,15 @@ static int __init bcache_init(void) - return bcache_major; - } - -- if (!(bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0)) || -- !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) || -- bch_request_init() || -+ bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0); -+ if (!bcache_wq) -+ goto err; -+ -+ bcache_kobj = kobject_create_and_add("bcache", fs_kobj); -+ if (!bcache_kobj) -+ goto err; -+ -+ if (bch_request_init() || - bch_debug_init(bcache_kobj) || closure_debug_init() || - sysfs_create_files(bcache_kobj, files)) - goto err; --- -2.17.1 - diff --git a/for-next/0008-bcache-do-not-assign-in-if-condition-in-bcache_devic.patch b/for-next/0008-bcache-do-not-assign-in-if-condition-in-bcache_devic.patch deleted file mode 100644 index fdf1c2f..0000000 --- a/for-next/0008-bcache-do-not-assign-in-if-condition-in-bcache_devic.patch +++ /dev/null @@ -1,52 +0,0 @@ -From c917c0b18f0720efc9c86a374e0427b742cf6f72 Mon Sep 17 00:00:00 2001 -From: Florian Schmaus <flo@geekplace.eu> -Date: Mon, 18 Jun 2018 12:09:02 +0200 -Subject: [PATCH 8/9] bcache: do not assign in if condition in - bcache_device_init() - -Fixes an error condition reported by checkpatch.pl which is caused by -assigning a variable in an if condition. - -Signed-off-by: Florian Schmaus <flo@geekplace.eu> -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/super.c | 16 +++++++++++----- - 1 file changed, 11 insertions(+), 5 deletions(-) - -diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index a852018964ad..40fe26fef00f 100644 ---- a/drivers/md/bcache/super.c -+++ b/drivers/md/bcache/super.c -@@ -796,11 +796,12 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size, - return idx; - - if (bioset_init(&d->bio_split, 4, offsetof(struct bbio, bio), -- BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER) || -- !(d->disk = alloc_disk(BCACHE_MINORS))) { -- ida_simple_remove(&bcache_device_idx, idx); -- return -ENOMEM; -- } -+ BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER)) -+ goto err; -+ -+ d->disk = alloc_disk(BCACHE_MINORS); -+ if (!d->disk) -+ goto err; - - set_capacity(d->disk, sectors); - snprintf(d->disk->disk_name, DISK_NAME_LEN, "bcache%i", idx); -@@ -834,6 +835,11 @@ static int bcache_device_init(struct bcache_device *d, unsigned block_size, - blk_queue_write_cache(q, true, true); - - return 0; -+ -+err: -+ ida_simple_remove(&bcache_device_idx, idx); -+ return -ENOMEM; -+ - } - - /* Cached device */ --- -2.17.1 - diff --git a/for-next/0009-bcache-stop-using-the-deprecated-get_seconds.patch b/for-next/0009-bcache-stop-using-the-deprecated-get_seconds.patch deleted file mode 100644 index 808a3d9..0000000 --- a/for-next/0009-bcache-stop-using-the-deprecated-get_seconds.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 6150428433cdbf345e1cbfb9408986865b5bc29e Mon Sep 17 00:00:00 2001 -From: Arnd Bergmann <arnd@arndb.de> -Date: Fri, 22 Jun 2018 15:48:41 +0200 -Subject: [PATCH 9/9] bcache: stop using the deprecated get_seconds() - -The get_seconds function is deprecated now since it returns a 32-bit -value that will eventually overflow, and we are replacing it throughout -the kernel with ktime_get_seconds() or ktime_get_real_seconds() that -return a time64_t. - -bcache uses get_seconds() to read the current system time and store it in -the superblock as well as in uuid_entry structures that are user visible. - -Unfortunately, the two structures in are still limited to 32 bits, so this -won't fix any real problems but will still overflow in year 2106. Let's -at least document that properly, in case we get an updated format in the -future it can be fixed. We still have a long time before the overflow -and checking the tools at https://github.com/koverstreet/bcache-tools -reveals no access to any of them. - -Signed-off-by: Arnd Bergmann <arnd@arndb.de> -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/super.c | 12 ++++++------ - include/uapi/linux/bcache.h | 4 ++-- - 2 files changed, 8 insertions(+), 8 deletions(-) - -diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index 40fe26fef00f..e0a92104ca23 100644 ---- a/drivers/md/bcache/super.c -+++ b/drivers/md/bcache/super.c -@@ -181,7 +181,7 @@ static const char *read_super(struct cache_sb *sb, struct block_device *bdev, - goto err; - } - -- sb->last_mount = get_seconds(); -+ sb->last_mount = (u32)ktime_get_real_seconds(); - err = NULL; - - get_page(bh->b_page); -@@ -701,7 +701,7 @@ static void bcache_device_detach(struct bcache_device *d) - - SET_UUID_FLASH_ONLY(u, 0); - memcpy(u->uuid, invalid_uuid, 16); -- u->invalidated = cpu_to_le32(get_seconds()); -+ u->invalidated = cpu_to_le32((u32)ktime_get_real_seconds()); - bch_uuid_write(d->c); - } - -@@ -1033,7 +1033,7 @@ void bch_cached_dev_detach(struct cached_dev *dc) - int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c, - uint8_t *set_uuid) - { -- uint32_t rtime = cpu_to_le32(get_seconds()); -+ uint32_t rtime = cpu_to_le32((u32)ktime_get_real_seconds()); - struct uuid_entry *u; - struct cached_dev *exist_dc, *t; - -@@ -1076,7 +1076,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c, - (BDEV_STATE(&dc->sb) == BDEV_STATE_STALE || - BDEV_STATE(&dc->sb) == BDEV_STATE_NONE)) { - memcpy(u->uuid, invalid_uuid, 16); -- u->invalidated = cpu_to_le32(get_seconds()); -+ u->invalidated = cpu_to_le32((u32)ktime_get_real_seconds()); - u = NULL; - } - -@@ -1398,7 +1398,7 @@ int bch_flash_dev_create(struct cache_set *c, uint64_t size) - - get_random_bytes(u->uuid, 16); - memset(u->label, 0, 32); -- u->first_reg = u->last_reg = cpu_to_le32(get_seconds()); -+ u->first_reg = u->last_reg = cpu_to_le32((u32)ktime_get_real_seconds()); - - SET_UUID_FLASH_ONLY(u, 1); - u->sectors = size >> 9; -@@ -1902,7 +1902,7 @@ static void run_cache_set(struct cache_set *c) - goto err; - - closure_sync(&cl); -- c->sb.last_mount = get_seconds(); -+ c->sb.last_mount = (u32)ktime_get_real_seconds(); - bcache_write_super(c); - - list_for_each_entry_safe(dc, t, &uncached_devices, list) -diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h -index 821f71a2e48f..8d19e02d752a 100644 ---- a/include/uapi/linux/bcache.h -+++ b/include/uapi/linux/bcache.h -@@ -195,7 +195,7 @@ struct cache_sb { - }; - }; - -- __u32 last_mount; /* time_t */ -+ __u32 last_mount; /* time overflow in y2106 */ - - __u16 first_bucket; - union { -@@ -318,7 +318,7 @@ struct uuid_entry { - struct { - __u8 uuid[16]; - __u8 label[32]; -- __u32 first_reg; -+ __u32 first_reg; /* time overflow in y2106 */ - __u32 last_reg; - __u32 invalidated; - --- -2.17.1 - diff --git a/for-review/0000-cover-letter.patch b/for-review/0000-cover-letter.patch deleted file mode 100644 index c730229..0000000 --- a/for-review/0000-cover-letter.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 1bcaca9df4b3bedd43863a0e9ec56990418b5ce3 Mon Sep 17 00:00:00 2001 -From: Coly Li <colyli@suse.de> -Date: Thu, 26 Jul 2018 19:13:40 +0800 -Subject: [PATCH 0/9] Pending bcache patches for review - -Hi folks, - -I ask for help to review these patches, some of them are posted for months. -They are OK with my test for a while, still tt would be great to have more -reviewer before these patches go into v4.19. - -Thanks in advance. - -Coly Li ---- -Coly Li (9): - bcache: do not check return value of debugfs_create_dir() - bcache: display rate debug parameters to 0 when writeback is not - running - bcache: avoid unncessary cache prefetch bch_btree_node_get() - bcache: add a comment in register_bdev() - bcache: fix mistaken code comments in struct cache - bcache: fix mistaken comments in bch_keylist_realloc() - bcache: add code comments for bset.c - bcache: initiate bcache_debug to NULL - bcache: set max writeback rate when I/O request is idle - - drivers/md/bcache/bcache.h | 16 +++--- - drivers/md/bcache/bset.c | 63 ++++++++++++++++++++++++ - drivers/md/bcache/btree.c | 14 +++--- - drivers/md/bcache/closure.c | 13 +++-- - drivers/md/bcache/closure.h | 4 +- - drivers/md/bcache/debug.c | 13 ++--- - drivers/md/bcache/request.c | 56 ++++++++++++++++++++- - drivers/md/bcache/super.c | 9 +++- - drivers/md/bcache/sysfs.c | 37 +++++++++----- - drivers/md/bcache/util.c | 2 +- - drivers/md/bcache/util.h | 2 +- - drivers/md/bcache/writeback.c | 91 +++++++++++++++++++++++------------ - 12 files changed, 244 insertions(+), 76 deletions(-) - --- -2.17.1 - |