diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-12-30 22:54:04 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-03 20:31:37 -0500 |
commit | 1f79cf3825e94fcb146d417b6dda9b94c93c7a53 (patch) | |
tree | 152d89dcb9217e1dbe18594d038a077e0d6f822c /libbcachefs/printbuf.c | |
parent | 3054e5debba5ccf842346bd202921f08e43d1e84 (diff) |
Update bcachefs sources to 2a6125decb43 bcachefs: bch_sb_field_downgrade
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'libbcachefs/printbuf.c')
-rw-r--r-- | libbcachefs/printbuf.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libbcachefs/printbuf.c b/libbcachefs/printbuf.c index 5e653eb8..187b0377 100644 --- a/libbcachefs/printbuf.c +++ b/libbcachefs/printbuf.c @@ -2,6 +2,7 @@ /* Copyright (C) 2022 Kent Overstreet */ #include <linux/err.h> +#include <linux/bitmap.h> #include <linux/export.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -423,3 +424,24 @@ void bch2_prt_bitflags(struct printbuf *out, flags ^= BIT_ULL(bit); } } + +void bch2_prt_bitflags_vector(struct printbuf *out, + const char * const list[], + unsigned long *v, unsigned nr) +{ + bool first = true; + unsigned i; + + for (i = 0; i < nr; i++) + if (!list[i]) { + nr = i - 1; + break; + } + + for_each_set_bit(i, v, nr) { + if (!first) + bch2_prt_printf(out, ","); + first = false; + bch2_prt_printf(out, "%s", list[i]); + } +} |