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

CIFS: add ONCE flag for cifs_dbg type

* Since cifs_vfs_error was just using pr_debug_ratelimited like the rest
of cifs_dbg, move it there too
* Add a ONCE type flag to call the pr_xxx_once() debug function instead
of the ratelimited ones.

To convert existing printk_once() calls to this we can run:

perl -i -pE \
's/printk_once\s*\(([^" \n]+)(.*)/cifs_dbg(VFS|ONCE,$2/g' \
fs/cifs/*.c

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

Aurelien Aptel and committed by
Steve French
f2f176b4 3995bbf5

+22 -29
-17
fs/cifs/cifs_debug.c
··· 42 42 data, length, true); 43 43 } 44 44 45 - #ifdef CONFIG_CIFS_DEBUG 46 - void cifs_vfs_err(const char *fmt, ...) 47 - { 48 - struct va_format vaf; 49 - va_list args; 50 - 51 - va_start(args, fmt); 52 - 53 - vaf.fmt = fmt; 54 - vaf.va = &args; 55 - 56 - pr_err_ratelimited("CIFS VFS: %pV", &vaf); 57 - 58 - va_end(args); 59 - } 60 - #endif 61 - 62 45 void cifs_dump_detail(void *buf) 63 46 { 64 47 #ifdef CONFIG_CIFS_DEBUG2
+22 -12
fs/cifs/cifs_debug.h
··· 39 39 #else 40 40 #define NOISY 0 41 41 #endif 42 + #define ONCE 8 42 43 43 44 /* 44 45 * debug ON ··· 47 46 */ 48 47 #ifdef CONFIG_CIFS_DEBUG 49 48 50 - __printf(1, 2) void cifs_vfs_err(const char *fmt, ...); 51 - 52 49 /* information message: e.g., configuration, major event */ 53 - #define cifs_dbg(type, fmt, ...) \ 54 - do { \ 55 - if (type == FYI && cifsFYI & CIFS_INFO) { \ 56 - pr_debug_ratelimited("%s: " \ 57 - fmt, __FILE__, ##__VA_ARGS__); \ 58 - } else if (type == VFS) { \ 59 - cifs_vfs_err(fmt, ##__VA_ARGS__); \ 60 - } else if (type == NOISY && type != 0) { \ 61 - pr_debug_ratelimited(fmt, ##__VA_ARGS__); \ 62 - } \ 50 + #define cifs_dbg_func(ratefunc, type, fmt, ...) \ 51 + do { \ 52 + if ((type) & FYI && cifsFYI & CIFS_INFO) { \ 53 + pr_debug_ ## ratefunc("%s: " \ 54 + fmt, __FILE__, ##__VA_ARGS__); \ 55 + } else if ((type) & VFS) { \ 56 + pr_err_ ## ratefunc("CuIFS VFS: " \ 57 + fmt, ##__VA_ARGS__); \ 58 + } else if ((type) & NOISY && (NOISY != 0)) { \ 59 + pr_debug_ ## ratefunc(fmt, ##__VA_ARGS__); \ 60 + } \ 61 + } while (0) 62 + 63 + #define cifs_dbg(type, fmt, ...) \ 64 + do { \ 65 + if ((type) & ONCE) \ 66 + cifs_dbg_func(once, \ 67 + type, fmt, ##__VA_ARGS__); \ 68 + else \ 69 + cifs_dbg_func(ratelimited, \ 70 + type, fmt, ##__VA_ARGS__); \ 63 71 } while (0) 64 72 65 73 /*