diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-04 23:02:34 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-04 23:21:19 -0500 |
commit | 70ab09ea1f9cf56f631754b165cd8a4ada712077 (patch) | |
tree | 02075b3d0c2f98cb9506c53721f2c283ba2635ba /fs/bcachefs/btree_io.c | |
parent | 44a638c34ee6e3dcfe54540e46b78211b1c51144 (diff) |
debug for btree_io assertdaniel-debug
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_io.c')
-rw-r--r-- | fs/bcachefs/btree_io.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c index a6ac68fe90fb..29a81439e050 100644 --- a/fs/bcachefs/btree_io.c +++ b/fs/bcachefs/btree_io.c @@ -2007,6 +2007,27 @@ do_write: /* buffer must be a multiple of the block size */ bytes = round_up(bytes, block_bytes(c)); + if (bytes > btree_bytes(c)) { + struct printbuf buf = PRINTBUF; + + prt_printf(&buf, "bytes to write %u greater than btree bytes %zu\n", + bytes, btree_bytes(c)); + prt_printf(&buf, "whiteout_u64s %u\n", b->whiteout_u64s); + + for_each_bset(b, t) { + i = bset(b, t); + + if (!bset_written(b, i)) + bch2_bset_to_text(&buf, c, b, i, t - b->set); + } + + bch2_print_string_as_lines(KERN_ERR, buf.buf); + printbuf_exit(&buf); + bch2_fatal_error(c); + sectors_to_write = 1; + goto err; + } + data = btree_bounce_alloc(c, bytes, &used_mempool); if (!b->written) { |