Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: Replace ERANGE with private error codes

We avoid using standard error codes: private, per-callsite error codes
make debugging easier.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+4 -2
+2
fs/bcachefs/errcode.h
··· 3 3 #define _BCACHEFS_ERRCODE_H 4 4 5 5 #define BCH_ERRCODES() \ 6 + x(ERANGE, ERANGE_option_too_small) \ 7 + x(ERANGE, ERANGE_option_too_big) \ 6 8 x(ENOMEM, ENOMEM_stripe_buf) \ 7 9 x(ENOMEM, ENOMEM_replicas_table) \ 8 10 x(ENOMEM, ENOMEM_cpu_replicas) \
+2 -2
fs/bcachefs/opts.c
··· 265 265 if (err) 266 266 prt_printf(err, "%s: too small (min %llu)", 267 267 opt->attr.name, opt->min); 268 - return -ERANGE; 268 + return -BCH_ERR_ERANGE_option_too_small; 269 269 } 270 270 271 271 if (opt->max && v >= opt->max) { 272 272 if (err) 273 273 prt_printf(err, "%s: too big (max %llu)", 274 274 opt->attr.name, opt->max); 275 - return -ERANGE; 275 + return -BCH_ERR_ERANGE_option_too_big; 276 276 } 277 277 278 278 if ((opt->flags & OPT_SB_FIELD_SECTORS) && (v & 511)) {