diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-07-03 19:23:58 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-07-10 15:53:39 +0200 |
commit | f49d2c9835f95fa078ea8a8eba6de9cbddb9eb33 (patch) | |
tree | 581adb6de6ecd275da6921f8157fd9d1e3f8e537 /fs/bcachefs/data_update.c | |
parent | bcachefs: bch2_data_update_to_text() (diff) | |
download | linux-f49d2c9835f95fa078ea8a8eba6de9cbddb9eb33.tar.xz linux-f49d2c9835f95fa078ea8a8eba6de9cbddb9eb33.zip |
bcachefs: Warn on attempting a move with no replicas
Instead of popping an assert in bch2_write(), WARN and print out some
debugging info.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/data_update.c')
-rw-r--r-- | fs/bcachefs/data_update.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/bcachefs/data_update.c b/fs/bcachefs/data_update.c index eeae760a15d3..0087b8555ead 100644 --- a/fs/bcachefs/data_update.c +++ b/fs/bcachefs/data_update.c @@ -677,6 +677,16 @@ int bch2_data_update_init(struct btree_trans *trans, if (!(durability_have + durability_removing)) m->op.nr_replicas = max((unsigned) m->op.nr_replicas, 1); + if (!m->op.nr_replicas) { + struct printbuf buf = PRINTBUF; + + bch2_data_update_to_text(&buf, m); + WARN(1, "trying to move an extent, but nr_replicas=0\n%s", buf.buf); + printbuf_exit(&buf); + ret = -BCH_ERR_data_update_done; + goto done; + } + m->op.nr_replicas_required = m->op.nr_replicas; if (reserve_sectors) { |