diff options
Diffstat (limited to 'fs/bcachefs/move.c')
-rw-r--r-- | fs/bcachefs/move.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c index 4f41f1f6ec6c..c46a8965a7eb 100644 --- a/fs/bcachefs/move.c +++ b/fs/bcachefs/move.c @@ -121,6 +121,7 @@ struct moving_io { static void move_free(struct moving_io *io) { struct moving_context *ctxt = io->write.ctxt; + struct bch_fs *c = io->write.op.c; if (io->b) atomic_dec(&io->b->count); @@ -132,8 +133,9 @@ static void move_free(struct moving_io *io) if (!io->write.data_opts.scrub) { bch2_data_update_exit(&io->write); } else { - bch2_bio_free_pages_pool(io->write.op.c, &io->write.op.wbio.bio); + bch2_bio_free_pages_pool(c, &io->write.op.wbio.bio); kfree(io->write.bvecs); + bch2_bkey_buf_exit(&io->write.k, c); } kfree(io); } @@ -427,7 +429,9 @@ int bch2_move_extent(struct moving_context *ctxt, data_opts.scrub ? data_opts.read_dev : -1); return 0; err: + bch2_bkey_buf_exit(&io->write.k, c); kfree(io); + if (bch2_err_matches(ret, EROFS) || bch2_err_matches(ret, BCH_ERR_transaction_restart)) return ret; @@ -863,7 +867,8 @@ static int __bch2_move_data_phys(struct moving_context *ctxt, u64 check_mismatch_done = bucket_start; int ret = 0; - CLASS(bch2_dev_tryget, ca)(c, dev); + /* Userspace might have supplied @dev: */ + CLASS(bch2_dev_tryget_noerror, ca)(c, dev); if (!ca) return 0; @@ -1400,7 +1405,7 @@ void bch2_move_stats_to_text(struct printbuf *out, struct bch_move_stats *stats) prt_str(out, " pos="); bch2_bbpos_to_text(out, stats->pos); prt_newline(out); - printbuf_indent_add(out, 2); + guard(printbuf_indent)(out); prt_printf(out, "keys moved:\t%llu\n", atomic64_read(&stats->keys_moved)); prt_printf(out, "keys raced:\t%llu\n", atomic64_read(&stats->keys_raced)); @@ -1415,8 +1420,6 @@ void bch2_move_stats_to_text(struct printbuf *out, struct bch_move_stats *stats) prt_printf(out, "bytes raced:\t"); prt_human_readable_u64(out, atomic64_read(&stats->sectors_raced) << 9); prt_newline(out); - - printbuf_indent_sub(out, 2); } static void bch2_moving_ctxt_to_text(struct printbuf *out, struct bch_fs *c, struct moving_context *ctxt) @@ -1425,7 +1428,7 @@ static void bch2_moving_ctxt_to_text(struct printbuf *out, struct bch_fs *c, str printbuf_tabstop_push(out, 32); bch2_move_stats_to_text(out, ctxt->stats); - printbuf_indent_add(out, 2); + guard(printbuf_indent)(out); prt_printf(out, "reads: ios %u/%u sectors %u/%u\n", atomic_read(&ctxt->read_ios), @@ -1439,15 +1442,13 @@ static void bch2_moving_ctxt_to_text(struct printbuf *out, struct bch_fs *c, str atomic_read(&ctxt->write_sectors), c->opts.move_bytes_in_flight >> 9); - printbuf_indent_add(out, 2); + guard(printbuf_indent)(out); scoped_guard(mutex, &ctxt->lock) { struct moving_io *io; list_for_each_entry(io, &ctxt->ios, io_list) bch2_data_update_inflight_to_text(out, &io->write); } - - printbuf_indent_sub(out, 4); } void bch2_fs_moving_ctxts_to_text(struct printbuf *out, struct bch_fs *c) |