mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2025-04-19 20:58:31 +09:00
bcachefs: Use sort_nonatomic() instead of sort()
Fixes "task out to lunch" warnings during recovery on large machines with lots of dirty data in the journal. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
c92896ffb7
commit
55fd97fbc4
@ -644,8 +644,6 @@ void bch2_btree_and_journal_iter_init_node_iter(struct btree_trans *trans,
|
||||
*/
|
||||
static int journal_sort_key_cmp(const void *_l, const void *_r)
|
||||
{
|
||||
cond_resched();
|
||||
|
||||
const struct journal_key *l = _l;
|
||||
const struct journal_key *r = _r;
|
||||
|
||||
@ -689,7 +687,8 @@ void bch2_journal_keys_put(struct bch_fs *c)
|
||||
|
||||
static void __journal_keys_sort(struct journal_keys *keys)
|
||||
{
|
||||
sort(keys->data, keys->nr, sizeof(keys->data[0]), journal_sort_key_cmp, NULL);
|
||||
sort_nonatomic(keys->data, keys->nr, sizeof(keys->data[0]),
|
||||
journal_sort_key_cmp, NULL);
|
||||
|
||||
cond_resched();
|
||||
|
||||
|
@ -398,7 +398,7 @@ int bch2_scan_for_btree_nodes(struct bch_fs *c)
|
||||
bch2_print_string_as_lines(KERN_INFO, buf.buf);
|
||||
}
|
||||
|
||||
sort(f->nodes.data, f->nodes.nr, sizeof(f->nodes.data[0]), found_btree_node_cmp_cookie, NULL);
|
||||
sort_nonatomic(f->nodes.data, f->nodes.nr, sizeof(f->nodes.data[0]), found_btree_node_cmp_cookie, NULL);
|
||||
|
||||
dst = 0;
|
||||
darray_for_each(f->nodes, i) {
|
||||
@ -418,7 +418,7 @@ int bch2_scan_for_btree_nodes(struct bch_fs *c)
|
||||
}
|
||||
f->nodes.nr = dst;
|
||||
|
||||
sort(f->nodes.data, f->nodes.nr, sizeof(f->nodes.data[0]), found_btree_node_cmp_pos, NULL);
|
||||
sort_nonatomic(f->nodes.data, f->nodes.nr, sizeof(f->nodes.data[0]), found_btree_node_cmp_pos, NULL);
|
||||
|
||||
if (0 && c->opts.verbose) {
|
||||
printbuf_reset(&buf);
|
||||
|
@ -428,10 +428,10 @@ static int bch2_btree_write_buffer_flush_locked(struct btree_trans *trans)
|
||||
*/
|
||||
trace_and_count(c, write_buffer_flush_slowpath, trans, slowpath, wb->flushing.keys.nr);
|
||||
|
||||
sort(wb->flushing.keys.data,
|
||||
wb->flushing.keys.nr,
|
||||
sizeof(wb->flushing.keys.data[0]),
|
||||
wb_key_seq_cmp, NULL);
|
||||
sort_nonatomic(wb->flushing.keys.data,
|
||||
wb->flushing.keys.nr,
|
||||
sizeof(wb->flushing.keys.data[0]),
|
||||
wb_key_seq_cmp, NULL);
|
||||
|
||||
darray_for_each(wb->flushing.keys, i) {
|
||||
if (!i->journal_seq)
|
||||
|
@ -389,9 +389,9 @@ int bch2_journal_replay(struct bch_fs *c)
|
||||
* Now, replay any remaining keys in the order in which they appear in
|
||||
* the journal, unpinning those journal entries as we go:
|
||||
*/
|
||||
sort(keys_sorted.data, keys_sorted.nr,
|
||||
sizeof(keys_sorted.data[0]),
|
||||
journal_sort_seq_cmp, NULL);
|
||||
sort_nonatomic(keys_sorted.data, keys_sorted.nr,
|
||||
sizeof(keys_sorted.data[0]),
|
||||
journal_sort_seq_cmp, NULL);
|
||||
|
||||
darray_for_each(keys_sorted, kp) {
|
||||
cond_resched();
|
||||
|
Loading…
x
Reference in New Issue
Block a user