Commit 98fb679d authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'bcachefs-2025-03-31' of git://evilpiepirate.org/bcachefs

Pull more bcachefs updates from Kent Overstreet:
 "All bugfixes and logging improvements"

* tag 'bcachefs-2025-03-31' of git://evilpiepirate.org/bcachefs: (35 commits)
  bcachefs: fix bch2_write_point_to_text() units
  bcachefs: Log original key being moved in data updates
  bcachefs: BCH_JSET_ENTRY_log_bkey
  bcachefs: Reorder error messages that include journal debug
  bcachefs: Don't use designated initializers for disk_accounting_pos
  bcachefs: Silence errors after emergency shutdown
  bcachefs: fix units in rebalance_status
  bcachefs: bch2_ioctl_subvolume_destroy() fixes
  bcachefs: Clear fs_path_parent on subvolume unlink
  bcachefs: Change btree_insert_node() assertion to error
  bcachefs: Better printing of inconsistency errors
  bcachefs: bch2_count_fsck_err()
  bcachefs: Better helpers for inconsistency errors
  bcachefs: Consistent indentation of multiline fsck errors
  bcachefs: Add an "ignore unknown" option to bch2_parse_mount_opts()
  bcachefs: bch2_time_stats_init_no_pcpu()
  bcachefs: Fix bch2_fs_get_tree() error path
  bcachefs: fix logging in journal_entry_err_msg()
  bcachefs: add missing newline in bch2_trans_updates_to_text()
  bcachefs: print_string_as_lines: fix extra newline
  ...
parents 4080cf02 650f5353
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -589,6 +589,8 @@ int bch2_bucket_gens_init(struct bch_fs *c)

