summaryrefslogtreecommitdiff
path: root/fs/bcachefs/util.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-01-05 19:58:50 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2024-01-06 07:24:21 +0300
commit1f5af5fc178588ff1f1293b5ddadd4228ce5095e (patch)
tree7d216adaf1195331ec45469c20c6d916a8492091 /fs/bcachefs/util.h
parentc13fbb7de2fc4fd61a44ebfa4ba182f35e0a3286 (diff)
downloadlinux-1f5af5fc178588ff1f1293b5ddadd4228ce5095e.tar.xz
bcachefs: %pg is banished
not portable to userspace Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/util.h')
-rw-r--r--fs/bcachefs/util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h
index 92acda29b581..c75fc31915d3 100644
--- a/fs/bcachefs/util.h
+++ b/fs/bcachefs/util.h
@@ -351,6 +351,15 @@ int bch2_save_backtrace(bch_stacktrace *stack, struct task_struct *, unsigned);
void bch2_prt_backtrace(struct printbuf *, bch_stacktrace *);
int bch2_prt_task_backtrace(struct printbuf *, struct task_struct *, unsigned);
+static inline void prt_bdevname(struct printbuf *out, struct block_device *bdev)
+{
+#ifdef __KERNEL__
+ prt_printf(out, "%pg", bdev);
+#else
+ prt_str(out, bdev->name);
+#endif
+}
+
#define NR_QUANTILES 15
#define QUANTILE_IDX(i) inorder_to_eytzinger0(i, NR_QUANTILES)
#define QUANTILE_FIRST eytzinger0_first(NR_QUANTILES)