summaryrefslogtreecommitdiff
path: root/fs/bcachefs/fsck.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-07-17 22:31:21 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:36 -0400
commit615f867c14b2d70efb02dafb8e668d984e74d0e3 (patch)
tree266f977a35d430198ba942f24e4dcbb73664f9fa /fs/bcachefs/fsck.c
parent3ab25c1b4ef2a57b8bc55e786e90af63f7d06663 (diff)
bcachefs: Improved errcodes
Instead of overloading standard error codes (EINTR/EAGAIN), and defining short lists of error codes in multiple places that potentially end up overlapping & conflicting, we're now going to have one master list of error codes. Error codes are defined with an x-macro: thus we also have bch2_err_str() now. Also, error codes have a class field. Now, instead of checking for errors with ==, code should use bch2_err_matches(), which returns true if the error is equal to or a sub-error of the error class. This means we can define unique errors for every source location where an error is generated, which will help improve our error messages. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/fsck.c')
-rw-r--r--fs/bcachefs/fsck.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 8f006b9a4804..e601a1ee0ee1 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -534,7 +534,7 @@ static int snapshots_seen_update(struct bch_fs *c, struct snapshots_seen *s,
bch2_btree_ids[btree_id],
pos.inode, pos.offset,
i->id, n.id, n.equiv);
- return -NEED_SNAPSHOT_CLEANUP;
+ return -BCH_ERR_need_snapshot_cleanup;
}
return 0;
@@ -2371,7 +2371,7 @@ again:
check_nlinks(c) ?:
fix_reflink_p(c);
- if (ret == -NEED_SNAPSHOT_CLEANUP) {
+ if (bch2_err_matches(ret, BCH_ERR_need_snapshot_cleanup)) {
set_bit(BCH_FS_HAVE_DELETED_SNAPSHOTS, &c->flags);
goto again;
}