diff options
author | Coly Li <colyli@suse.de> | 2019-06-21 14:15:15 +0800 |
---|---|---|
committer | Coly Li <colyli@suse.de> | 2019-06-21 14:15:15 +0800 |
commit | fc9b11733ae0a7372dbef504bf666f7e2278cbf8 (patch) | |
tree | 28bd0709179b682538fa1a2909edbd138ddb8f4c | |
parent | 3960d2084ae1dbeca4098c885444b1aee2167ac0 (diff) | |
download | bcache-patches-fc9b11733ae0a7372dbef504bf666f7e2278cbf8.tar.gz |
for-next: update with new patch
36 files changed, 83 insertions, 244 deletions
diff --git a/for-next/0000-cover-letter.patch b/for-next/0000-cover-letter.patch index 489bb9b..4343a47 100644 --- a/for-next/0000-cover-letter.patch +++ b/for-next/0000-cover-letter.patch @@ -1,14 +1,14 @@ -From 8e3b9957b5cec10f72f5a9c80fae3f960247137f Mon Sep 17 00:00:00 2001 +From b55740a40cc650bf43e6e239593a978b3364c6a6 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> -Date: Fri, 21 Jun 2019 01:29:11 +0800 -Subject: [PATCH 00/33] *** SUBJECT HERE *** +Date: Fri, 21 Jun 2019 13:55:17 +0800 +Subject: [PATCH 00/34] *** SUBJECT HERE *** *** BLURB HERE *** Alexandru Ardelean (1): bcache: use sysfs_match_string() instead of __sysfs_match_string() -Coly Li (32): +Coly Li (33): bcache: Revert "bcache: free heap cache_set->flush_btree in bch_journal_free" bcache: Revert "bcache: fix high CPU occupancy during journal" @@ -45,6 +45,7 @@ Coly Li (32): bcache: stop writeback kthread and kworker when bch_cached_dev_run() failed bcache: Improve bcache tollerance for out-of-memory condition + bcache: don't set max writeback rate if gc is running drivers/md/bcache/alloc.c | 9 ++ drivers/md/bcache/bcache.h | 16 ++- @@ -58,8 +59,8 @@ Coly Li (32): drivers/md/bcache/super.c | 229 ++++++++++++++++++++++++++++++++++-------- drivers/md/bcache/sysfs.c | 67 ++++++++---- drivers/md/bcache/util.h | 2 - - drivers/md/bcache/writeback.c | 5 + - 13 files changed, 473 insertions(+), 155 deletions(-) + drivers/md/bcache/writeback.c | 8 ++ + 13 files changed, 476 insertions(+), 155 deletions(-) -- 2.16.4 diff --git a/for-next/0001-bcache-Revert-bcache-free-heap-cache_set-flush_btree.patch b/for-next/0001-bcache-Revert-bcache-free-heap-cache_set-flush_btree.patch index a9d6f61..10c16a0 100644 --- a/for-next/0001-bcache-Revert-bcache-free-heap-cache_set-flush_btree.patch +++ b/for-next/0001-bcache-Revert-bcache-free-heap-cache_set-flush_btree.patch @@ -1,7 +1,7 @@ From 0c264f6c4628d077cc8a6340ef581b5ad3668208 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 28 May 2019 21:36:56 +0800 -Subject: [PATCH 01/33] bcache: Revert "bcache: free heap +Subject: [PATCH 01/34] bcache: Revert "bcache: free heap cache_set->flush_btree in bch_journal_free" This reverts commit 6268dc2c4703aabfb0b35681be709acf4c2826c6. diff --git a/for-next/0002-bcache-Revert-bcache-fix-high-CPU-occupancy-during-j.patch b/for-next/0002-bcache-Revert-bcache-fix-high-CPU-occupancy-during-j.patch index 508b9e5..a10d652 100644 --- a/for-next/0002-bcache-Revert-bcache-fix-high-CPU-occupancy-during-j.patch +++ b/for-next/0002-bcache-Revert-bcache-fix-high-CPU-occupancy-during-j.patch @@ -1,7 +1,7 @@ From 77671a2d588a36316a7e0c9368d2e9ef53b8cd54 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 28 May 2019 21:19:38 +0800 -Subject: [PATCH 02/33] bcache: Revert "bcache: fix high CPU occupancy during +Subject: [PATCH 02/34] bcache: Revert "bcache: fix high CPU occupancy during journal" This reverts commit c4dc2497d50d9c6fb16aa0d07b6a14f3b2adb1e0. diff --git a/for-next/0003-bcache-add-code-comments-for-journal_read_bucket.patch b/for-next/0003-bcache-add-code-comments-for-journal_read_bucket.patch index 519d1f2..cb8fa30 100644 --- a/for-next/0003-bcache-add-code-comments-for-journal_read_bucket.patch +++ b/for-next/0003-bcache-add-code-comments-for-journal_read_bucket.patch @@ -1,7 +1,7 @@ From daca53ac373bba64fcea788567cd27db8029a1c8 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Thu, 30 May 2019 18:39:17 +0800 -Subject: [PATCH 03/33] bcache: add code comments for journal_read_bucket() +Subject: [PATCH 03/34] bcache: add code comments for journal_read_bucket() This patch adds more code comments in journal_read_bucket(), this is an effort to make the code to be more understandable. diff --git a/for-next/0004-bcache-set-largest-seq-to-ja-seq-bucket_index-in-jou.patch b/for-next/0004-bcache-set-largest-seq-to-ja-seq-bucket_index-in-jou.patch index 29c6544..90cb6a7 100644 --- a/for-next/0004-bcache-set-largest-seq-to-ja-seq-bucket_index-in-jou.patch +++ b/for-next/0004-bcache-set-largest-seq-to-ja-seq-bucket_index-in-jou.patch @@ -1,7 +1,7 @@ From a75fcfb07901afa347ab923896d0f2e5c21a88a3 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Thu, 30 May 2019 18:40:37 +0800 -Subject: [PATCH 04/33] bcache: set largest seq to ja->seq[bucket_index] in +Subject: [PATCH 04/34] bcache: set largest seq to ja->seq[bucket_index] in journal_read_bucket() In journal_read_bucket() when setting ja->seq[bucket_index], there might diff --git a/for-next/0005-bcache-remove-retry_flush_write-from-struct-cache_se.patch b/for-next/0005-bcache-remove-retry_flush_write-from-struct-cache_se.patch index 8e6b2eb..00b4d5b 100644 --- a/for-next/0005-bcache-remove-retry_flush_write-from-struct-cache_se.patch +++ b/for-next/0005-bcache-remove-retry_flush_write-from-struct-cache_se.patch @@ -1,7 +1,7 @@ From 4ba6a982305b7ce75413774c1af3fdf6c0c45f54 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Sat, 1 Jun 2019 01:58:23 +0800 -Subject: [PATCH 05/33] bcache: remove retry_flush_write from struct cache_set +Subject: [PATCH 05/34] bcache: remove retry_flush_write from struct cache_set In struct cache_set, retry_flush_write is added for commit c4dc2497d50d ("bcache: fix high CPU occupancy during journal") which is reverted in diff --git a/for-next/0006-bcache-fix-race-in-btree_flush_write.patch b/for-next/0006-bcache-fix-race-in-btree_flush_write.patch index 5fb888d..a8ca7c3 100644 --- a/for-next/0006-bcache-fix-race-in-btree_flush_write.patch +++ b/for-next/0006-bcache-fix-race-in-btree_flush_write.patch @@ -1,7 +1,7 @@ From 37be04bd6f5df550b4084f299df4a842cbebcdae Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Sat, 1 Jun 2019 01:55:30 +0800 -Subject: [PATCH 06/33] bcache: fix race in btree_flush_write() +Subject: [PATCH 06/34] bcache: fix race in btree_flush_write() There is a race between mca_reap(), btree_node_free() and journal code btree_flush_write(), which results very rare and strange deadlock or diff --git a/for-next/0007-bcache-add-reclaimed_journal_buckets-to-struct-cache.patch b/for-next/0007-bcache-add-reclaimed_journal_buckets-to-struct-cache.patch index 06586af..a369e21 100644 --- a/for-next/0007-bcache-add-reclaimed_journal_buckets-to-struct-cache.patch +++ b/for-next/0007-bcache-add-reclaimed_journal_buckets-to-struct-cache.patch @@ -1,7 +1,7 @@ From 2730972c0e7008b5d1d2fa32c6be712f3b3a9426 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Sun, 2 Jun 2019 00:47:23 +0800 -Subject: [PATCH 07/33] bcache: add reclaimed_journal_buckets to struct +Subject: [PATCH 07/34] bcache: add reclaimed_journal_buckets to struct cache_set Now we have counters for how many times jouranl is reclaimed, how many diff --git a/for-next/0008-bcache-fix-return-value-error-in-bch_journal_read.patch b/for-next/0008-bcache-fix-return-value-error-in-bch_journal_read.patch index 92c731c..ec518c5 100644 --- a/for-next/0008-bcache-fix-return-value-error-in-bch_journal_read.patch +++ b/for-next/0008-bcache-fix-return-value-error-in-bch_journal_read.patch @@ -1,7 +1,7 @@ From 6b56bb07f0adc7f0b934b69a3cf67a18fdd59f05 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 4 Jun 2019 14:43:08 +0800 -Subject: [PATCH 08/33] bcache: fix return value error in bch_journal_read() +Subject: [PATCH 08/34] bcache: fix return value error in bch_journal_read() When everything is OK in bch_journal_read(), finally the return value is returned by, diff --git a/for-next/0009-Revert-bcache-set-CACHE_SET_IO_DISABLE-in-bch_cached.patch b/for-next/0009-Revert-bcache-set-CACHE_SET_IO_DISABLE-in-bch_cached.patch index f907c11..9351411 100644 --- a/for-next/0009-Revert-bcache-set-CACHE_SET_IO_DISABLE-in-bch_cached.patch +++ b/for-next/0009-Revert-bcache-set-CACHE_SET_IO_DISABLE-in-bch_cached.patch @@ -1,7 +1,7 @@ From ec6d35db4fd4445037a429065c2a0cbce00b3a92 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 4 Jun 2019 15:00:46 +0800 -Subject: [PATCH 09/33] Revert "bcache: set CACHE_SET_IO_DISABLE in +Subject: [PATCH 09/34] Revert "bcache: set CACHE_SET_IO_DISABLE in bch_cached_dev_error()" This reverts commit 6147305c73e4511ca1a975b766b97a779d442567. diff --git a/for-next/0010-bcache-avoid-flushing-btree-node-in-cache_set_flush-.patch b/for-next/0010-bcache-avoid-flushing-btree-node-in-cache_set_flush-.patch index 03235ca..0d202a5 100644 --- a/for-next/0010-bcache-avoid-flushing-btree-node-in-cache_set_flush-.patch +++ b/for-next/0010-bcache-avoid-flushing-btree-node-in-cache_set_flush-.patch @@ -1,7 +1,7 @@ From bfa1592075eff26fb949651c889f58c15b7c25d5 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Thu, 23 May 2019 23:18:10 +0800 -Subject: [PATCH 10/33] bcache: avoid flushing btree node in cache_set_flush() +Subject: [PATCH 10/34] bcache: avoid flushing btree node in cache_set_flush() if io disabled When cache_set_flush() is called for too many I/O errors detected on diff --git a/for-next/0011-bcache-ignore-read-ahead-request-failure-on-backing-.patch b/for-next/0011-bcache-ignore-read-ahead-request-failure-on-backing-.patch index 9e6e742..bd18459 100644 --- a/for-next/0011-bcache-ignore-read-ahead-request-failure-on-backing-.patch +++ b/for-next/0011-bcache-ignore-read-ahead-request-failure-on-backing-.patch @@ -1,7 +1,7 @@ From be5359dd7dc068ecb6ef61db4342c191fe28aae7 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Mon, 13 May 2019 22:48:09 +0800 -Subject: [PATCH 11/33] bcache: ignore read-ahead request failure on backing +Subject: [PATCH 11/34] bcache: ignore read-ahead request failure on backing device When md raid device (e.g. raid456) is used as backing device, read-ahead diff --git a/for-next/0012-bcache-add-io-error-counting-in-write_bdev_super_end.patch b/for-next/0012-bcache-add-io-error-counting-in-write_bdev_super_end.patch index f0314d3..efc5c78 100644 --- a/for-next/0012-bcache-add-io-error-counting-in-write_bdev_super_end.patch +++ b/for-next/0012-bcache-add-io-error-counting-in-write_bdev_super_end.patch @@ -1,7 +1,7 @@ From ae06ecdd94879dcb5100d1375e6dc65c643cbdbb Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Mon, 13 May 2019 23:42:39 +0800 -Subject: [PATCH 12/33] bcache: add io error counting in +Subject: [PATCH 12/34] bcache: add io error counting in write_bdev_super_endio() When backing device super block is written by bch_write_bdev_super(), diff --git a/for-next/0013-bcache-remove-XXX-comment-line-from-run_cache_set.patch b/for-next/0013-bcache-remove-XXX-comment-line-from-run_cache_set.patch index ca24d06..5353723 100644 --- a/for-next/0013-bcache-remove-XXX-comment-line-from-run_cache_set.patch +++ b/for-next/0013-bcache-remove-XXX-comment-line-from-run_cache_set.patch @@ -1,7 +1,7 @@ From d0891cc1a275d20a2d1624b83fe72f2788e23d89 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Mon, 13 May 2019 23:47:38 +0800 -Subject: [PATCH 13/33] bcache: remove "XXX:" comment line from run_cache_set() +Subject: [PATCH 13/34] bcache: remove "XXX:" comment line from run_cache_set() In previous bcache patches for Linux v5.2, the failure code path of run_cache_set() is tested and fixed. So now the following comment diff --git a/for-next/0014-bcache-remove-unnecessary-prefetch-in-bset_search_tr.patch b/for-next/0014-bcache-remove-unnecessary-prefetch-in-bset_search_tr.patch index 75a0031..9a0fe6f 100644 --- a/for-next/0014-bcache-remove-unnecessary-prefetch-in-bset_search_tr.patch +++ b/for-next/0014-bcache-remove-unnecessary-prefetch-in-bset_search_tr.patch @@ -1,7 +1,7 @@ From 58fc044d74d97f0d0bf94ffab5d2776e73420ccf Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 14 May 2019 22:23:35 +0800 -Subject: [PATCH 14/33] bcache: remove unnecessary prefetch() in +Subject: [PATCH 14/34] bcache: remove unnecessary prefetch() in bset_search_tree() In function bset_search_tree(), when p >= t->size, t->tree[0] will be diff --git a/for-next/0015-bcache-use-sysfs_match_string-instead-of-__sysfs_mat.patch b/for-next/0015-bcache-use-sysfs_match_string-instead-of-__sysfs_mat.patch index 38607d5..cb1887d 100644 --- a/for-next/0015-bcache-use-sysfs_match_string-instead-of-__sysfs_mat.patch +++ b/for-next/0015-bcache-use-sysfs_match_string-instead-of-__sysfs_mat.patch @@ -1,7 +1,7 @@ From 5e78a110e7716a8f7f846c4f740e842066776aab Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean <alexandru.ardelean@analog.com> Date: Tue, 7 May 2019 12:43:12 +0300 -Subject: [PATCH 15/33] bcache: use sysfs_match_string() instead of +Subject: [PATCH 15/34] bcache: use sysfs_match_string() instead of __sysfs_match_string() The arrays (of strings) that are passed to __sysfs_match_string() are diff --git a/for-next/0016-bcache-add-return-value-check-to-bch_cached_dev_run.patch b/for-next/0016-bcache-add-return-value-check-to-bch_cached_dev_run.patch index 4d0f0cc..1579c23 100644 --- a/for-next/0016-bcache-add-return-value-check-to-bch_cached_dev_run.patch +++ b/for-next/0016-bcache-add-return-value-check-to-bch_cached_dev_run.patch @@ -1,7 +1,7 @@ From 1e06817bba2680b5a3a705b962e106491d4113c2 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 21 May 2019 22:16:38 +0800 -Subject: [PATCH 16/33] bcache: add return value check to bch_cached_dev_run() +Subject: [PATCH 16/34] bcache: add return value check to bch_cached_dev_run() This patch adds return value check to bch_cached_dev_run(), now if there is error happens inside bch_cached_dev_run(), it can be catched. diff --git a/for-next/0017-bcache-remove-unncessary-code-in-bch_btree_keys_init.patch b/for-next/0017-bcache-remove-unncessary-code-in-bch_btree_keys_init.patch index cb8a652..f3d3ffe 100644 --- a/for-next/0017-bcache-remove-unncessary-code-in-bch_btree_keys_init.patch +++ b/for-next/0017-bcache-remove-unncessary-code-in-bch_btree_keys_init.patch @@ -1,7 +1,7 @@ From 28860b47f365ea38d9fdd6a7aca62120b03fb158 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 21 May 2019 22:36:35 +0800 -Subject: [PATCH 17/33] bcache: remove unncessary code in bch_btree_keys_init() +Subject: [PATCH 17/34] bcache: remove unncessary code in bch_btree_keys_init() Function bch_btree_keys_init() initializes b->set[].size and b->set[].data to zero. As the code comments indicates, these code indeed diff --git a/for-next/0018-bcache-check-CACHE_SET_IO_DISABLE-in-allocator-code.patch b/for-next/0018-bcache-check-CACHE_SET_IO_DISABLE-in-allocator-code.patch index a2a36b3..9cf8efd 100644 --- a/for-next/0018-bcache-check-CACHE_SET_IO_DISABLE-in-allocator-code.patch +++ b/for-next/0018-bcache-check-CACHE_SET_IO_DISABLE-in-allocator-code.patch @@ -1,7 +1,7 @@ From de6a95f0edd1dc22e0174e2c87f49f222883ddda Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Wed, 22 May 2019 21:55:09 +0800 -Subject: [PATCH 18/33] bcache: check CACHE_SET_IO_DISABLE in allocator code +Subject: [PATCH 18/34] bcache: check CACHE_SET_IO_DISABLE in allocator code If CACHE_SET_IO_DISABLE of a cache set flag is set by too many I/O errors, currently allocator routines can still continue allocate diff --git a/for-next/0019-bcache-check-CACHE_SET_IO_DISABLE-bit-in-bch_journal.patch b/for-next/0019-bcache-check-CACHE_SET_IO_DISABLE-bit-in-bch_journal.patch index 35f0854..dea848c 100644 --- a/for-next/0019-bcache-check-CACHE_SET_IO_DISABLE-bit-in-bch_journal.patch +++ b/for-next/0019-bcache-check-CACHE_SET_IO_DISABLE-bit-in-bch_journal.patch @@ -1,7 +1,7 @@ From c0caa2eb59315da5fe55ce793982e3ead6af39d3 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Wed, 22 May 2019 22:06:21 +0800 -Subject: [PATCH 19/33] bcache: check CACHE_SET_IO_DISABLE bit in bch_journal() +Subject: [PATCH 19/34] bcache: check CACHE_SET_IO_DISABLE bit in bch_journal() When too many I/O errors happen on cache set and CACHE_SET_IO_DISABLE bit is set, bch_journal() may continue to work because the journaling diff --git a/for-next/0020-bcache-more-detailed-error-message-to-bcache_device_.patch b/for-next/0020-bcache-more-detailed-error-message-to-bcache_device_.patch index f9e0a81..0d8858c 100644 --- a/for-next/0020-bcache-more-detailed-error-message-to-bcache_device_.patch +++ b/for-next/0020-bcache-more-detailed-error-message-to-bcache_device_.patch @@ -1,7 +1,7 @@ From f664bdfa5f5d05a7c0511bba4f655fb82d83d2e3 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Sat, 1 Jun 2019 00:57:38 +0800 -Subject: [PATCH 20/33] bcache: more detailed error message to +Subject: [PATCH 20/34] bcache: more detailed error message to bcache_device_link() This patch adds more accurate error message for specific diff --git a/for-next/0021-bcache-add-more-error-message-in-bch_cached_dev_atta.patch b/for-next/0021-bcache-add-more-error-message-in-bch_cached_dev_atta.patch index 0bebf10..effe587 100644 --- a/for-next/0021-bcache-add-more-error-message-in-bch_cached_dev_atta.patch +++ b/for-next/0021-bcache-add-more-error-message-in-bch_cached_dev_atta.patch @@ -1,7 +1,7 @@ From 404f06144029ba4bc69157ac107c291b715e8113 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Sat, 1 Jun 2019 01:03:00 +0800 -Subject: [PATCH 21/33] bcache: add more error message in +Subject: [PATCH 21/34] bcache: add more error message in bch_cached_dev_attach() This patch adds more error message for attaching cached device, this is diff --git a/for-next/0022-bcache-shrink-btree-node-cache-after-bch_btree_check.patch b/for-next/0022-bcache-shrink-btree-node-cache-after-bch_btree_check.patch index 97301d3..9fe4c1f 100644 --- a/for-next/0022-bcache-shrink-btree-node-cache-after-bch_btree_check.patch +++ b/for-next/0022-bcache-shrink-btree-node-cache-after-bch_btree_check.patch @@ -1,7 +1,7 @@ From 9a722149db1875ca95d3e45ca192519b66cbe9fe Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Fri, 31 May 2019 17:29:56 +0800 -Subject: [PATCH 22/33] bcache: shrink btree node cache after bch_btree_check() +Subject: [PATCH 22/34] bcache: shrink btree node cache after bch_btree_check() When cache set starts, bch_btree_check() will check all bkeys on cache device by calculating the checksum. This operation will consume a huge diff --git a/for-next/0023-bcache-improve-error-message-in-bch_cached_dev_run.patch b/for-next/0023-bcache-improve-error-message-in-bch_cached_dev_run.patch index 7cdf6e3..eca207c 100644 --- a/for-next/0023-bcache-improve-error-message-in-bch_cached_dev_run.patch +++ b/for-next/0023-bcache-improve-error-message-in-bch_cached_dev_run.patch @@ -1,7 +1,7 @@ From c4373b657aae8d49c41d3f1afc37120df54540ef Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 4 Jun 2019 23:12:10 +0800 -Subject: [PATCH 23/33] bcache: improve error message in bch_cached_dev_run() +Subject: [PATCH 23/34] bcache: improve error message in bch_cached_dev_run() This patch adds more error message in bch_cached_dev_run() to indicate the exact reason why an error value is returned. Please notice when diff --git a/for-next/0024-bcache-make-bset_search_tree-be-more-understandable.patch b/for-next/0024-bcache-make-bset_search_tree-be-more-understandable.patch index b830b52..2dd21bb 100644 --- a/for-next/0024-bcache-make-bset_search_tree-be-more-understandable.patch +++ b/for-next/0024-bcache-make-bset_search_tree-be-more-understandable.patch @@ -1,7 +1,7 @@ From bb43d33242ce52472001beba44775a13ddec70b0 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 14 May 2019 22:51:40 +0800 -Subject: [PATCH 24/33] bcache: make bset_search_tree() be more understandable +Subject: [PATCH 24/34] bcache: make bset_search_tree() be more understandable The purpose of following code in bset_search_tree() is to avoid a branch instruction, diff --git a/for-next/0025-bcache-add-pendings_cleanup-to-stop-pending-bcache-d.patch b/for-next/0025-bcache-add-pendings_cleanup-to-stop-pending-bcache-d.patch index 254c917..bdc987a 100644 --- a/for-next/0025-bcache-add-pendings_cleanup-to-stop-pending-bcache-d.patch +++ b/for-next/0025-bcache-add-pendings_cleanup-to-stop-pending-bcache-d.patch @@ -1,7 +1,7 @@ From 71c14ccb7cda435316014fd284bf441ad39c77f8 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Wed, 20 Mar 2019 23:11:59 +0800 -Subject: [PATCH 25/33] bcache: add pendings_cleanup to stop pending bcache +Subject: [PATCH 25/34] bcache: add pendings_cleanup to stop pending bcache device If a bcache device is in dirty state and its cache set is not diff --git a/for-next/0026-bcache-avoid-a-deadlock-in-bcache_reboot.patch b/for-next/0026-bcache-avoid-a-deadlock-in-bcache_reboot.patch index e08a7ea..b8f356f 100644 --- a/for-next/0026-bcache-avoid-a-deadlock-in-bcache_reboot.patch +++ b/for-next/0026-bcache-avoid-a-deadlock-in-bcache_reboot.patch @@ -1,7 +1,7 @@ From 08346b7370529c92b0b1abf76f109130fa8eddf2 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 21 May 2019 23:19:55 +0800 -Subject: [PATCH 26/33] bcache: avoid a deadlock in bcache_reboot() +Subject: [PATCH 26/34] bcache: avoid a deadlock in bcache_reboot() It is quite frequently to observe deadlock in bcache_reboot() happens and hang the system reboot process. The reason is, in bcache_reboot() diff --git a/for-next/0027-bcache-acquire-bch_register_lock-later-in-cached_dev.patch b/for-next/0027-bcache-acquire-bch_register_lock-later-in-cached_dev.patch index 8841113..8e26a5d 100644 --- a/for-next/0027-bcache-acquire-bch_register_lock-later-in-cached_dev.patch +++ b/for-next/0027-bcache-acquire-bch_register_lock-later-in-cached_dev.patch @@ -1,7 +1,7 @@ From 0deec3a1f988e30100bbc6331c81ad83005fe7bd Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Sun, 2 Jun 2019 01:06:12 +0800 -Subject: [PATCH 27/33] bcache: acquire bch_register_lock later in +Subject: [PATCH 27/34] bcache: acquire bch_register_lock later in cached_dev_detach_finish() Now there is variable bcache_is_reboot to prevent device register or diff --git a/for-next/0028-bcache-acquire-bch_register_lock-later-in-cached_dev.patch b/for-next/0028-bcache-acquire-bch_register_lock-later-in-cached_dev.patch index 8848ea8..a96d5fc 100644 --- a/for-next/0028-bcache-acquire-bch_register_lock-later-in-cached_dev.patch +++ b/for-next/0028-bcache-acquire-bch_register_lock-later-in-cached_dev.patch @@ -1,7 +1,7 @@ From cccdcc9830be34090584d6414cf812ca4d309616 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Wed, 12 Jun 2019 21:10:38 +0800 -Subject: [PATCH 28/33] bcache: acquire bch_register_lock later in +Subject: [PATCH 28/34] bcache: acquire bch_register_lock later in cached_dev_free() When enable lockdep engine, a lockdep warning can be observed when diff --git a/for-next/0029-bcache-fix-potential-deadlock-in-cached_def_free.patch b/for-next/0029-bcache-fix-potential-deadlock-in-cached_def_free.patch index 4b072b7..0366195 100644 --- a/for-next/0029-bcache-fix-potential-deadlock-in-cached_def_free.patch +++ b/for-next/0029-bcache-fix-potential-deadlock-in-cached_def_free.patch @@ -1,7 +1,7 @@ From fe5fe8e4408a768e56f9ccab2570df7fc1c9b966 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Tue, 4 Jun 2019 14:28:33 +0800 -Subject: [PATCH 29/33] bcache: fix potential deadlock in cached_def_free() +Subject: [PATCH 29/34] bcache: fix potential deadlock in cached_def_free() When enable lockdep and reboot system with a writeback mode bcache device, the following potential deadlock warning is reported by lockdep diff --git a/for-next/0030-bcache-fix-mistaken-sysfs-entry-for-io_error-counter.patch b/for-next/0030-bcache-fix-mistaken-sysfs-entry-for-io_error-counter.patch index 9c2ec55..c6c374b 100644 --- a/for-next/0030-bcache-fix-mistaken-sysfs-entry-for-io_error-counter.patch +++ b/for-next/0030-bcache-fix-mistaken-sysfs-entry-for-io_error-counter.patch @@ -1,7 +1,7 @@ From 57d90a22b6bb8724f615d8cddb80484e92c3f003 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Sun, 16 Jun 2019 23:59:12 +0800 -Subject: [PATCH 30/33] bcache: fix mistaken sysfs entry for io_error counter +Subject: [PATCH 30/34] bcache: fix mistaken sysfs entry for io_error counter In bch_cached_dev_files[] from driver/md/bcache/sysfs.c, sysfs_errors is incorrectly inserted in. The correct entry should be sysfs_io_errors. diff --git a/for-next/0031-bcache-destroy-dc-writeback_write_wq-if-failed-to-cr.patch b/for-next/0031-bcache-destroy-dc-writeback_write_wq-if-failed-to-cr.patch index 5280e0c..18c4d09 100644 --- a/for-next/0031-bcache-destroy-dc-writeback_write_wq-if-failed-to-cr.patch +++ b/for-next/0031-bcache-destroy-dc-writeback_write_wq-if-failed-to-cr.patch @@ -1,7 +1,7 @@ From 0b0d53f84bf6bc92dc39e2a8b41ea4732b4f41b3 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Mon, 17 Jun 2019 00:06:58 +0800 -Subject: [PATCH 31/33] bcache: destroy dc->writeback_write_wq if failed to +Subject: [PATCH 31/34] bcache: destroy dc->writeback_write_wq if failed to create dc->writeback_thread Commit 9baf30972b55 ("bcache: fix for gc and write-back race") added a diff --git a/for-next/0032-bcache-stop-writeback-kthread-and-kworker-when-bch_c.patch b/for-next/0032-bcache-stop-writeback-kthread-and-kworker-when-bch_c.patch index 0d6e612..7b0b74b 100644 --- a/for-next/0032-bcache-stop-writeback-kthread-and-kworker-when-bch_c.patch +++ b/for-next/0032-bcache-stop-writeback-kthread-and-kworker-when-bch_c.patch @@ -1,7 +1,7 @@ From b593e9e38aa9f23a75f43bcba6f7b3b509927bc4 Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Mon, 17 Jun 2019 23:03:02 +0800 -Subject: [PATCH 32/33] bcache: stop writeback kthread and kworker when +Subject: [PATCH 32/34] bcache: stop writeback kthread and kworker when bch_cached_dev_run() failed In bch_cached_dev_attach() after bch_cached_dev_writeback_start() diff --git a/for-next/0033-bcache-Improve-bcache-tollerance-for-out-of-memory-c.patch b/for-next/0033-bcache-Improve-bcache-tollerance-for-out-of-memory-c.patch index c6173c3..ba6fc91 100644 --- a/for-next/0033-bcache-Improve-bcache-tollerance-for-out-of-memory-c.patch +++ b/for-next/0033-bcache-Improve-bcache-tollerance-for-out-of-memory-c.patch @@ -1,7 +1,7 @@ From 8e3b9957b5cec10f72f5a9c80fae3f960247137f Mon Sep 17 00:00:00 2001 From: Coly Li <colyli@suse.de> Date: Thu, 20 Jun 2019 16:57:35 +0800 -Subject: [PATCH 33/33] bcache: Improve bcache tollerance for out-of-memory +Subject: [PATCH 33/34] bcache: Improve bcache tollerance for out-of-memory condition Signed-off-by: Coly Li <colyli@suse.de> @@ -83,7 +83,7 @@ index 2cb2bf394df4..4aaa28f1f1bb 100644 + * a bit more memory can be allocated to lower layer drivers to + * handle flying I/Os to avoid system hang from a memory-relcaim + * loop-chain. -+ */ ++ */ + atomic_inc(&c->shrinker_counter); + if (atomic_read(&c->shrinker_counter) >= + atomic_read(&c->oom_reject_threshold)) { @@ -95,7 +95,7 @@ index 2cb2bf394df4..4aaa28f1f1bb 100644 + } else { + /* + * Reset c->shrinker_counter if no more shrinker -+ * calls in a short period ++ * calls in a short period + */ + mod_delayed_work(system_wq, &c->shrinker_delayed_work, HZ); + } diff --git a/for-next/0033-bcache-reject-new-requests-when-out-of-memmory.patch b/for-next/0033-bcache-reject-new-requests-when-out-of-memmory.patch deleted file mode 100644 index 515af2c..0000000 --- a/for-next/0033-bcache-reject-new-requests-when-out-of-memmory.patch +++ /dev/null @@ -1,203 +0,0 @@ -From d3c5ff44a81b487cdcfe3311c37498abafc8f47a Mon Sep 17 00:00:00 2001 -From: Coly Li <colyli@suse.de> -Date: Thu, 20 Jun 2019 16:57:35 +0800 -Subject: [PATCH 33/33] bcache: reject new requests when out-of-memmory - -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/bcache.h | 10 ++++++++++ - drivers/md/bcache/btree.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ - drivers/md/bcache/request.c | 12 ++++++++++++ - drivers/md/bcache/super.c | 13 +++++++++++++ - 4 files changed, 82 insertions(+) - -diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h -index 013e35a9e317..e753d8ee8935 100644 ---- a/drivers/md/bcache/bcache.h -+++ b/drivers/md/bcache/bcache.h -@@ -493,11 +493,15 @@ struct gc_stat { - * CACHE_SET_IO_DISABLE is set when bcache is stopping the whold cache set, all - * external and internal I/O should be denied when this flag is set. - * -+ * CACHE_SET_OOM_REJECT is set when system memory is out, bcache has to reject -+ * new coming I/O requests and return BLK_STS_RESOURCE. -+ * - */ - #define CACHE_SET_UNREGISTERING 0 - #define CACHE_SET_STOPPING 1 - #define CACHE_SET_RUNNING 2 - #define CACHE_SET_IO_DISABLE 3 -+#define CACHE_SET_OOM_REJECT 4 - - struct cache_set { - struct closure cl; -@@ -716,6 +720,12 @@ struct cache_set { - unsigned int error_limit; - unsigned int error_decay; - -+ struct closure oom_dework_cl; -+#define DEFAULT_OOM_REJECT_THREASHOLD 1000 -+ atomic_t shrinker_counter; -+ atomic_t oom_reject_threshold; -+ struct delayed_work shrinker_delayed_work; -+ - unsigned short journal_delay_ms; - bool expensive_debug_checks; - unsigned int verify:1; -diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c -index 2cb2bf394df4..8e263de40cdf 100644 ---- a/drivers/md/bcache/btree.c -+++ b/drivers/md/bcache/btree.c -@@ -683,6 +683,21 @@ static int mca_reap(struct btree *b, unsigned int min_order, bool flush) - return -ENOMEM; - } - -+static void shrinker_oom_delayed_work(struct work_struct *work) -+{ -+ struct cache_set *c = container_of(to_delayed_work(work), -+ struct cache_set, -+ shrinker_delayed_work); -+ -+ clear_bit(CACHE_SET_OOM_REJECT, &c->flags); -+ atomic_set(&c->shrinker_counter, 0); -+ /* -+ * let others know earlier to -+ * reject new coming requests -+ */ -+ smp_mb(); -+} -+ - static unsigned long bch_mca_scan(struct shrinker *shrink, - struct shrink_control *sc) - { -@@ -698,6 +713,31 @@ static unsigned long bch_mca_scan(struct shrinker *shrink, - if (c->btree_cache_alloc_lock) - return SHRINK_STOP; - -+ /* bcache tries to reject new request if oom happens */ -+ atomic_inc(&c->shrinker_counter); -+ if (atomic_read(&c->shrinker_counter) >= -+ atomic_read(&c->oom_reject_threshold)) { -+ /* -+ * Test CACHE_SET_OOM_REJECT bit to avoid an extra smp_mb(). -+ * But if CACHE_SET_OOM_REJECT is set on other cores and not -+ * updated locally yet, setting the bit again and a smb_mb() -+ * don't hurt too much here. -+ */ -+ if (!test_and_set_bit(CACHE_SET_OOM_REJECT, &c->flags)) -+ /* -+ * let others know earlier to -+ * reject new coming requests -+ */ -+ smp_mb(); -+ mod_delayed_work(system_wq, &c->shrinker_delayed_work, 2); -+ } else { -+ /* -+ * Reset c->shrinker_counter if no more shrinker -+ * calls in short term -+ */ -+ mod_delayed_work(system_wq, &c->shrinker_delayed_work, HZ); -+ } -+ - /* Return -1 if we can't do anything right now */ - if (sc->gfp_mask & __GFP_IO) - mutex_lock(&c->bucket_lock); -@@ -771,6 +811,8 @@ void bch_btree_cache_free(struct cache_set *c) - - closure_init_stack(&cl); - -+ cancel_delayed_work_sync(&c->shrinker_delayed_work); -+ - if (c->shrink.list.next) - unregister_shrinker(&c->shrink); - -@@ -833,6 +875,11 @@ int bch_btree_cache_alloc(struct cache_set *c) - c->verify_data = NULL; - #endif - -+ atomic_set(&c->oom_reject_threshold, -+ DEFAULT_OOM_REJECT_THREASHOLD); -+ INIT_DELAYED_WORK(&c->shrinker_delayed_work, -+ shrinker_oom_delayed_work); -+ - c->shrink.count_objects = bch_mca_count; - c->shrink.scan_objects = bch_mca_scan; - c->shrink.seeks = 4; -diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c -index 41adcd1546f1..a7a570a881cc 100644 ---- a/drivers/md/bcache/request.c -+++ b/drivers/md/bcache/request.c -@@ -1181,6 +1181,12 @@ static blk_qc_t cached_dev_make_request(struct request_queue *q, - return BLK_QC_T_NONE; - } - -+ if (unlikely(d->c && test_bit(CACHE_SET_OOM_REJECT, &d->c->flags))) { -+ bio->bi_status = BLK_STS_RESOURCE; -+ bio_endio(bio); -+ return BLK_QC_T_NONE; -+ } -+ - if (likely(d->c)) { - if (atomic_read(&d->c->idle_counter)) - atomic_set(&d->c->idle_counter, 0); -@@ -1319,6 +1325,12 @@ static blk_qc_t flash_dev_make_request(struct request_queue *q, - return BLK_QC_T_NONE; - } - -+ if (unlikely(d->c && test_bit(CACHE_SET_OOM_REJECT, &d->c->flags))) { -+ bio->bi_status = BLK_STS_RESOURCE; -+ bio_endio(bio); -+ return BLK_QC_T_NONE; -+ } -+ - generic_start_io_acct(q, bio_op(bio), bio_sectors(bio), &d->disk->part0); - - s = search_alloc(bio, d); -diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c -index 0f79d3e83d20..72da84584bcf 100644 ---- a/drivers/md/bcache/super.c -+++ b/drivers/md/bcache/super.c -@@ -1619,6 +1619,14 @@ static void cache_set_flush(struct closure *cl) - c->journal.work.work.func(&c->journal.work.work); - } - -+ -+ /* -+ * c->oom_dework_cl must be dropped here, otherwise the -+ * following closure_return(cl) won't call cache_set_free() -+ * because c->cl is parent closure of c->oom_dework_cl. -+ */ -+ closure_put(&c->oom_dework_cl); -+ - closure_return(cl); - } - -@@ -1739,6 +1747,8 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) - closure_init(&c->caching, &c->cl); - set_closure_fn(&c->caching, __cache_set_unregister, system_wq); - -+ closure_init(&c->oom_dework_cl, &c->cl); -+ - /* Maybe create continue_at_noreturn() and use it here? */ - closure_set_stopped(&c->cl); - closure_put(&c->cl); -@@ -1807,6 +1817,7 @@ struct cache_set *bch_cache_set_alloc(struct cache_sb *sb) - c->congested_write_threshold_us = 20000; - c->error_limit = DEFAULT_IO_ERROR_LIMIT; - WARN_ON(test_and_clear_bit(CACHE_SET_IO_DISABLE, &c->flags)); -+ WARN_ON(test_and_clear_bit(CACHE_SET_OOM_REJECT, &c->flags)); - - return c; - err: -@@ -1996,6 +2007,8 @@ static int run_cache_set(struct cache_set *c) - - flash_devs_run(c); - -+ closure_get(&c->oom_dework_cl); -+ - set_bit(CACHE_SET_RUNNING, &c->flags); - return 0; - err: --- -2.16.4 - diff --git a/for-next/0034-bcache-don-t-set-max-writeback-rate-if-gc-is-running.patch b/for-next/0034-bcache-don-t-set-max-writeback-rate-if-gc-is-running.patch new file mode 100644 index 0000000..e48b653 --- /dev/null +++ b/for-next/0034-bcache-don-t-set-max-writeback-rate-if-gc-is-running.patch @@ -0,0 +1,41 @@ +From b55740a40cc650bf43e6e239593a978b3364c6a6 Mon Sep 17 00:00:00 2001 +From: Coly Li <colyli@suse.de> +Date: Fri, 21 Jun 2019 01:46:20 +0800 +Subject: [PATCH 34/34] bcache: don't set max writeback rate if gc is running + +When gc is running, user space I/O processes may wait inside +bcache code, so no new I/O coming. Indeed this is not a real idle +time, maximum writeback rate should not be set in such situation. +Otherwise a faster writeback thread may compete locks with gc thread +and makes garbage collection slower, which results a longer I/O +freeze period. + +This patch checks c->gc_mark_valid in set_at_max_writeback_rate(). If +c->gc_mark_valid is 0 (gc running), set_at_max_writeback_rate() returns +false, then update_writeback_rate() will not set writeback rate to +maximum value even c->idle_counter reaches an idle threshold. + +Now writeback thread won't interfere gc thread performance. + +Signed-off-by: Coly Li <colyli@suse.de> +--- + drivers/md/bcache/writeback.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c +index e9ffcea1ca50..d60268fe49e1 100644 +--- a/drivers/md/bcache/writeback.c ++++ b/drivers/md/bcache/writeback.c +@@ -122,6 +122,9 @@ static void __update_writeback_rate(struct cached_dev *dc) + static bool set_at_max_writeback_rate(struct cache_set *c, + struct cached_dev *dc) + { ++ /* Don't set max writeback rate if gc is running */ ++ if (!c->gc_mark_valid) ++ return false; + /* + * Idle_counter is increased everytime when update_writeback_rate() is + * called. If all backing devices attached to the same cache set have +-- +2.16.4 + |