|
22 | 22 |
|
23 | 23 | #include <linux/ioprio.h>
|
24 | 24 |
|
| 25 | +static const char * const bch2_data_update_type_strs[] = { |
| 26 | +#define x(t, n, ...) [n] = #t, |
| 27 | + BCH_DATA_UPDATE_TYPES() |
| 28 | +#undef x |
| 29 | + NULL |
| 30 | +}; |
| 31 | + |
25 | 32 | static void bkey_put_dev_refs(struct bch_fs *c, struct bkey_s_c k)
|
26 | 33 | {
|
27 | 34 | struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
|
@@ -181,6 +188,7 @@ static int __bch2_data_update_index_update(struct btree_trans *trans,
|
181 | 188 | container_of(op, struct data_update, op);
|
182 | 189 | struct keylist *keys = &op->insert_keys;
|
183 | 190 | struct bkey_buf _new, _insert;
|
| 191 | + struct printbuf journal_msg = PRINTBUF; |
184 | 192 | int ret = 0;
|
185 | 193 |
|
186 | 194 | bch2_bkey_buf_init(&_new);
|
@@ -372,7 +380,12 @@ static int __bch2_data_update_index_update(struct btree_trans *trans,
|
372 | 380 | printbuf_exit(&buf);
|
373 | 381 | }
|
374 | 382 |
|
375 |
| - ret = bch2_insert_snapshot_whiteouts(trans, m->btree_id, |
| 383 | + printbuf_reset(&journal_msg); |
| 384 | + prt_str(&journal_msg, bch2_data_update_type_strs[m->type]); |
| 385 | + |
| 386 | + ret = bch2_trans_log_msg(trans, &journal_msg) ?: |
| 387 | + bch2_trans_log_bkey(trans, m->btree_id, 0, m->k.k) ?: |
| 388 | + bch2_insert_snapshot_whiteouts(trans, m->btree_id, |
376 | 389 | k.k->p, bkey_start_pos(&insert->k)) ?:
|
377 | 390 | bch2_insert_snapshot_whiteouts(trans, m->btree_id,
|
378 | 391 | k.k->p, insert->k.p) ?:
|
@@ -417,6 +430,7 @@ static int __bch2_data_update_index_update(struct btree_trans *trans,
|
417 | 430 | goto next;
|
418 | 431 | }
|
419 | 432 | out:
|
| 433 | + printbuf_exit(&journal_msg); |
420 | 434 | bch2_trans_iter_exit(trans, &iter);
|
421 | 435 | bch2_bkey_buf_exit(&_insert, c);
|
422 | 436 | bch2_bkey_buf_exit(&_new, c);
|
@@ -577,6 +591,9 @@ void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c,
|
577 | 591 |
|
578 | 592 | void bch2_data_update_to_text(struct printbuf *out, struct data_update *m)
|
579 | 593 | {
|
| 594 | + prt_str(out, bch2_data_update_type_strs[m->type]); |
| 595 | + prt_newline(out); |
| 596 | + |
580 | 597 | bch2_data_update_opts_to_text(out, m->op.c, &m->op.opts, &m->data_opts);
|
581 | 598 | prt_newline(out);
|
582 | 599 |
|
@@ -738,6 +755,9 @@ int bch2_data_update_init(struct btree_trans *trans,
|
738 | 755 |
|
739 | 756 | bch2_bkey_buf_init(&m->k);
|
740 | 757 | bch2_bkey_buf_reassemble(&m->k, c, k);
|
| 758 | + m->type = data_opts.btree_insert_flags & BCH_WATERMARK_copygc |
| 759 | + ? BCH_DATA_UPDATE_copygc |
| 760 | + : BCH_DATA_UPDATE_rebalance; |
741 | 761 | m->btree_id = btree_id;
|
742 | 762 | m->data_opts = data_opts;
|
743 | 763 | m->ctxt = ctxt;
|
|
0 commit comments