sunrpc & nfs: Add and use dprintk_cont macros
authorJoe Perches <joe@perches.com>
Sat, 15 Oct 2016 20:59:03 +0000 (13:59 -0700)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 30 Jan 2017 18:14:50 +0000 (13:14 -0500)
Allow line continuations to work properly with KERN_CONT.

Signed-off-by: Joe Perches <joe@perches.com>
[Anna: Add fallback dprintk_cont() for when CONFIG_SUNRPC_DEBUG=n]
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/write.c
include/linux/sunrpc/debug.h

index b00d53d..ad4219a 100644 (file)
@@ -1787,7 +1787,7 @@ static void nfs_commit_release_pages(struct nfs_commit_data *data)
                if (status < 0) {
                        nfs_context_set_write_error(req->wb_context, status);
                        nfs_inode_remove_request(req);
-                       dprintk(", error = %d\n", status);
+                       dprintk_cont(", error = %d\n", status);
                        goto next;
                }
 
@@ -1796,11 +1796,11 @@ static void nfs_commit_release_pages(struct nfs_commit_data *data)
                if (!nfs_write_verifier_cmp(&req->wb_verf, &data->verf.verifier)) {
                        /* We have a match */
                        nfs_inode_remove_request(req);
-                       dprintk(" OK\n");
+                       dprintk_cont(" OK\n");
                        goto next;
                }
                /* We have a mismatch. Write the page again */
-               dprintk(" mismatch\n");
+               dprintk_cont(" mismatch\n");
                nfs_mark_request_dirty(req);
                set_bit(NFS_CONTEXT_RESEND_WRITES, &req->wb_context->flags);
        next:
index 59a7889..8da0f37 100644 (file)
@@ -20,33 +20,55 @@ extern unsigned int         nfsd_debug;
 extern unsigned int            nlm_debug;
 #endif
 
-#define dprintk(args...)       dfprintk(FACILITY, ## args)
-#define dprintk_rcu(args...)   dfprintk_rcu(FACILITY, ## args)
+#define dprintk(fmt, ...)                                              \
+       dfprintk(FACILITY, fmt, ##__VA_ARGS__)
+#define dprintk_cont(fmt, ...)                                         \
+       dfprintk_cont(FACILITY, fmt, ##__VA_ARGS__)
+#define dprintk_rcu(fmt, ...)                                          \
+       dfprintk_rcu(FACILITY, fmt, ##__VA_ARGS__)
+#define dprintk_rcu_cont(fmt, ...)                                     \
+       dfprintk_rcu_cont(FACILITY, fmt, ##__VA_ARGS__)
 
 #undef ifdebug
 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
 # define ifdebug(fac)          if (unlikely(rpc_debug & RPCDBG_##fac))
 
-# define dfprintk(fac, args...)        \
-       do { \
-               ifdebug(fac) \
-                       printk(KERN_DEFAULT args); \
-       } while (0)
-
-# define dfprintk_rcu(fac, args...)    \
-       do { \
-               ifdebug(fac) { \
-                       rcu_read_lock(); \
-                       printk(KERN_DEFAULT args); \
-                       rcu_read_unlock(); \
-               } \
-       } while (0)
+# define dfprintk(fac, fmt, ...)                                       \
+do {                                                                   \
+       ifdebug(fac)                                                    \
+               printk(KERN_DEFAULT fmt, ##__VA_ARGS__);                \
+} while (0)
+
+# define dfprintk_cont(fac, fmt, ...)                                  \
+do {                                                                   \
+       ifdebug(fac)                                                    \
+               printk(KERN_CONT fmt, ##__VA_ARGS__);                   \
+} while (0)
+
+# define dfprintk_rcu(fac, fmt, ...)                                   \
+do {                                                                   \
+       ifdebug(fac) {                                                  \
+               rcu_read_lock();                                        \
+               printk(KERN_DEFAULT fmt, ##__VA_ARGS__);                \
+               rcu_read_unlock();                                      \
+       }                                                               \
+} while (0)
+
+# define dfprintk_rcu_cont(fac, fmt, ...)                              \
+do {                                                                   \
+       ifdebug(fac) {                                                  \
+               rcu_read_lock();                                        \
+               printk(KERN_CONT fmt, ##__VA_ARGS__);                   \
+               rcu_read_unlock();                                      \
+       }                                                               \
+} while (0)
 
 # define RPC_IFDEBUG(x)                x
 #else
 # define ifdebug(fac)          if (0)
-# define dfprintk(fac, args...)        do {} while (0)
-# define dfprintk_rcu(fac, args...)    do {} while (0)
+# define dfprintk(fac, fmt, ...)       do {} while (0)
+# define dfprintk_cont(fac, fmt, ...)  do {} while (0)
+# define dfprintk_rcu(fac, fmt, ...)   do {} while (0)
 # define RPC_IFDEBUG(x)
 #endif