bcachefs: Improved errcodes
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 18 Jul 2022 02:31:21 +0000 (22:31 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:36 +0000 (17:09 -0400)
commit615f867c14b2d70efb02dafb8e668d984e74d0e3
tree266f977a35d430198ba942f24e4dcbb73664f9fa
parent3ab25c1b4ef2a57b8bc55e786e90af63f7d06663
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>
fs/bcachefs/Kconfig
fs/bcachefs/Makefile
fs/bcachefs/alloc_background.c
fs/bcachefs/alloc_foreground.c
fs/bcachefs/errcode.c [new file with mode: 0644]
fs/bcachefs/errcode.h
fs/bcachefs/fsck.c
fs/bcachefs/trace.h