Loading fs/bcachefs/data_update.c +21 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,13 @@ #include <linux/ioprio.h> static const char * const bch2_data_update_type_strs[] = { #define x(t, n, ...) [n] = #t, BCH_DATA_UPDATE_TYPES() #undef x NULL }; static void bkey_put_dev_refs(struct bch_fs *c, struct bkey_s_c k) { struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); Loading Loading @@ -181,6 +188,7 @@ static int __bch2_data_update_index_update(struct btree_trans *trans, container_of(op, struct data_update, op); struct keylist *keys = &op->insert_keys; struct bkey_buf _new, _insert; struct printbuf journal_msg = PRINTBUF; int ret = 0; bch2_bkey_buf_init(&_new); Loading Loading @@ -372,7 +380,12 @@ static int __bch2_data_update_index_update(struct btree_trans *trans, printbuf_exit(&buf); } ret = bch2_insert_snapshot_whiteouts(trans, m->btree_id, printbuf_reset(&journal_msg); prt_str(&journal_msg, bch2_data_update_type_strs[m->type]); ret = bch2_trans_log_msg(trans, &journal_msg) ?: bch2_trans_log_bkey(trans, m->btree_id, 0, m->k.k) ?: bch2_insert_snapshot_whiteouts(trans, m->btree_id, k.k->p, bkey_start_pos(&insert->k)) ?: bch2_insert_snapshot_whiteouts(trans, m->btree_id, k.k->p, insert->k.p) ?: Loading Loading @@ -417,6 +430,7 @@ static int __bch2_data_update_index_update(struct btree_trans *trans, goto next; } out: printbuf_exit(&journal_msg); bch2_trans_iter_exit(trans, &iter); bch2_bkey_buf_exit(&_insert, c); bch2_bkey_buf_exit(&_new, c); Loading Loading @@ -577,6 +591,9 @@ void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c, void bch2_data_update_to_text(struct printbuf *out, struct data_update *m) { prt_str(out, bch2_data_update_type_strs[m->type]); prt_newline(out); bch2_data_update_opts_to_text(out, m->op.c, &m->op.opts, &m->data_opts); prt_newline(out); Loading Loading @@ -738,6 +755,9 @@ int bch2_data_update_init(struct btree_trans *trans, bch2_bkey_buf_init(&m->k); bch2_bkey_buf_reassemble(&m->k, c, k); m->type = data_opts.btree_insert_flags & BCH_WATERMARK_copygc ? BCH_DATA_UPDATE_copygc : BCH_DATA_UPDATE_rebalance; m->btree_id = btree_id; m->data_opts = data_opts; m->ctxt = ctxt; Loading fs/bcachefs/data_update.h +12 −0 Original line number Diff line number Diff line Loading @@ -24,7 +24,19 @@ struct data_update_opts { void bch2_data_update_opts_to_text(struct printbuf *, struct bch_fs *, struct bch_io_opts *, struct data_update_opts *); #define BCH_DATA_UPDATE_TYPES() \ x(copygc, 0) \ x(rebalance, 1) \ x(promote, 2) enum bch_data_update_types { #define x(n, id) BCH_DATA_UPDATE_##n = id, BCH_DATA_UPDATE_TYPES() #undef x }; struct data_update { enum bch_data_update_types type; /* extent being updated: */ bool read_done; enum btree_id btree_id; Loading fs/bcachefs/io_read.c +1 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,7 @@ static struct bch_read_bio *__promote_alloc(struct btree_trans *trans, &orig->opts, update_opts, btree_id, k); op->write.type = BCH_DATA_UPDATE_promote; /* * possible errors: -BCH_ERR_nocow_lock_blocked, * -BCH_ERR_ENOSPC_disk_reservation: Loading Loading
fs/bcachefs/data_update.c +21 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,13 @@ #include <linux/ioprio.h> static const char * const bch2_data_update_type_strs[] = { #define x(t, n, ...) [n] = #t, BCH_DATA_UPDATE_TYPES() #undef x NULL }; static void bkey_put_dev_refs(struct bch_fs *c, struct bkey_s_c k) { struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k); Loading Loading @@ -181,6 +188,7 @@ static int __bch2_data_update_index_update(struct btree_trans *trans, container_of(op, struct data_update, op); struct keylist *keys = &op->insert_keys; struct bkey_buf _new, _insert; struct printbuf journal_msg = PRINTBUF; int ret = 0; bch2_bkey_buf_init(&_new); Loading Loading @@ -372,7 +380,12 @@ static int __bch2_data_update_index_update(struct btree_trans *trans, printbuf_exit(&buf); } ret = bch2_insert_snapshot_whiteouts(trans, m->btree_id, printbuf_reset(&journal_msg); prt_str(&journal_msg, bch2_data_update_type_strs[m->type]); ret = bch2_trans_log_msg(trans, &journal_msg) ?: bch2_trans_log_bkey(trans, m->btree_id, 0, m->k.k) ?: bch2_insert_snapshot_whiteouts(trans, m->btree_id, k.k->p, bkey_start_pos(&insert->k)) ?: bch2_insert_snapshot_whiteouts(trans, m->btree_id, k.k->p, insert->k.p) ?: Loading Loading @@ -417,6 +430,7 @@ static int __bch2_data_update_index_update(struct btree_trans *trans, goto next; } out: printbuf_exit(&journal_msg); bch2_trans_iter_exit(trans, &iter); bch2_bkey_buf_exit(&_insert, c); bch2_bkey_buf_exit(&_new, c); Loading Loading @@ -577,6 +591,9 @@ void bch2_data_update_opts_to_text(struct printbuf *out, struct bch_fs *c, void bch2_data_update_to_text(struct printbuf *out, struct data_update *m) { prt_str(out, bch2_data_update_type_strs[m->type]); prt_newline(out); bch2_data_update_opts_to_text(out, m->op.c, &m->op.opts, &m->data_opts); prt_newline(out); Loading Loading @@ -738,6 +755,9 @@ int bch2_data_update_init(struct btree_trans *trans, bch2_bkey_buf_init(&m->k); bch2_bkey_buf_reassemble(&m->k, c, k); m->type = data_opts.btree_insert_flags & BCH_WATERMARK_copygc ? BCH_DATA_UPDATE_copygc : BCH_DATA_UPDATE_rebalance; m->btree_id = btree_id; m->data_opts = data_opts; m->ctxt = ctxt; Loading
fs/bcachefs/data_update.h +12 −0 Original line number Diff line number Diff line Loading @@ -24,7 +24,19 @@ struct data_update_opts { void bch2_data_update_opts_to_text(struct printbuf *, struct bch_fs *, struct bch_io_opts *, struct data_update_opts *); #define BCH_DATA_UPDATE_TYPES() \ x(copygc, 0) \ x(rebalance, 1) \ x(promote, 2) enum bch_data_update_types { #define x(n, id) BCH_DATA_UPDATE_##n = id, BCH_DATA_UPDATE_TYPES() #undef x }; struct data_update { enum bch_data_update_types type; /* extent being updated: */ bool read_done; enum btree_id btree_id; Loading
fs/bcachefs/io_read.c +1 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,7 @@ static struct bch_read_bio *__promote_alloc(struct btree_trans *trans, &orig->opts, update_opts, btree_id, k); op->write.type = BCH_DATA_UPDATE_promote; /* * possible errors: -BCH_ERR_nocow_lock_blocked, * -BCH_ERR_ENOSPC_disk_reservation: Loading