diff options
| author | Aurelien Aptel <aaptel@suse.com> | 2018-04-10 11:01:13 -0400 |
|---|---|---|
| committer | Steve French <stfrench@microsoft.com> | 2018-04-11 17:44:58 -0400 |
| commit | f2f176b418da96ae030c2f312c0ddb0e7b6ead21 (patch) | |
| tree | 72b9ef79421f3c675ac0d25339a473e45dfef8be | |
| parent | 3995bbf53bd2047f2720c6fdd4bf38f6d942a0c0 (diff) | |
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>
| -rw-r--r-- | fs/cifs/cifs_debug.c | 17 | ||||
| -rw-r--r-- | fs/cifs/cifs_debug.h | 34 |
2 files changed, 22 insertions, 29 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c index e35e711db68e..9d69ea433330 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c | |||
| @@ -42,23 +42,6 @@ cifs_dump_mem(char *label, void *data, int length) | |||
| 42 | data, length, true); | 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 | void cifs_dump_detail(void *buf) | 45 | void cifs_dump_detail(void *buf) |
| 63 | { | 46 | { |
| 64 | #ifdef CONFIG_CIFS_DEBUG2 | 47 | #ifdef CONFIG_CIFS_DEBUG2 |
diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h index c611ca2339d7..fe5567655662 100644 --- a/fs/cifs/cifs_debug.h +++ b/fs/cifs/cifs_debug.h | |||
| @@ -39,6 +39,7 @@ extern int cifsFYI; | |||
| 39 | #else | 39 | #else |
| 40 | #define NOISY 0 | 40 | #define NOISY 0 |
| 41 | #endif | 41 | #endif |
| 42 | #define ONCE 8 | ||
| 42 | 43 | ||
| 43 | /* | 44 | /* |
| 44 | * debug ON | 45 | * debug ON |
| @@ -46,19 +47,28 @@ extern int cifsFYI; | |||
| 46 | */ | 47 | */ |
| 47 | #ifdef CONFIG_CIFS_DEBUG | 48 | #ifdef CONFIG_CIFS_DEBUG |
| 48 | 49 | ||
| 49 | __printf(1, 2) void cifs_vfs_err(const char *fmt, ...); | ||
| 50 | |||
| 51 | /* information message: e.g., configuration, major event */ | 50 | /* information message: e.g., configuration, major event */ |
| 52 | #define cifs_dbg(type, fmt, ...) \ | 51 | #define cifs_dbg_func(ratefunc, type, fmt, ...) \ |
| 53 | do { \ | 52 | do { \ |
| 54 | if (type == FYI && cifsFYI & CIFS_INFO) { \ | 53 | if ((type) & FYI && cifsFYI & CIFS_INFO) { \ |
| 55 | pr_debug_ratelimited("%s: " \ | 54 | pr_debug_ ## ratefunc("%s: " \ |
| 56 | fmt, __FILE__, ##__VA_ARGS__); \ | 55 | fmt, __FILE__, ##__VA_ARGS__); \ |
| 57 | } else if (type == VFS) { \ | 56 | } else if ((type) & VFS) { \ |
| 58 | cifs_vfs_err(fmt, ##__VA_ARGS__); \ | 57 | pr_err_ ## ratefunc("CuIFS VFS: " \ |
| 59 | } else if (type == NOISY && type != 0) { \ | 58 | fmt, ##__VA_ARGS__); \ |
| 60 | pr_debug_ratelimited(fmt, ##__VA_ARGS__); \ | 59 | } else if ((type) & NOISY && (NOISY != 0)) { \ |
| 61 | } \ | 60 | pr_debug_ ## ratefunc(fmt, ##__VA_ARGS__); \ |
| 61 | } \ | ||
| 62 | } while (0) | ||
| 63 | |||
| 64 | #define cifs_dbg(type, fmt, ...) \ | ||
| 65 | do { \ | ||
| 66 | if ((type) & ONCE) \ | ||
| 67 | cifs_dbg_func(once, \ | ||
| 68 | type, fmt, ##__VA_ARGS__); \ | ||
| 69 | else \ | ||
| 70 | cifs_dbg_func(ratelimited, \ | ||
| 71 | type, fmt, ##__VA_ARGS__); \ | ||
| 62 | } while (0) | 72 | } while (0) |
| 63 | 73 | ||
| 64 | /* | 74 | /* |
