Update bcachefs sources to f4a2c8cad65c bcachefs: print NO_KEYS in snapshot_to_text()

This commit is contained in:
Kent Overstreet 2025-11-09 12:30:06 -05:00
parent 292710139b
commit cafd061641
4 changed files with 20 additions and 29 deletions

View File

@ -1 +1 @@
0032e046622b5b5865374d264b9c2e4a7c8f837f
f4a2c8cad65c14cd6feb8c79aae2d708b7928d9b

View File

@ -383,14 +383,11 @@ static noinline int flush_new_cached_update(struct btree_trans *trans,
enum btree_iter_update_trigger_flags flags,
unsigned long ip)
{
btree_path_idx_t path_idx =
bch2_path_get(trans, i->btree_id, i->old_k.p, 1, 0,
BTREE_ITER_intent, _THIS_IP_);
int ret = bch2_btree_path_traverse(trans, path_idx, 0);
if (ret)
goto out;
CLASS(btree_iter, iter)(trans, i->btree_id, i->old_k.p, BTREE_ITER_intent);
struct btree_path *btree_path = trans->paths + path_idx;
try(bch2_btree_iter_traverse(&iter));
struct btree_path *btree_path = btree_iter_path(trans, &iter);
btree_path_set_should_be_locked(trans, btree_path);
#if 0
@ -403,7 +400,7 @@ static noinline int flush_new_cached_update(struct btree_trans *trans,
struct bkey k;
bch2_btree_path_peek_slot_exact(btree_path, &k);
if (!bkey_deleted(&k))
goto out;
return 0;
#endif
i->key_cache_already_flushed = true;
i->flags |= BTREE_TRIGGER_norun;
@ -411,14 +408,12 @@ static noinline int flush_new_cached_update(struct btree_trans *trans,
struct bkey old_k = i->old_k;
const struct bch_val *old_v = i->old_v;
i = __btree_trans_update_by_path(trans, path_idx, i->k, flags, _THIS_IP_);
i = __btree_trans_update_by_path(trans, iter.path, i->k, flags, ip);
i->old_k = old_k;
i->old_v = old_v;
i->key_cache_flushing = true;
out:
bch2_path_put(trans, path_idx, true);
return ret;
return 0;
}
static int __must_check
@ -482,7 +477,6 @@ int __must_check bch2_trans_update_ip(struct btree_trans *trans, struct btree_it
kmsan_check_memory(k, bkey_bytes(&k->k));
btree_path_idx_t path_idx = iter->update_path ?: iter->path;
int ret;
if (iter->flags & BTREE_ITER_is_extents)
return bch2_trans_update_extent(trans, iter, k, flags);
@ -490,7 +484,7 @@ int __must_check bch2_trans_update_ip(struct btree_trans *trans, struct btree_it
if (bkey_deleted(&k->k) &&
!(flags & BTREE_UPDATE_key_cache_reclaim) &&
(iter->flags & BTREE_ITER_filter_snapshots)) {
ret = need_whiteout_for_snapshot(trans, iter->btree_id, k->k.p);
int ret = need_whiteout_for_snapshot(trans, iter->btree_id, k->k.p);
if (unlikely(ret < 0))
return ret;
@ -591,7 +585,7 @@ int bch2_btree_insert_nonextent(struct btree_trans *trans,
BTREE_ITER_not_extents|
BTREE_ITER_intent);
return bch2_btree_iter_traverse(&iter) ?:
bch2_trans_update(trans, &iter, k, flags);
bch2_trans_update_ip(trans, &iter, k, flags, _RET_IP_);
}
int bch2_btree_insert_trans(struct btree_trans *trans, enum btree_id btree,
@ -600,7 +594,7 @@ int bch2_btree_insert_trans(struct btree_trans *trans, enum btree_id btree,
CLASS(btree_iter, iter)(trans, btree, bkey_start_pos(&k->k),
BTREE_ITER_intent|flags);
return bch2_btree_iter_traverse(&iter) ?:
bch2_trans_update(trans, &iter, k, flags);
bch2_trans_update_ip(trans, &iter, k, flags, _RET_IP_);
}
/**

View File

@ -232,7 +232,8 @@ create_lostfound:
BTREE_UPDATE_internal_snapshot_node|
STR_HASH_must_create) ?:
bch2_inode_write_flags(trans, &lostfound_iter, lostfound,
BTREE_UPDATE_internal_snapshot_node);
BTREE_UPDATE_internal_snapshot_node) ?:
bch2_trans_commit_lazy(trans, NULL, NULL, BCH_TRANS_COMMIT_no_enospc);
err:
bch_err_msg(c, ret, "creating lost+found");
return ret;
@ -1130,9 +1131,7 @@ static int find_oldest_inode_needs_reattach(struct btree_trans *trans,
break;
struct bch_inode_unpacked parent_inode;
ret = bch2_inode_unpack(k, &parent_inode);
if (ret)
break;
try(bch2_inode_unpack(k, &parent_inode));
if (!inode_should_reattach(&parent_inode))
break;
@ -1165,7 +1164,7 @@ static int check_unreachable_inode(struct btree_trans *trans,
"unreachable inode:\n%s",
(bch2_inode_unpacked_to_text(&buf, &inode),
buf.buf)))
ret = bch2_reattach_inode(trans, &inode);
try(bch2_reattach_inode(trans, &inode));
fsck_err:
return ret;
}

View File

@ -196,6 +196,8 @@ void bch2_snapshot_to_text(struct printbuf *out, struct bch_fs *c,
prt_str(out, "will_delete ");
if (BCH_SNAPSHOT_DELETED(s.v))
prt_str(out, "deleted ");
if (BCH_SNAPSHOT_NO_KEYS(s.v))
prt_str(out, "no_keys ");
prt_printf(out, "parent %10u children %10u %10u subvol %u tree %u",
le32_to_cpu(s.v->parent),
@ -1263,13 +1265,9 @@ int bch2_snapshots_read(struct bch_fs *c)
* initialized - so mark in reverse:
*/
CLASS(btree_trans, trans)(c);
int ret = for_each_btree_key_reverse(trans, iter, BTREE_ID_snapshots,
POS_MAX, 0, k,
__bch2_mark_snapshot(trans, BTREE_ID_snapshots, 0, bkey_s_c_null, k, 0) ?:
bch2_check_snapshot_needs_deletion(trans, k));
bch_err_fn(c, ret);
return ret;
return for_each_btree_key_reverse(trans, iter, BTREE_ID_snapshots, POS_MAX, 0, k,
__bch2_mark_snapshot(trans, BTREE_ID_snapshots, 0, bkey_s_c_null, k, 0) ?:
bch2_check_snapshot_needs_deletion(trans, k));
}
void bch2_fs_snapshots_exit(struct bch_fs *c)