summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-12-28 14:16:51 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2021-12-28 14:16:51 -0500
commit23daf631c818171e0cab891281fa2e0c8fbaf359 (patch)
treed8653efa678fcb174b1b5e9c0bb24e849232715c
parent018b8942e39b2f2230c4007e9b76e8a052d2b7d2 (diff)
Update bcachefs sources to cb8f72ac24 bcachefs: Fix bch2_btree_cache_scan()compat
-rw-r--r--.bcachefs_revision2
-rw-r--r--libbcachefs/btree_cache.c10
2 files changed, 9 insertions, 3 deletions
diff --git a/.bcachefs_revision b/.bcachefs_revision
index 6c68e29..7ef4600 100644
--- a/.bcachefs_revision
+++ b/.bcachefs_revision
@@ -1 +1 @@
-ddd56385a0c3294f169bb44220ae702717fbcebf
+cb8f72ac2486edca517f4778be77bdc9efd5eaba
diff --git a/libbcachefs/btree_cache.c b/libbcachefs/btree_cache.c
index 19c219c..76ff1f3 100644
--- a/libbcachefs/btree_cache.c
+++ b/libbcachefs/btree_cache.c
@@ -280,13 +280,19 @@ static unsigned long bch2_btree_cache_scan(struct shrinker *shrink,
i = 0;
list_for_each_entry_safe(b, t, &bc->freeable, list) {
+ /*
+ * Leave a few nodes on the freeable list, so that a btree split
+ * won't have to hit the system allocator:
+ */
+ if (++i <= 3)
+ continue;
+
touched++;
if (freed >= nr)
break;
- if (++i > 3 &&
- !btree_node_reclaim(c, b)) {
+ if (!btree_node_reclaim(c, b)) {
btree_node_data_free(c, b);
six_unlock_write(&b->c.lock);
six_unlock_intent(&b->c.lock);