Commit 3e5ceaa5 authored by Kent Overstreet's avatar Kent Overstreet
Browse files

bcachefs: fsck: check_directory_structure runs in reverse order



When we find a directory connectivity problem, we should do the repair
in the oldest snapshot that has the issue - so that we don't end up
duplicating work or making a real mess of things.

Oldest snapshot IDs have the highest integer value, so - just walk
inodes in reverse order.

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 9fb09ace
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2841,7 +2841,7 @@ static int check_path_loop(struct btree_trans *trans, struct bkey_s_c inode_k)
int bch2_check_directory_structure(struct bch_fs *c)
{
	int ret = bch2_trans_run(c,
		for_each_btree_key_commit(trans, iter, BTREE_ID_inodes, POS_MIN,
		for_each_btree_key_reverse_commit(trans, iter, BTREE_ID_inodes, POS_MIN,
					  BTREE_ITER_intent|
					  BTREE_ITER_prefetch|
					  BTREE_ITER_all_snapshots, k,