1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Internal definitions for network filesystem support
4 * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
12 #define pr_fmt(fmt) "netfs: " fmt
17 extern unsigned int netfs_debug;
22 #ifdef CONFIG_NETFS_STATS
23 extern atomic_t netfs_n_rh_readahead;
24 extern atomic_t netfs_n_rh_readpage;
25 extern atomic_t netfs_n_rh_rreq;
26 extern atomic_t netfs_n_rh_sreq;
27 extern atomic_t netfs_n_rh_download;
28 extern atomic_t netfs_n_rh_download_done;
29 extern atomic_t netfs_n_rh_download_failed;
30 extern atomic_t netfs_n_rh_download_instead;
31 extern atomic_t netfs_n_rh_read;
32 extern atomic_t netfs_n_rh_read_done;
33 extern atomic_t netfs_n_rh_read_failed;
34 extern atomic_t netfs_n_rh_zero;
35 extern atomic_t netfs_n_rh_short_read;
36 extern atomic_t netfs_n_rh_write;
37 extern atomic_t netfs_n_rh_write_begin;
38 extern atomic_t netfs_n_rh_write_done;
39 extern atomic_t netfs_n_rh_write_failed;
40 extern atomic_t netfs_n_rh_write_zskip;
43 static inline void netfs_stat(atomic_t *stat)
48 static inline void netfs_stat_d(atomic_t *stat)
54 #define netfs_stat(x) do {} while(0)
55 #define netfs_stat_d(x) do {} while(0)
58 /*****************************************************************************/
62 #define dbgprintk(FMT, ...) \
63 printk("[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__)
65 #define kenter(FMT, ...) dbgprintk("==> %s("FMT")", __func__, ##__VA_ARGS__)
66 #define kleave(FMT, ...) dbgprintk("<== %s()"FMT"", __func__, ##__VA_ARGS__)
67 #define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__)
70 #define _enter(FMT, ...) kenter(FMT, ##__VA_ARGS__)
71 #define _leave(FMT, ...) kleave(FMT, ##__VA_ARGS__)
72 #define _debug(FMT, ...) kdebug(FMT, ##__VA_ARGS__)
74 #elif defined(CONFIG_NETFS_DEBUG)
75 #define _enter(FMT, ...) \
78 kenter(FMT, ##__VA_ARGS__); \
81 #define _leave(FMT, ...) \
84 kleave(FMT, ##__VA_ARGS__); \
87 #define _debug(FMT, ...) \
90 kdebug(FMT, ##__VA_ARGS__); \
94 #define _enter(FMT, ...) no_printk("==> %s("FMT")", __func__, ##__VA_ARGS__)
95 #define _leave(FMT, ...) no_printk("<== %s()"FMT"", __func__, ##__VA_ARGS__)
96 #define _debug(FMT, ...) no_printk(FMT, ##__VA_ARGS__)