Skip to content

Commit 583ba52

Browse files
author
Kent Overstreet
committed
bcachefs: fsck: check_subdir_count logs path
We can easily go from inode number -> path now, which makes for more useful log messages. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 8d6ac82 commit 583ba52

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

fs/bcachefs/fsck.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2066,14 +2066,22 @@ static int check_subdir_count_notnested(struct btree_trans *trans, struct inode_
20662066
continue;
20672067
}
20682068

2069-
if (fsck_err_on(i->inode.bi_nlink != i->count,
2070-
trans, inode_dir_wrong_nlink,
2071-
"directory %llu:%u with wrong i_nlink: got %u, should be %llu",
2072-
w->last_pos.inode, i->inode.bi_snapshot, i->inode.bi_nlink, i->count)) {
2073-
i->inode.bi_nlink = i->count;
2074-
ret = bch2_fsck_write_inode(trans, &i->inode);
2075-
if (ret)
2076-
break;
2069+
if (i->inode.bi_nlink != i->count) {
2070+
CLASS(printbuf, buf)();
2071+
2072+
lockrestart_do(trans,
2073+
bch2_inum_snapshot_to_path(trans, w->last_pos.inode,
2074+
i->inode.bi_snapshot, NULL, &buf));
2075+
2076+
if (fsck_err_on(i->inode.bi_nlink != i->count,
2077+
trans, inode_dir_wrong_nlink,
2078+
"directory with wrong i_nlink: got %u, should be %llu\n%s",
2079+
i->inode.bi_nlink, i->count, buf.buf)) {
2080+
i->inode.bi_nlink = i->count;
2081+
ret = bch2_fsck_write_inode(trans, &i->inode);
2082+
if (ret)
2083+
break;
2084+
}
20772085
}
20782086
}
20792087
fsck_err:

0 commit comments

Comments
 (0)