diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-08-18 01:51:13 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-08-19 02:41:50 +0200 |
commit | d6d539c9a7ad0655e5ad46b5e869f1b20bce8953 (patch) | |
tree | ff39c31e34ef8750511e086d4d14ede8d6caaff9 /fs | |
parent | bcachefs: Fix locking in __bch2_trans_mark_dev_sb() (diff) | |
download | linux-d6d539c9a7ad0655e5ad46b5e869f1b20bce8953.tar.xz linux-d6d539c9a7ad0655e5ad46b5e869f1b20bce8953.zip |
bcachefs: Reallocate table when we're increasing size
Fixes: c2f6e16a6771 ("bcachefs: Increase size of cuckoo hash table on too many rehashes")
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bcachefs/buckets_waiting_for_journal.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/buckets_waiting_for_journal.c b/fs/bcachefs/buckets_waiting_for_journal.c index f70eb2127d32..f9fb150eda70 100644 --- a/fs/bcachefs/buckets_waiting_for_journal.c +++ b/fs/bcachefs/buckets_waiting_for_journal.c @@ -107,7 +107,7 @@ int bch2_set_bucket_needs_journal_commit(struct buckets_waiting_for_journal *b, nr_elements += t->d[i].journal_seq > flushed_seq; new_bits = ilog2(roundup_pow_of_two(nr_elements * 3)); - +realloc: n = kvmalloc(sizeof(*n) + (sizeof(n->d[0]) << new_bits), GFP_KERNEL); if (!n) { ret = -BCH_ERR_ENOMEM_buckets_waiting_for_journal_set; @@ -118,6 +118,8 @@ retry_rehash: if (nr_rehashes_this_size == 3) { new_bits++; nr_rehashes_this_size = 0; + kvfree(n); + goto realloc; } nr_rehashes++; |