int bch2_alloc_read(struct bch_fs *c)
{
	down_read(&c->state_lock);

	struct btree_trans *trans = bch2_trans_get(c);
	struct bch_dev *ca = NULL;
	int ret;
@@ -652,6 +654,7 @@ int bch2_alloc_read(struct bch_fs *c)
	bch2_dev_put(ca);
	bch2_trans_put(trans);

	up_read(&c->state_lock);
	bch_err_fn(c, ret);
	return ret;
}
@@ -673,8 +676,7 @@ static int __need_discard_or_freespace_err(struct btree_trans *trans,
	bch2_bkey_val_to_text(&buf, c, alloc_k);

	int ret = __bch2_fsck_err(NULL, trans, flags, err_id,
				  "bucket incorrectly %sset in %s btree\n"
				  "  %s",
				  "bucket incorrectly %sset in %s btree\n%s",
				  set ? "" : "un",
				  bch2_btree_id_str(btree),
				  buf.buf);
@@ -1201,8 +1203,7 @@ int bch2_check_alloc_key(struct btree_trans *trans,

	if (fsck_err_on(a->gen != alloc_gen(k, gens_offset),
			trans, bucket_gens_key_wrong,
			"incorrect gen in bucket_gens btree (got %u should be %u)\n"
			"  %s",
			"incorrect gen in bucket_gens btree (got %u should be %u)\n%s",
			alloc_gen(k, gens_offset), a->gen,
			(printbuf_reset(&buf),
			 bch2_bkey_val_to_text(&buf, c, alloc_k), buf.buf))) {
@@ -1712,8 +1713,7 @@ static int bch2_check_alloc_to_lru_ref(struct btree_trans *trans,

	if (fsck_err_on(!a->io_time[READ],
			trans, alloc_key_cached_but_read_time_zero,
			"cached bucket with read_time 0\n"
			"  %s",
			"cached bucket with read_time 0\n%s",
		(printbuf_reset(&buf),
		 bch2_bkey_val_to_text(&buf, c, alloc_k), buf.buf))) {
		struct bkey_i_alloc_v4 *a_mut =
+1 −1
Original line number Diff line number Diff line
@@ -1560,7 +1560,7 @@ static void bch2_write_point_to_text(struct printbuf *out, struct bch_fs *c,
	unsigned i;

	prt_printf(out, "%lu: ", wp->write_point);
	prt_human_readable_u64(out, wp->sectors_allocated);
	prt_human_readable_u64(out, wp->sectors_allocated << 9);

	prt_printf(out, " last wrote: ");
	bch2_pr_time_units(out, sched_clock() - wp->last_used);
+21 −22
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ static noinline int backpointer_mod_err(struct btree_trans *trans,
{
	struct bch_fs *c = trans->c;
	struct printbuf buf = PRINTBUF;
	int ret = 0;

	if (insert) {
		prt_printf(&buf, "existing backpointer found when inserting ");
@@ -125,17 +126,15 @@ static noinline int backpointer_mod_err(struct btree_trans *trans,

		prt_printf(&buf, "for ");
		bch2_bkey_val_to_text(&buf, c, orig_k);

		bch_err(c, "%s", buf.buf);
	}

	printbuf_exit(&buf);
	if (c->curr_recovery_pass > BCH_RECOVERY_PASS_check_extents_to_backpointers &&
	    __bch2_inconsistent_error(c, &buf))
		ret = -BCH_ERR_erofs_unfixed_errors;

	if (c->curr_recovery_pass > BCH_RECOVERY_PASS_check_extents_to_backpointers) {
		return bch2_inconsistent_error(c) ? BCH_ERR_erofs_unfixed_errors : 0;
	} else {
		return 0;
	}
	bch_err(c, "%s", buf.buf);
	printbuf_exit(&buf);
	return ret;
}

int bch2_bucket_backpointer_mod_nowritebuffer(struct btree_trans *trans,
@@ -214,7 +213,7 @@ static int backpointer_target_not_found(struct btree_trans *trans,
		   bp.v->level ? "btree node" : "extent");
	bch2_bkey_val_to_text(&buf, c, bp.s_c);

	prt_printf(&buf, "\n  ");
	prt_newline(&buf);
	bch2_bkey_val_to_text(&buf, c, target_k);

	struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(target_k);
@@ -222,7 +221,7 @@ static int backpointer_target_not_found(struct btree_trans *trans,
	struct extent_ptr_decoded p;
	bkey_for_each_ptr_decode(target_k.k, ptrs, p, entry)
		if (p.ptr.dev == bp.k->p.inode) {
			prt_printf(&buf, "\n  ");
			prt_newline(&buf);
			struct bkey_i_backpointer bp2;
			bch2_extent_ptr_to_bp(c, bp.v->btree_id, bp.v->level, target_k, p, entry, &bp2);
			bch2_bkey_val_to_text(&buf, c, bkey_i_to_s_c(&bp2.k_i));
@@ -443,12 +442,11 @@ static int check_extent_checksum(struct btree_trans *trans,
	if (ret)
		goto err;

	prt_str(&buf, "extents pointing to same space, but first extent checksum bad:");
	prt_printf(&buf, "\n  ");
	prt_printf(&buf, "extents pointing to same space, but first extent checksum bad:\n");
	bch2_btree_id_to_text(&buf, btree);
	prt_str(&buf, " ");
	bch2_bkey_val_to_text(&buf, c, extent);
	prt_printf(&buf, "\n  ");
	prt_newline(&buf);
	bch2_btree_id_to_text(&buf, o_btree);
	prt_str(&buf, " ");
	bch2_bkey_val_to_text(&buf, c, extent2);
@@ -541,7 +539,7 @@ static int check_bp_exists(struct btree_trans *trans,
		printbuf_reset(&buf);
		prt_printf(&buf, "duplicate versions of same extent, deleting smaller\n");
		bch2_bkey_val_to_text(&buf, c, orig_k);
		prt_str(&buf, "\n  ");
		prt_newline(&buf);
		bch2_bkey_val_to_text(&buf, c, other_extent);
		bch_err(c, "%s", buf.buf);

@@ -582,7 +580,7 @@ static int check_bp_exists(struct btree_trans *trans,
	printbuf_reset(&buf);
	prt_printf(&buf, "duplicate extents pointing to same space on dev %llu\n", bp->k.p.inode);
	bch2_bkey_val_to_text(&buf, c, orig_k);
	prt_str(&buf, "\n  ");
	prt_newline(&buf);
	bch2_bkey_val_to_text(&buf, c, other_extent);
	bch_err(c, "%s", buf.buf);
	ret = -BCH_ERR_fsck_repair_unimplemented;
@@ -1023,7 +1021,7 @@ int bch2_check_extents_to_backpointers(struct bch_fs *c)
	 * Can't allow devices to come/go/resize while we have bucket bitmaps
	 * allocated
	 */
	lockdep_assert_held(&c->state_lock);
	down_read(&c->state_lock);

	for_each_member_device(c, ca) {
		BUG_ON(ca->bucket_backpointer_mismatches);
@@ -1108,6 +1106,7 @@ int bch2_check_extents_to_backpointers(struct bch_fs *c)
		ca->bucket_backpointer_mismatches = NULL;
	}

	up_read(&c->state_lock);
	bch_err_fn(c, ret);
	return ret;
}
+2 −1
Original line number Diff line number Diff line
@@ -1143,7 +1143,8 @@ static inline __u64 __bset_magic(struct bch_sb *sb)
	x(log,			9)		\
	x(overwrite,		10)		\
	x(write_buffer_keys,	11)		\
	x(datetime,		12)
	x(datetime,		12)		\
	x(log_bkey,		13)

enum bch_jset_entry_type {
#define x(f, nr)	BCH_JSET_ENTRY_##f	= nr,
+1 −1
Original line number Diff line number Diff line
@@ -1417,7 +1417,7 @@ void __bch2_btree_pos_to_text(struct printbuf *out, struct bch_fs *c,
		prt_printf(out, "%u", r->level);
	else
		prt_printf(out, "(unknown)");
	prt_printf(out, "\n  ");
	prt_newline(out);

	bch2_bkey_val_to_text(out, c, k);
}
Loading