Patchwork 9p: Reduce object size with CONFIG_NET_9P_DEBUG

login
register
mail settings
Submitter Joe Perches
Date Nov. 19, 2011, 12:09 a.m.
Message ID <1321661394.5917.7.camel@Joe-Laptop>
Download mbox | patch
Permalink /patch/126514/
State Awaiting Upstream
Delegated to: David Miller
Headers show

Comments

Joe Perches - Nov. 19, 2011, 12:09 a.m.
Reduce object size by deduplicating formats.

Use vsprintf extension %pV.
Rename P9_DPRINTK uses to p9_debug, align arguments.
Add function for _p9_debug and macro to add __func__.
Add missing "\n"s to p9_debug uses.
Remove embedded function names as p9_debug adds it.
Remove P9_EPRINTK macro and convert use to pr_<level>.
Add and use pr_fmt and pr_<level>.

$ size fs/9p/built-in.o*
   text	   data	    bss	    dec	    hex	filename
  62133	    984	  16000	  79117	  1350d	fs/9p/built-in.o.new
  67342	    984	  16928	  85254	  14d06	fs/9p/built-in.o.old

Signed-off-by: Joe Perches <joe@perches.com>
---
 fs/9p/cache.c          |   64 ++++++++++++++++++------------------
 fs/9p/fid.c            |    8 ++--
 fs/9p/v9fs.c           |   83 ++++++++++++++++++++++++++++++----------------
 fs/9p/vfs_addr.c       |   13 +++----
 fs/9p/vfs_dentry.c     |   12 +++---
 fs/9p/vfs_dir.c        |   13 +++----
 fs/9p/vfs_file.c       |   31 ++++++++---------
 fs/9p/vfs_inode.c      |   86 ++++++++++++++++++++++++------------------------
 fs/9p/vfs_inode_dotl.c |   85 +++++++++++++++++++++++------------------------
 fs/9p/vfs_super.c      |   12 +++---
 fs/9p/xattr.c          |   16 ++++----
 include/net/9p/9p.h    |   28 ++++------------
 12 files changed, 228 insertions(+), 223 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Van Hensbergen - Nov. 28, 2011, 3:10 p.m.
sorry, just got to reviewing this because of holidays.

On Fri, Nov 18, 2011 at 6:09 PM, Joe Perches <joe@perches.com> wrote:
> Reduce object size by deduplicating formats.
>
> Use vsprintf extension %pV.
> Rename P9_DPRINTK uses to p9_debug, align arguments.
> Add function for _p9_debug and macro to add __func__.
> Add missing "\n"s to p9_debug uses.
> Remove embedded function names as p9_debug adds it.
> Remove P9_EPRINTK macro and convert use to pr_<level>.
> Add and use pr_fmt and pr_<level>.
>
> $ size fs/9p/built-in.o*
>   text    data     bss     dec     hex filename
>  62133     984   16000   79117   1350d fs/9p/built-in.o.new
>  67342     984   16928   85254   14d06 fs/9p/built-in.o.old
>
> Signed-off-by: Joe Perches <joe@perches.com>

These changes seem reasonable enough, but since you only made changes
in the fs/9p directory and not the net/9p directory which causes
net/9p build to break with this patch.

CC      net/9p/client.o
/home/ericvh/src/linux/v9fs-devel/net/9p/client.c: In function
‘get_protocol_version’:
/home/ericvh/src/linux/v9fs-devel/net/9p/client.c:84:3: error:
implicit declaration of function ‘P9_DPRINTK’
[-Werror=implicit-function-declaration]
/home/ericvh/src/linux/v9fs-devel/net/9p/client.c: In function
‘p9_client_clunk’:
/home/ericvh/src/linux/v9fs-devel/net/9p/client.c:1426:3: error:
implicit declaration of function ‘P9_EPRINTK’
[-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

make[3]: *** [net/9p/client.o] Error 1
make[2]: *** [net/9p] Error 2
make[1]: *** [net] Error 2
make: *** [sub-make] Error 2

           -eric


> ---
>  fs/9p/cache.c          |   64 ++++++++++++++++++------------------
>  fs/9p/fid.c            |    8 ++--
>  fs/9p/v9fs.c           |   83 ++++++++++++++++++++++++++++++----------------
>  fs/9p/vfs_addr.c       |   13 +++----
>  fs/9p/vfs_dentry.c     |   12 +++---
>  fs/9p/vfs_dir.c        |   13 +++----
>  fs/9p/vfs_file.c       |   31 ++++++++---------
>  fs/9p/vfs_inode.c      |   86 ++++++++++++++++++++++++------------------------
>  fs/9p/vfs_inode_dotl.c |   85 +++++++++++++++++++++++------------------------
>  fs/9p/vfs_super.c      |   12 +++---
>  fs/9p/xattr.c          |   16 ++++----
>  include/net/9p/9p.h    |   28 ++++------------
>  12 files changed, 228 insertions(+), 223 deletions(-)
>
> diff --git a/fs/9p/cache.c b/fs/9p/cache.c
> index 945aa5f..a9ea73d 100644
> --- a/fs/9p/cache.c
> +++ b/fs/9p/cache.c
> @@ -62,8 +62,8 @@ static uint16_t v9fs_cache_session_get_key(const void *cookie_netfs_data,
>        uint16_t klen = 0;
>
>        v9ses = (struct v9fs_session_info *)cookie_netfs_data;
> -       P9_DPRINTK(P9_DEBUG_FSC, "session %p buf %p size %u", v9ses,
> -                  buffer, bufmax);
> +       p9_debug(P9_DEBUG_FSC, "session %p buf %p size %u\n",
> +                v9ses, buffer, bufmax);
>
>        if (v9ses->cachetag)
>                klen = strlen(v9ses->cachetag);
> @@ -72,7 +72,7 @@ static uint16_t v9fs_cache_session_get_key(const void *cookie_netfs_data,
>                return 0;
>
>        memcpy(buffer, v9ses->cachetag, klen);
> -       P9_DPRINTK(P9_DEBUG_FSC, "cache session tag %s", v9ses->cachetag);
> +       p9_debug(P9_DEBUG_FSC, "cache session tag %s\n", v9ses->cachetag);
>        return klen;
>  }
>
> @@ -91,14 +91,14 @@ void v9fs_cache_session_get_cookie(struct v9fs_session_info *v9ses)
>        v9ses->fscache = fscache_acquire_cookie(v9fs_cache_netfs.primary_index,
>                                                &v9fs_cache_session_index_def,
>                                                v9ses);
> -       P9_DPRINTK(P9_DEBUG_FSC, "session %p get cookie %p", v9ses,
> -                  v9ses->fscache);
> +       p9_debug(P9_DEBUG_FSC, "session %p get cookie %p\n",
> +                v9ses, v9ses->fscache);
>  }
>
>  void v9fs_cache_session_put_cookie(struct v9fs_session_info *v9ses)
>  {
> -       P9_DPRINTK(P9_DEBUG_FSC, "session %p put cookie %p", v9ses,
> -                  v9ses->fscache);
> +       p9_debug(P9_DEBUG_FSC, "session %p put cookie %p\n",
> +                v9ses, v9ses->fscache);
>        fscache_relinquish_cookie(v9ses->fscache, 0);
>        v9ses->fscache = NULL;
>  }
> @@ -109,8 +109,8 @@ static uint16_t v9fs_cache_inode_get_key(const void *cookie_netfs_data,
>  {
>        const struct v9fs_inode *v9inode = cookie_netfs_data;
>        memcpy(buffer, &v9inode->qid.path, sizeof(v9inode->qid.path));
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p get key %llu", &v9inode->vfs_inode,
> -                  v9inode->qid.path);
> +       p9_debug(P9_DEBUG_FSC, "inode %p get key %llu\n",
> +                &v9inode->vfs_inode, v9inode->qid.path);
>        return sizeof(v9inode->qid.path);
>  }
>
> @@ -120,8 +120,8 @@ static void v9fs_cache_inode_get_attr(const void *cookie_netfs_data,
>        const struct v9fs_inode *v9inode = cookie_netfs_data;
>        *size = i_size_read(&v9inode->vfs_inode);
>
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p get attr %llu", &v9inode->vfs_inode,
> -                  *size);
> +       p9_debug(P9_DEBUG_FSC, "inode %p get attr %llu\n",
> +                &v9inode->vfs_inode, *size);
>  }
>
>  static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data,
> @@ -129,8 +129,8 @@ static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data,
>  {
>        const struct v9fs_inode *v9inode = cookie_netfs_data;
>        memcpy(buffer, &v9inode->qid.version, sizeof(v9inode->qid.version));
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p get aux %u", &v9inode->vfs_inode,
> -                  v9inode->qid.version);
> +       p9_debug(P9_DEBUG_FSC, "inode %p get aux %u\n",
> +                &v9inode->vfs_inode, v9inode->qid.version);
>        return sizeof(v9inode->qid.version);
>  }
>
> @@ -206,8 +206,8 @@ void v9fs_cache_inode_get_cookie(struct inode *inode)
>                                                  &v9fs_cache_inode_index_def,
>                                                  v9inode);
>
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p get cookie %p", inode,
> -                  v9inode->fscache);
> +       p9_debug(P9_DEBUG_FSC, "inode %p get cookie %p\n",
> +                inode, v9inode->fscache);
>  }
>
>  void v9fs_cache_inode_put_cookie(struct inode *inode)
> @@ -216,8 +216,8 @@ void v9fs_cache_inode_put_cookie(struct inode *inode)
>
>        if (!v9inode->fscache)
>                return;
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p put cookie %p", inode,
> -                  v9inode->fscache);
> +       p9_debug(P9_DEBUG_FSC, "inode %p put cookie %p\n",
> +                inode, v9inode->fscache);
>
>        fscache_relinquish_cookie(v9inode->fscache, 0);
>        v9inode->fscache = NULL;
> @@ -229,8 +229,8 @@ void v9fs_cache_inode_flush_cookie(struct inode *inode)
>
>        if (!v9inode->fscache)
>                return;
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p flush cookie %p", inode,
> -                  v9inode->fscache);
> +       p9_debug(P9_DEBUG_FSC, "inode %p flush cookie %p\n",
> +                inode, v9inode->fscache);
>
>        fscache_relinquish_cookie(v9inode->fscache, 1);
>        v9inode->fscache = NULL;
> @@ -272,8 +272,8 @@ void v9fs_cache_inode_reset_cookie(struct inode *inode)
>        v9inode->fscache = fscache_acquire_cookie(v9ses->fscache,
>                                                  &v9fs_cache_inode_index_def,
>                                                  v9inode);
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p",
> -                  inode, old, v9inode->fscache);
> +       p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n",
> +                inode, old, v9inode->fscache);
>
>        spin_unlock(&v9inode->fscache_lock);
>  }
> @@ -323,7 +323,7 @@ int __v9fs_readpage_from_fscache(struct inode *inode, struct page *page)
>        int ret;
>        const struct v9fs_inode *v9inode = V9FS_I(inode);
>
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page);
> +       p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
>        if (!v9inode->fscache)
>                return -ENOBUFS;
>
> @@ -335,13 +335,13 @@ int __v9fs_readpage_from_fscache(struct inode *inode, struct page *page)
>        switch (ret) {
>        case -ENOBUFS:
>        case -ENODATA:
> -               P9_DPRINTK(P9_DEBUG_FSC, "page/inode not in cache %d", ret);
> +               p9_debug(P9_DEBUG_FSC, "page/inode not in cache %d\n", ret);
>                return 1;
>        case 0:
> -               P9_DPRINTK(P9_DEBUG_FSC, "BIO submitted");
> +               p9_debug(P9_DEBUG_FSC, "BIO submitted\n");
>                return ret;
>        default:
> -               P9_DPRINTK(P9_DEBUG_FSC, "ret %d", ret);
> +               p9_debug(P9_DEBUG_FSC, "ret %d\n", ret);
>                return ret;
>        }
>  }
> @@ -361,7 +361,7 @@ int __v9fs_readpages_from_fscache(struct inode *inode,
>        int ret;
>        const struct v9fs_inode *v9inode = V9FS_I(inode);
>
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p pages %u", inode, *nr_pages);
> +       p9_debug(P9_DEBUG_FSC, "inode %p pages %u\n", inode, *nr_pages);
>        if (!v9inode->fscache)
>                return -ENOBUFS;
>
> @@ -373,15 +373,15 @@ int __v9fs_readpages_from_fscache(struct inode *inode,
>        switch (ret) {
>        case -ENOBUFS:
>        case -ENODATA:
> -               P9_DPRINTK(P9_DEBUG_FSC, "pages/inodes not in cache %d", ret);
> +               p9_debug(P9_DEBUG_FSC, "pages/inodes not in cache %d\n", ret);
>                return 1;
>        case 0:
>                BUG_ON(!list_empty(pages));
>                BUG_ON(*nr_pages != 0);
> -               P9_DPRINTK(P9_DEBUG_FSC, "BIO submitted");
> +               p9_debug(P9_DEBUG_FSC, "BIO submitted\n");
>                return ret;
>        default:
> -               P9_DPRINTK(P9_DEBUG_FSC, "ret %d", ret);
> +               p9_debug(P9_DEBUG_FSC, "ret %d\n", ret);
>                return ret;
>        }
>  }
> @@ -396,9 +396,9 @@ void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page)
>        int ret;
>        const struct v9fs_inode *v9inode = V9FS_I(inode);
>
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page);
> +       p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
>        ret = fscache_write_page(v9inode->fscache, page, GFP_KERNEL);
> -       P9_DPRINTK(P9_DEBUG_FSC, "ret =  %d", ret);
> +       p9_debug(P9_DEBUG_FSC, "ret =  %d\n", ret);
>        if (ret != 0)
>                v9fs_uncache_page(inode, page);
>  }
> @@ -409,7 +409,7 @@ void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page)
>  void __v9fs_fscache_wait_on_page_write(struct inode *inode, struct page *page)
>  {
>        const struct v9fs_inode *v9inode = V9FS_I(inode);
> -       P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page);
> +       p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
>        if (PageFsCache(page))
>                fscache_wait_on_page_write(v9inode->fscache, page);
>  }
> diff --git a/fs/9p/fid.c b/fs/9p/fid.c
> index 85b67ff..da8eefb 100644
> --- a/fs/9p/fid.c
> +++ b/fs/9p/fid.c
> @@ -45,8 +45,8 @@ int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid)
>  {
>        struct v9fs_dentry *dent;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "fid %d dentry %s\n",
> -                                       fid->fid, dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "fid %d dentry %s\n",
> +                fid->fid, dentry->d_name.name);
>
>        dent = dentry->d_fsdata;
>        if (!dent) {
> @@ -79,8 +79,8 @@ static struct p9_fid *v9fs_fid_find(struct dentry *dentry, u32 uid, int any)
>        struct v9fs_dentry *dent;
>        struct p9_fid *fid, *ret;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n",
> -               dentry->d_name.name, dentry, uid, any);
> +       p9_debug(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n",
> +                dentry->d_name.name, dentry, uid, any);
>        dent = (struct v9fs_dentry *) dentry->d_fsdata;
>        ret = NULL;
>        if (dent) {
> diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
> index 2b78014..4afc182 100644
> --- a/fs/9p/v9fs.c
> +++ b/fs/9p/v9fs.c
> @@ -23,6 +23,8 @@
>  *
>  */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/module.h>
>  #include <linux/errno.h>
>  #include <linux/fs.h>
> @@ -85,15 +87,15 @@ static int get_cache_mode(char *s)
>
>        if (!strcmp(s, "loose")) {
>                version = CACHE_LOOSE;
> -               P9_DPRINTK(P9_DEBUG_9P, "Cache mode: loose\n");
> +               p9_debug(P9_DEBUG_9P, "Cache mode: loose\n");
>        } else if (!strcmp(s, "fscache")) {
>                version = CACHE_FSCACHE;
> -               P9_DPRINTK(P9_DEBUG_9P, "Cache mode: fscache\n");
> +               p9_debug(P9_DEBUG_9P, "Cache mode: fscache\n");
>        } else if (!strcmp(s, "none")) {
>                version = CACHE_NONE;
> -               P9_DPRINTK(P9_DEBUG_9P, "Cache mode: none\n");
> +               p9_debug(P9_DEBUG_9P, "Cache mode: none\n");
>        } else
> -               printk(KERN_INFO "9p: Unknown Cache mode %s.\n", s);
> +               pr_info("Unknown Cache mode %s\n", s);
>        return version;
>  }
>
> @@ -140,8 +142,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                case Opt_debug:
>                        r = match_int(&args[0], &option);
>                        if (r < 0) {
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                          "integer field, but no integer?\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "integer field, but no integer?\n");
>                                ret = r;
>                                continue;
>                        }
> @@ -154,8 +156,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                case Opt_dfltuid:
>                        r = match_int(&args[0], &option);
>                        if (r < 0) {
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                          "integer field, but no integer?\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "integer field, but no integer?\n");
>                                ret = r;
>                                continue;
>                        }
> @@ -164,8 +166,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                case Opt_dfltgid:
>                        r = match_int(&args[0], &option);
>                        if (r < 0) {
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                          "integer field, but no integer?\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "integer field, but no integer?\n");
>                                ret = r;
>                                continue;
>                        }
> @@ -174,8 +176,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                case Opt_afid:
>                        r = match_int(&args[0], &option);
>                        if (r < 0) {
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                          "integer field, but no integer?\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "integer field, but no integer?\n");
>                                ret = r;
>                                continue;
>                        }
> @@ -205,8 +207,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                        s = match_strdup(&args[0]);
>                        if (!s) {
>                                ret = -ENOMEM;
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                 "problem allocating copy of cache arg\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "problem allocating copy of cache arg\n");
>                                goto free_and_return;
>                        }
>                        ret = get_cache_mode(s);
> @@ -223,8 +225,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                        s = match_strdup(&args[0]);
>                        if (!s) {
>                                ret = -ENOMEM;
> -                               P9_DPRINTK(P9_DEBUG_ERROR,
> -                                 "problem allocating copy of access arg\n");
> +                               p9_debug(P9_DEBUG_ERROR,
> +                                        "problem allocating copy of access arg\n");
>                                goto free_and_return;
>                        }
>
> @@ -240,8 +242,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>                                v9ses->uid = simple_strtoul(s, &e, 10);
>                                if (*e != '\0') {
>                                        ret = -EINVAL;
> -                                       printk(KERN_INFO "9p: Unknown access "
> -                                                       "argument %s.\n", s);
> +                                       pr_info("Unknown access argument %s\n",
> +                                               s);
>                                        kfree(s);
>                                        goto free_and_return;
>                                }
> @@ -254,9 +256,8 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
>  #ifdef CONFIG_9P_FS_POSIX_ACL
>                        v9ses->flags |= V9FS_POSIX_ACL;
>  #else
> -                       P9_DPRINTK(P9_DEBUG_ERROR,
> -                                       "Not defined CONFIG_9P_FS_POSIX_ACL. "
> -                                       "Ignoring posixacl option\n");
> +                       p9_debug(P9_DEBUG_ERROR,
> +                                "Not defined CONFIG_9P_FS_POSIX_ACL. Ignoring posixacl option\n");
>  #endif
>                        break;
>
> @@ -318,7 +319,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
>        if (IS_ERR(v9ses->clnt)) {
>                retval = PTR_ERR(v9ses->clnt);
>                v9ses->clnt = NULL;
> -               P9_DPRINTK(P9_DEBUG_ERROR, "problem initializing 9p client\n");
> +               p9_debug(P9_DEBUG_ERROR, "problem initializing 9p client\n");
>                goto error;
>        }
>
> @@ -371,7 +372,7 @@ struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
>        if (IS_ERR(fid)) {
>                retval = PTR_ERR(fid);
>                fid = NULL;
> -               P9_DPRINTK(P9_DEBUG_ERROR, "cannot attach\n");
> +               p9_debug(P9_DEBUG_ERROR, "cannot attach\n");
>                goto error;
>        }
>
> @@ -429,7 +430,7 @@ void v9fs_session_close(struct v9fs_session_info *v9ses)
>  */
>
>  void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
> -       P9_DPRINTK(P9_DEBUG_ERROR, "cancel session %p\n", v9ses);
> +       p9_debug(P9_DEBUG_ERROR, "cancel session %p\n", v9ses);
>        p9_client_disconnect(v9ses->clnt);
>  }
>
> @@ -442,7 +443,7 @@ void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
>
>  void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses)
>  {
> -       P9_DPRINTK(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses);
> +       p9_debug(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses);
>        p9_client_begin_disconnect(v9ses->clnt);
>  }
>
> @@ -591,23 +592,23 @@ static void v9fs_cache_unregister(void)
>  static int __init init_v9fs(void)
>  {
>        int err;
> -       printk(KERN_INFO "Installing v9fs 9p2000 file system support\n");
> +       pr_info("Installing v9fs 9p2000 file system support\n");
>        /* TODO: Setup list of registered trasnport modules */
>        err = register_filesystem(&v9fs_fs_type);
>        if (err < 0) {
> -               printk(KERN_ERR "Failed to register filesystem\n");
> +               pr_err("Failed to register filesystem\n");
>                return err;
>        }
>
>        err = v9fs_cache_register();
>        if (err < 0) {
> -               printk(KERN_ERR "Failed to register v9fs for caching\n");
> +               pr_err("Failed to register v9fs for caching\n");
>                goto out_fs_unreg;
>        }
>
>        err = v9fs_sysfs_init();
>        if (err < 0) {
> -               printk(KERN_ERR "Failed to register with sysfs\n");
> +               pr_err("Failed to register with sysfs\n");
>                goto out_sysfs_cleanup;
>        }
>
> @@ -637,6 +638,30 @@ static void __exit exit_v9fs(void)
>  module_init(init_v9fs)
>  module_exit(exit_v9fs)
>
> +#ifdef CONFIG_NET_9P_DEBUG
> +void _p9_debug(enum p9_debug_flags level, const char *func,
> +              const char *fmt, ...)
> +{
> +       struct va_format vaf;
> +       va_list args;
> +
> +       if ((p9_debug_level & level) != level)
> +               return;
> +
> +       va_start(args, fmt);
> +
> +       vaf.fmt = fmt;
> +       vaf.va = &args;
> +
> +       if (level == P9_DEBUG_9P)
> +               pr_notice("(%8.8d) %pV", task_pid_nr(current), &vaf);
> +       else
> +               pr_notice("-- %s (%d): %pV", func, task_pid_nr(current), &vaf);
> +
> +       va_end(args);
> +}
> +#endif
> +
>  MODULE_AUTHOR("Latchesar Ionkov <lucho@ionkov.net>");
>  MODULE_AUTHOR("Eric Van Hensbergen <ericvh@gmail.com>");
>  MODULE_AUTHOR("Ron Minnich <rminnich@lanl.gov>");
> diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
> index 2524e4c..0ad61c6 100644
> --- a/fs/9p/vfs_addr.c
> +++ b/fs/9p/vfs_addr.c
> @@ -56,7 +56,7 @@ static int v9fs_fid_readpage(struct p9_fid *fid, struct page *page)
>        struct inode *inode;
>
>        inode = page->mapping->host;
> -       P9_DPRINTK(P9_DEBUG_VFS, "\n");
> +       p9_debug(P9_DEBUG_VFS, "\n");
>
>        BUG_ON(!PageLocked(page));
>
> @@ -116,14 +116,14 @@ static int v9fs_vfs_readpages(struct file *filp, struct address_space *mapping,
>        struct inode *inode;
>
>        inode = mapping->host;
> -       P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, filp);
> +       p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, filp);
>
>        ret = v9fs_readpages_from_fscache(inode, mapping, pages, &nr_pages);
>        if (ret == 0)
>                return ret;
>
>        ret = read_cache_pages(mapping, pages, (void *)v9fs_vfs_readpage, filp);
> -       P9_DPRINTK(P9_DEBUG_VFS, "  = %d\n", ret);
> +       p9_debug(P9_DEBUG_VFS, "  = %d\n", ret);
>        return ret;
>  }
>
> @@ -263,10 +263,9 @@ v9fs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
>         * Now that we do caching with cache mode enabled, We need
>         * to support direct IO
>         */
> -       P9_DPRINTK(P9_DEBUG_VFS, "v9fs_direct_IO: v9fs_direct_IO (%s) "
> -                       "off/no(%lld/%lu) EINVAL\n",
> -                       iocb->ki_filp->f_path.dentry->d_name.name,
> -                       (long long) pos, nr_segs);
> +       p9_debug(P9_DEBUG_VFS, "v9fs_direct_IO: v9fs_direct_IO (%s) off/no(%lld/%lu) EINVAL\n",
> +                iocb->ki_filp->f_path.dentry->d_name.name,
> +                (long long)pos, nr_segs);
>
>        return -EINVAL;
>  }
> diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c
> index e022890..d529437 100644
> --- a/fs/9p/vfs_dentry.c
> +++ b/fs/9p/vfs_dentry.c
> @@ -53,8 +53,8 @@
>
>  static int v9fs_dentry_delete(const struct dentry *dentry)
>  {
> -       P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name,
> -                                                                       dentry);
> +       p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
> +                dentry->d_name.name, dentry);
>
>        return 1;
>  }
> @@ -66,8 +66,8 @@ static int v9fs_dentry_delete(const struct dentry *dentry)
>  */
>  static int v9fs_cached_dentry_delete(const struct dentry *dentry)
>  {
> -       P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n",
> -                  dentry->d_name.name, dentry);
> +       p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
> +                dentry->d_name.name, dentry);
>
>        /* Don't cache negative dentries */
>        if (!dentry->d_inode)
> @@ -86,8 +86,8 @@ static void v9fs_dentry_release(struct dentry *dentry)
>        struct v9fs_dentry *dent;
>        struct p9_fid *temp, *current_fid;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name,
> -                                                                       dentry);
> +       p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
> +                dentry->d_name.name, dentry);
>        dent = dentry->d_fsdata;
>        if (dent) {
>                list_for_each_entry_safe(current_fid, temp, &dent->fidlist,
> diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
> index 598fff1..ff911e7 100644
> --- a/fs/9p/vfs_dir.c
> +++ b/fs/9p/vfs_dir.c
> @@ -140,7 +140,7 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
>        int reclen = 0;
>        struct p9_rdir *rdir;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
>        fid = filp->private_data;
>
>        buflen = fid->clnt->msize - P9_IOHDRSZ;
> @@ -168,7 +168,7 @@ static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
>                        err = p9stat_read(fid->clnt, rdir->buf + rdir->head,
>                                          rdir->tail - rdir->head, &st);
>                        if (err) {
> -                               P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err);
> +                               p9_debug(P9_DEBUG_VFS, "returned %d\n", err);
>                                err = -EIO;
>                                p9stat_free(&st);
>                                goto unlock_and_exit;
> @@ -213,7 +213,7 @@ static int v9fs_dir_readdir_dotl(struct file *filp, void *dirent,
>        struct p9_dirent curdirent;
>        u64 oldoffset = 0;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
>        fid = filp->private_data;
>
>        buflen = fid->clnt->msize - P9_READDIRHDRSZ;
> @@ -244,7 +244,7 @@ static int v9fs_dir_readdir_dotl(struct file *filp, void *dirent,
>                                            rdir->tail - rdir->head,
>                                            &curdirent);
>                        if (err < 0) {
> -                               P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err);
> +                               p9_debug(P9_DEBUG_VFS, "returned %d\n", err);
>                                err = -EIO;
>                                goto unlock_and_exit;
>                        }
> @@ -290,9 +290,8 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
>        struct p9_fid *fid;
>
>        fid = filp->private_data;
> -       P9_DPRINTK(P9_DEBUG_VFS,
> -                       "v9fs_dir_release: inode: %p filp: %p fid: %d\n",
> -                       inode, filp, fid ? fid->fid : -1);
> +       p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n",
> +                inode, filp, fid ? fid->fid : -1);
>        if (fid)
>                p9_client_clunk(fid);
>        return 0;
> diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
> index 62857a8..8947f9f 100644
> --- a/fs/9p/vfs_file.c
> +++ b/fs/9p/vfs_file.c
> @@ -61,7 +61,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
>        struct p9_fid *fid;
>        int omode;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
> +       p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
>        v9inode = V9FS_I(inode);
>        v9ses = v9fs_inode2v9ses(inode);
>        if (v9fs_proto_dotl(v9ses))
> @@ -135,7 +135,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
>        int res = 0;
>        struct inode *inode = filp->f_path.dentry->d_inode;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
> +       p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
>
>        /* No mandatory locks */
>        if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
> @@ -304,8 +304,8 @@ static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl)
>        struct inode *inode = filp->f_path.dentry->d_inode;
>        int ret = -ENOLCK;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", filp,
> -                               cmd, fl, filp->f_path.dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
> +                filp, cmd, fl, filp->f_path.dentry->d_name.name);
>
>        /* No mandatory locks */
>        if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
> @@ -340,8 +340,8 @@ static int v9fs_file_flock_dotl(struct file *filp, int cmd,
>        struct inode *inode = filp->f_path.dentry->d_inode;
>        int ret = -ENOLCK;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", filp,
> -                               cmd, fl, filp->f_path.dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
> +                filp, cmd, fl, filp->f_path.dentry->d_name.name);
>
>        /* No mandatory locks */
>        if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
> @@ -384,8 +384,8 @@ v9fs_fid_readn(struct p9_fid *fid, char *data, char __user *udata, u32 count,
>  {
>        int n, total, size;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "fid %d offset %llu count %d\n", fid->fid,
> -                  (long long unsigned) offset, count);
> +       p9_debug(P9_DEBUG_VFS, "fid %d offset %llu count %d\n",
> +                fid->fid, (long long unsigned)offset, count);
>        n = 0;
>        total = 0;
>        size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ;
> @@ -443,7 +443,7 @@ v9fs_file_read(struct file *filp, char __user *udata, size_t count,
>        struct p9_fid *fid;
>        size_t size;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset);
> +       p9_debug(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset);
>        fid = filp->private_data;
>
>        size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ;
> @@ -470,8 +470,8 @@ v9fs_file_write_internal(struct inode *inode, struct p9_fid *fid,
>        loff_t origin = *offset;
>        unsigned long pg_start, pg_end;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data,
> -               (int)count, (int)*offset);
> +       p9_debug(P9_DEBUG_VFS, "data %p count %d offset %x\n",
> +                data, (int)count, (int)*offset);
>
>        clnt = fid->clnt;
>        do {
> @@ -552,7 +552,7 @@ static int v9fs_file_fsync(struct file *filp, loff_t start, loff_t end,
>                return retval;
>
>        mutex_lock(&inode->i_mutex);
> -       P9_DPRINTK(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
> +       p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
>
>        fid = filp->private_data;
>        v9fs_blank_wstat(&wstat);
> @@ -575,8 +575,7 @@ int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end,
>                return retval;
>
>        mutex_lock(&inode->i_mutex);
> -       P9_DPRINTK(P9_DEBUG_VFS, "v9fs_file_fsync_dotl: filp %p datasync %x\n",
> -                       filp, datasync);
> +       p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
>
>        fid = filp->private_data;
>
> @@ -607,8 +606,8 @@ v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
>        struct inode *inode = filp->f_path.dentry->d_inode;
>
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "page %p fid %lx\n",
> -                  page, (unsigned long)filp->private_data);
> +       p9_debug(P9_DEBUG_VFS, "page %p fid %lx\n",
> +                page, (unsigned long)filp->private_data);
>
>        v9inode = V9FS_I(inode);
>        /* make sure the cache has finished storing the page */
> diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
> index 879ed88..85c2973 100644
> --- a/fs/9p/vfs_inode.c
> +++ b/fs/9p/vfs_inode.c
> @@ -23,6 +23,8 @@
>  *
>  */
>
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
>  #include <linux/module.h>
>  #include <linux/errno.h>
>  #include <linux/fs.h>
> @@ -133,9 +135,8 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses,
>                        res |= S_IFBLK;
>                        break;
>                default:
> -                       P9_DPRINTK(P9_DEBUG_ERROR,
> -                               "Unknown special type %c %s\n", type,
> -                               stat->extension);
> +                       p9_debug(P9_DEBUG_ERROR, "Unknown special type %c %s\n",
> +                                type, stat->extension);
>                };
>                *rdev = MKDEV(major, minor);
>        } else
> @@ -281,8 +282,8 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
>                } else if (v9fs_proto_dotu(v9ses)) {
>                        inode->i_op = &v9fs_file_inode_operations;
>                } else {
> -                       P9_DPRINTK(P9_DEBUG_ERROR,
> -                                  "special files without extended mode\n");
> +                       p9_debug(P9_DEBUG_ERROR,
> +                                "special files without extended mode\n");
>                        err = -EINVAL;
>                        goto error;
>                }
> @@ -307,8 +308,8 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
>                break;
>        case S_IFLNK:
>                if (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)) {
> -                       P9_DPRINTK(P9_DEBUG_ERROR, "extended modes used with "
> -                                               "legacy protocol.\n");
> +                       p9_debug(P9_DEBUG_ERROR,
> +                                "extended modes used with legacy protocol\n");
>                        err = -EINVAL;
>                        goto error;
>                }
> @@ -335,8 +336,8 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses,
>
>                break;
>        default:
> -               P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n",
> -                          mode, mode & S_IFMT);
> +               p9_debug(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n",
> +                        mode, mode & S_IFMT);
>                err = -EINVAL;
>                goto error;
>        }
> @@ -358,11 +359,12 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t rdev)
>        struct inode *inode;
>        struct v9fs_session_info *v9ses = sb->s_fs_info;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode);
> +       p9_debug(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode);
>
>        inode = new_inode(sb);
>        if (!inode) {
> -               P9_EPRINTK(KERN_WARNING, "Problem allocating inode\n");
> +               pr_warn("%s (%d): Problem allocating inode\n",
> +                       __func__, task_pid_nr(current));
>                return ERR_PTR(-ENOMEM);
>        }
>        err = v9fs_init_inode(v9ses, inode, mode, rdev);
> @@ -578,15 +580,15 @@ static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)
>        struct p9_fid *v9fid, *dfid;
>        struct v9fs_session_info *v9ses;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n",
> -                  dir, dentry, flags);
> +       p9_debug(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n",
> +                dir, dentry, flags);
>
>        v9ses = v9fs_inode2v9ses(dir);
>        inode = dentry->d_inode;
>        dfid = v9fs_fid_lookup(dentry->d_parent);
>        if (IS_ERR(dfid)) {
>                retval = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", retval);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", retval);
>                return retval;
>        }
>        if (v9fs_proto_dotl(v9ses))
> @@ -635,7 +637,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
>        struct p9_fid *dfid, *ofid, *fid;
>        struct inode *inode;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
>
>        err = 0;
>        ofid = NULL;
> @@ -644,7 +646,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
>        dfid = v9fs_fid_lookup(dentry->d_parent);
>        if (IS_ERR(dfid)) {
>                err = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
>                return ERR_PTR(err);
>        }
>
> @@ -652,13 +654,13 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
>        ofid = p9_client_walk(dfid, 0, NULL, 1);
>        if (IS_ERR(ofid)) {
>                err = PTR_ERR(ofid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
>                return ERR_PTR(err);
>        }
>
>        err = p9_client_fcreate(ofid, name, perm, mode, extension);
>        if (err < 0) {
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_fcreate failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_fcreate failed %d\n", err);
>                goto error;
>        }
>
> @@ -666,7 +668,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
>        fid = p9_client_walk(dfid, 1, &name, 1);
>        if (IS_ERR(fid)) {
>                err = PTR_ERR(fid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
>                fid = NULL;
>                goto error;
>        }
> @@ -675,7 +677,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
>        inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
>        if (IS_ERR(inode)) {
>                err = PTR_ERR(inode);
> -               P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
>                goto error;
>        }
>        err = v9fs_fid_add(dentry, fid);
> @@ -793,7 +795,7 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
>        struct p9_fid *fid;
>        struct v9fs_session_info *v9ses;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
>        err = 0;
>        v9ses = v9fs_inode2v9ses(dir);
>        perm = unixmode2p9mode(v9ses, mode | S_IFDIR);
> @@ -831,8 +833,8 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
>        char *name;
>        int result = 0;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n",
> -               dir, dentry->d_name.name, dentry, nameidata);
> +       p9_debug(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n",
> +                dir, dentry->d_name.name, dentry, nameidata);
>
>        if (dentry->d_name.len > NAME_MAX)
>                return ERR_PTR(-ENAMETOOLONG);
> @@ -938,7 +940,7 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
>        struct p9_fid *newdirfid;
>        struct p9_wstat wstat;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "\n");
> +       p9_debug(P9_DEBUG_VFS, "\n");
>        retval = 0;
>        old_inode = old_dentry->d_inode;
>        new_inode = new_dentry->d_inode;
> @@ -974,8 +976,7 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
>                 * 9P .u can only handle file rename in the same directory
>                 */
>
> -               P9_DPRINTK(P9_DEBUG_ERROR,
> -                               "old dir and new dir are different\n");
> +               p9_debug(P9_DEBUG_ERROR, "old dir and new dir are different\n");
>                retval = -EXDEV;
>                goto clunk_newdir;
>        }
> @@ -1031,7 +1032,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
>        struct p9_fid *fid;
>        struct p9_wstat *st;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry);
> +       p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
>        err = -EPERM;
>        v9ses = v9fs_dentry2v9ses(dentry);
>        if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
> @@ -1068,7 +1069,7 @@ static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
>        struct p9_fid *fid;
>        struct p9_wstat wstat;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "\n");
> +       p9_debug(P9_DEBUG_VFS, "\n");
>        retval = inode_change_ok(dentry->d_inode, iattr);
>        if (retval)
>                return retval;
> @@ -1213,7 +1214,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
>        struct p9_fid *fid;
>        struct p9_wstat *st;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " %s\n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, " %s\n", dentry->d_name.name);
>        retval = -EPERM;
>        v9ses = v9fs_dentry2v9ses(dentry);
>        fid = v9fs_fid_lookup(dentry);
> @@ -1235,8 +1236,8 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
>        /* copy extension buffer into buffer */
>        strncpy(buffer, st->extension, buflen);
>
> -       P9_DPRINTK(P9_DEBUG_VFS,
> -               "%s -> %s (%s)\n", dentry->d_name.name, st->extension, buffer);
> +       p9_debug(P9_DEBUG_VFS, "%s -> %s (%s)\n",
> +                dentry->d_name.name, st->extension, buffer);
>
>        retval = strnlen(buffer, buflen);
>  done:
> @@ -1257,7 +1258,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
>        int len = 0;
>        char *link = __getname();
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
>
>        if (!link)
>                link = ERR_PTR(-ENOMEM);
> @@ -1288,8 +1289,8 @@ v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
>  {
>        char *s = nd_get_link(nd);
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " %s %s\n", dentry->d_name.name,
> -               IS_ERR(s) ? "<error>" : s);
> +       p9_debug(P9_DEBUG_VFS, " %s %s\n",
> +                dentry->d_name.name, IS_ERR(s) ? "<error>" : s);
>        if (!IS_ERR(s))
>                __putname(s);
>  }
> @@ -1312,7 +1313,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
>
>        v9ses = v9fs_inode2v9ses(dir);
>        if (!v9fs_proto_dotu(v9ses)) {
> -               P9_DPRINTK(P9_DEBUG_ERROR, "not extended\n");
> +               p9_debug(P9_DEBUG_ERROR, "not extended\n");
>                return -EPERM;
>        }
>
> @@ -1340,8 +1341,8 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
>  static int
>  v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
>  {
> -       P9_DPRINTK(P9_DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino,
> -                                       dentry->d_name.name, symname);
> +       p9_debug(P9_DEBUG_VFS, " %lu,%s,%s\n",
> +                dir->i_ino, dentry->d_name.name, symname);
>
>        return v9fs_vfs_mkspecial(dir, dentry, S_IFLNK, symname);
>  }
> @@ -1362,9 +1363,8 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
>        char *name;
>        struct p9_fid *oldfid;
>
> -       P9_DPRINTK(P9_DEBUG_VFS,
> -               " %lu,%s,%s\n", dir->i_ino, dentry->d_name.name,
> -               old_dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, " %lu,%s,%s\n",
> +                dir->i_ino, dentry->d_name.name, old_dentry->d_name.name);
>
>        oldfid = v9fs_fid_clone(old_dentry);
>        if (IS_ERR(oldfid))
> @@ -1403,9 +1403,9 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
>        int retval;
>        char *name;
>
> -       P9_DPRINTK(P9_DEBUG_VFS,
> -               " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino,
> -               dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev));
> +       p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %x MAJOR: %u MINOR: %u\n",
> +                dir->i_ino, dentry->d_name.name, mode,
> +                MAJOR(rdev), MINOR(rdev));
>
>        if (!new_valid_dev(rdev))
>                return -EINVAL;
> diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
> index 0b5745e..73488fb 100644
> --- a/fs/9p/vfs_inode_dotl.c
> +++ b/fs/9p/vfs_inode_dotl.c
> @@ -283,13 +283,13 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        }
>
>        name = (char *) dentry->d_name.name;
> -       P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x "
> -                       "mode:0x%x\n", name, flags, omode);
> +       p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%x\n",
> +                name, flags, omode);
>
>        dfid = v9fs_fid_lookup(dentry->d_parent);
>        if (IS_ERR(dfid)) {
>                err = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
>                return err;
>        }
>
> @@ -297,7 +297,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        ofid = p9_client_walk(dfid, 0, NULL, 1);
>        if (IS_ERR(ofid)) {
>                err = PTR_ERR(ofid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
>                return err;
>        }
>
> @@ -307,16 +307,15 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        /* Update mode based on ACL value */
>        err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
>        if (err) {
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                          "Failed to get acl values in creat %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "Failed to get acl values in creat %d\n",
> +                        err);
>                goto error;
>        }
>        err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags),
>                                    mode, gid, &qid);
>        if (err < 0) {
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                               "p9_client_open_dotl failed in creat %d\n",
> -                               err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n",
> +                        err);
>                goto error;
>        }
>        v9fs_invalidate_inode_attr(dir);
> @@ -325,14 +324,14 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        fid = p9_client_walk(dfid, 1, &name, 1);
>        if (IS_ERR(fid)) {
>                err = PTR_ERR(fid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
>                fid = NULL;
>                goto error;
>        }
>        inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
>        if (IS_ERR(inode)) {
>                err = PTR_ERR(inode);
> -               P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
>                goto error;
>        }
>        err = v9fs_fid_add(dentry, fid);
> @@ -408,7 +407,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
>        struct dentry *dir_dentry;
>        struct posix_acl *dacl = NULL, *pacl = NULL;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
>        err = 0;
>        v9ses = v9fs_inode2v9ses(dir);
>
> @@ -420,7 +419,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
>        dfid = v9fs_fid_lookup(dir_dentry);
>        if (IS_ERR(dfid)) {
>                err = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
>                dfid = NULL;
>                goto error;
>        }
> @@ -430,8 +429,8 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
>        /* Update mode based on ACL value */
>        err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
>        if (err) {
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                          "Failed to get acl values in mkdir %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mkdir %d\n",
> +                        err);
>                goto error;
>        }
>        name = (char *) dentry->d_name.name;
> @@ -444,8 +443,8 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
>                fid = p9_client_walk(dfid, 1, &name, 1);
>                if (IS_ERR(fid)) {
>                        err = PTR_ERR(fid);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> -                               err);
> +                       p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> +                                err);
>                        fid = NULL;
>                        goto error;
>                }
> @@ -453,8 +452,8 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
>                inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
>                if (IS_ERR(inode)) {
>                        err = PTR_ERR(inode);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
> -                               err);
> +                       p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
> +                                err);
>                        goto error;
>                }
>                err = v9fs_fid_add(dentry, fid);
> @@ -495,7 +494,7 @@ v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
>        struct p9_fid *fid;
>        struct p9_stat_dotl *st;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry);
> +       p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
>        err = -EPERM;
>        v9ses = v9fs_dentry2v9ses(dentry);
>        if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
> @@ -537,7 +536,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
>        struct p9_fid *fid;
>        struct p9_iattr_dotl p9attr;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "\n");
> +       p9_debug(P9_DEBUG_VFS, "\n");
>
>        retval = inode_change_ok(dentry->d_inode, iattr);
>        if (retval)
> @@ -670,14 +669,13 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
>        struct v9fs_session_info *v9ses;
>
>        name = (char *) dentry->d_name.name;
> -       P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_symlink_dotl : %lu,%s,%s\n",
> -                       dir->i_ino, name, symname);
> +       p9_debug(P9_DEBUG_VFS, "%lu,%s,%s\n", dir->i_ino, name, symname);
>        v9ses = v9fs_inode2v9ses(dir);
>
>        dfid = v9fs_fid_lookup(dentry->d_parent);
>        if (IS_ERR(dfid)) {
>                err = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
>                return err;
>        }
>
> @@ -687,7 +685,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
>        err = p9_client_symlink(dfid, name, (char *)symname, gid, &qid);
>
>        if (err < 0) {
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err);
>                goto error;
>        }
>
> @@ -697,8 +695,8 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
>                fid = p9_client_walk(dfid, 1, &name, 1);
>                if (IS_ERR(fid)) {
>                        err = PTR_ERR(fid);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> -                                       err);
> +                       p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> +                                err);
>                        fid = NULL;
>                        goto error;
>                }
> @@ -707,8 +705,8 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
>                inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
>                if (IS_ERR(inode)) {
>                        err = PTR_ERR(inode);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
> -                                       err);
> +                       p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
> +                                err);
>                        goto error;
>                }
>                err = v9fs_fid_add(dentry, fid);
> @@ -751,9 +749,8 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
>        struct p9_fid *dfid, *oldfid;
>        struct v9fs_session_info *v9ses;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
> -                       dir->i_ino, old_dentry->d_name.name,
> -                       dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
> +                dir->i_ino, old_dentry->d_name.name, dentry->d_name.name);
>
>        v9ses = v9fs_inode2v9ses(dir);
>        dir_dentry = v9fs_dentry_from_dir_inode(dir);
> @@ -770,7 +767,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
>        err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name);
>
>        if (err < 0) {
> -               P9_DPRINTK(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
>                return err;
>        }
>
> @@ -813,9 +810,9 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        struct dentry *dir_dentry;
>        struct posix_acl *dacl = NULL, *pacl = NULL;
>
> -       P9_DPRINTK(P9_DEBUG_VFS,
> -               " %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino,
> -               dentry->d_name.name, omode, MAJOR(rdev), MINOR(rdev));
> +       p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %x MAJOR: %u MINOR: %u\n",
> +                dir->i_ino, dentry->d_name.name, omode,
> +                MAJOR(rdev), MINOR(rdev));
>
>        if (!new_valid_dev(rdev))
>                return -EINVAL;
> @@ -825,7 +822,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        dfid = v9fs_fid_lookup(dir_dentry);
>        if (IS_ERR(dfid)) {
>                err = PTR_ERR(dfid);
> -               P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
>                dfid = NULL;
>                goto error;
>        }
> @@ -835,8 +832,8 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
>        /* Update mode based on ACL value */
>        err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
>        if (err) {
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                          "Failed to get acl values in mknod %d\n", err);
> +               p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mknod %d\n",
> +                        err);
>                goto error;
>        }
>        name = (char *) dentry->d_name.name;
> @@ -851,8 +848,8 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
>                fid = p9_client_walk(dfid, 1, &name, 1);
>                if (IS_ERR(fid)) {
>                        err = PTR_ERR(fid);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> -                               err);
> +                       p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
> +                                err);
>                        fid = NULL;
>                        goto error;
>                }
> @@ -860,8 +857,8 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
>                inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
>                if (IS_ERR(inode)) {
>                        err = PTR_ERR(inode);
> -                       P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
> -                               err);
> +                       p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
> +                                err);
>                        goto error;
>                }
>                err = v9fs_fid_add(dentry, fid);
> @@ -905,7 +902,7 @@ v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd)
>        char *link = __getname();
>        char *target;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
> +       p9_debug(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
>
>        if (!link) {
>                link = ERR_PTR(-ENOMEM);
> diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
> index c70251d..06d19735 100644
> --- a/fs/9p/vfs_super.c
> +++ b/fs/9p/vfs_super.c
> @@ -121,7 +121,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
>        struct p9_fid *fid;
>        int retval = 0;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " \n");
> +       p9_debug(P9_DEBUG_VFS, "\n");
>
>        v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
>        if (!v9ses)
> @@ -191,7 +191,7 @@ static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
>                goto release_sb;
>        v9fs_fid_add(root, fid);
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
> +       p9_debug(P9_DEBUG_VFS, " simple set mount, return 0\n");
>        return dget(sb->s_root);
>
>  clunk_fid:
> @@ -223,7 +223,7 @@ static void v9fs_kill_super(struct super_block *s)
>  {
>        struct v9fs_session_info *v9ses = s->s_fs_info;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s);
> +       p9_debug(P9_DEBUG_VFS, " %p\n", s);
>
>        kill_anon_super(s);
>
> @@ -231,7 +231,7 @@ static void v9fs_kill_super(struct super_block *s)
>        v9fs_session_close(v9ses);
>        kfree(v9ses);
>        s->s_fs_info = NULL;
> -       P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n");
> +       p9_debug(P9_DEBUG_VFS, "exiting kill_super\n");
>  }
>
>  static void
> @@ -303,7 +303,7 @@ static int v9fs_write_inode(struct inode *inode,
>         * send an fsync request to server irrespective of
>         * wbc->sync_mode.
>         */
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
> +       p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
>        v9inode = V9FS_I(inode);
>        if (!v9inode->writeback_fid)
>                return 0;
> @@ -326,7 +326,7 @@ static int v9fs_write_inode_dotl(struct inode *inode,
>         * send an fsync request to server irrespective of
>         * wbc->sync_mode.
>         */
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
> +       p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
>        v9inode = V9FS_I(inode);
>        if (!v9inode->writeback_fid)
>                return 0;
> diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
> index d288773..29653b7 100644
> --- a/fs/9p/xattr.c
> +++ b/fs/9p/xattr.c
> @@ -32,8 +32,8 @@ ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,
>        attr_fid = p9_client_xattrwalk(fid, name, &attr_size);
>        if (IS_ERR(attr_fid)) {
>                retval = PTR_ERR(attr_fid);
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                       "p9_client_attrwalk failed %zd\n", retval);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_attrwalk failed %zd\n",
> +                        retval);
>                attr_fid = NULL;
>                goto error;
>        }
> @@ -87,8 +87,8 @@ ssize_t v9fs_xattr_get(struct dentry *dentry, const char *name,
>  {
>        struct p9_fid *fid;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s: name = %s value_len = %zu\n",
> -               __func__, name, buffer_size);
> +       p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu\n",
> +                name, buffer_size);
>        fid = v9fs_fid_lookup(dentry);
>        if (IS_ERR(fid))
>                return PTR_ERR(fid);
> @@ -115,8 +115,8 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
>        int retval, msize, write_count;
>        struct p9_fid *fid = NULL;
>
> -       P9_DPRINTK(P9_DEBUG_VFS, "%s: name = %s value_len = %zu flags = %d\n",
> -               __func__, name, value_len, flags);
> +       p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu flags = %d\n",
> +                name, value_len, flags);
>
>        fid = v9fs_fid_clone(dentry);
>        if (IS_ERR(fid)) {
> @@ -129,8 +129,8 @@ int v9fs_xattr_set(struct dentry *dentry, const char *name,
>         */
>        retval = p9_client_xattrcreate(fid, name, value_len, flags);
>        if (retval < 0) {
> -               P9_DPRINTK(P9_DEBUG_VFS,
> -                       "p9_client_xattrcreate failed %d\n", retval);
> +               p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n",
> +                        retval);
>                goto error;
>        }
>        msize = fid->clnt->msize;
> diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
> index 2d70b95..7184853 100644
> --- a/include/net/9p/9p.h
> +++ b/include/net/9p/9p.h
> @@ -63,30 +63,16 @@ enum p9_debug_flags {
>
>  #ifdef CONFIG_NET_9P_DEBUG
>  extern unsigned int p9_debug_level;
> -
> -#define P9_DPRINTK(level, format, arg...) \
> -do {  \
> -       if ((p9_debug_level & level) == level) {\
> -               if (level == P9_DEBUG_9P) \
> -                       printk(KERN_NOTICE "(%8.8d) " \
> -                       format , task_pid_nr(current) , ## arg); \
> -               else \
> -                       printk(KERN_NOTICE "-- %s (%d): " \
> -                       format , __func__, task_pid_nr(current) , ## arg); \
> -       } \
> -} while (0)
> -
> +__printf(3, 4)
> +void _p9_debug(enum p9_debug_flags level, const char *func,
> +              const char *fmt, ...);
> +#define p9_debug(level, fmt, ...)                      \
> +       _p9_debug(level, __func__, fmt, ##__VA_ARGS__)
>  #else
> -#define P9_DPRINTK(level, format, arg...)  do { } while (0)
> +#define p9_debug(level, fmt, ...)                      \
> +       no_printk(fmt, ##__VA_ARGS__)
>  #endif
>
> -
> -#define P9_EPRINTK(level, format, arg...) \
> -do { \
> -       printk(level "9p: %s (%d): " \
> -               format , __func__, task_pid_nr(current), ## arg); \
> -} while (0)
> -
>  /**
>  * enum p9_msg_t - 9P message types
>  * @P9_TLERROR: not used
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Joe Perches - Nov. 28, 2011, 5:14 p.m.
On Mon, 2011-11-28 at 09:10 -0600, Eric Van Hensbergen wrote:
> sorry, just got to reviewing this because of holidays.
> 
> On Fri, Nov 18, 2011 at 6:09 PM, Joe Perches <joe@perches.com> wrote:
> > Reduce object size by deduplicating formats.
> >
> > Use vsprintf extension %pV.
> > Rename P9_DPRINTK uses to p9_debug, align arguments.
> > Add function for _p9_debug and macro to add __func__.
> > Add missing "\n"s to p9_debug uses.
> > Remove embedded function names as p9_debug adds it.
> > Remove P9_EPRINTK macro and convert use to pr_<level>.
> > Add and use pr_fmt and pr_<level>.
> >
> > $ size fs/9p/built-in.o*
> >   text    data     bss     dec     hex filename
> >  62133     984   16000   79117   1350d fs/9p/built-in.o.new
> >  67342     984   16928   85254   14d06 fs/9p/built-in.o.old
> >
> > Signed-off-by: Joe Perches <joe@perches.com>
> 
> These changes seem reasonable enough, but since you only made changes
> in the fs/9p directory and not the net/9p directory which causes
> net/9p build to break with this patch.
> 
> CC      net/9p/client.o
> /home/ericvh/src/linux/v9fs-devel/net/9p/client.c: In function
> ‘get_protocol_version’:
> /home/ericvh/src/linux/v9fs-devel/net/9p/client.c:84:3: error:
> implicit declaration of function ‘P9_DPRINTK’

Sorry 'bout that.
I'll fix it and resubmit later.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/9p/cache.c b/fs/9p/cache.c
index 945aa5f..a9ea73d 100644
--- a/fs/9p/cache.c
+++ b/fs/9p/cache.c
@@ -62,8 +62,8 @@  static uint16_t v9fs_cache_session_get_key(const void *cookie_netfs_data,
 	uint16_t klen = 0;
 
 	v9ses = (struct v9fs_session_info *)cookie_netfs_data;
-	P9_DPRINTK(P9_DEBUG_FSC, "session %p buf %p size %u", v9ses,
-		   buffer, bufmax);
+	p9_debug(P9_DEBUG_FSC, "session %p buf %p size %u\n",
+		 v9ses, buffer, bufmax);
 
 	if (v9ses->cachetag)
 		klen = strlen(v9ses->cachetag);
@@ -72,7 +72,7 @@  static uint16_t v9fs_cache_session_get_key(const void *cookie_netfs_data,
 		return 0;
 
 	memcpy(buffer, v9ses->cachetag, klen);
-	P9_DPRINTK(P9_DEBUG_FSC, "cache session tag %s", v9ses->cachetag);
+	p9_debug(P9_DEBUG_FSC, "cache session tag %s\n", v9ses->cachetag);
 	return klen;
 }
 
@@ -91,14 +91,14 @@  void v9fs_cache_session_get_cookie(struct v9fs_session_info *v9ses)
 	v9ses->fscache = fscache_acquire_cookie(v9fs_cache_netfs.primary_index,
 						&v9fs_cache_session_index_def,
 						v9ses);
-	P9_DPRINTK(P9_DEBUG_FSC, "session %p get cookie %p", v9ses,
-		   v9ses->fscache);
+	p9_debug(P9_DEBUG_FSC, "session %p get cookie %p\n",
+		 v9ses, v9ses->fscache);
 }
 
 void v9fs_cache_session_put_cookie(struct v9fs_session_info *v9ses)
 {
-	P9_DPRINTK(P9_DEBUG_FSC, "session %p put cookie %p", v9ses,
-		   v9ses->fscache);
+	p9_debug(P9_DEBUG_FSC, "session %p put cookie %p\n",
+		 v9ses, v9ses->fscache);
 	fscache_relinquish_cookie(v9ses->fscache, 0);
 	v9ses->fscache = NULL;
 }
@@ -109,8 +109,8 @@  static uint16_t v9fs_cache_inode_get_key(const void *cookie_netfs_data,
 {
 	const struct v9fs_inode *v9inode = cookie_netfs_data;
 	memcpy(buffer, &v9inode->qid.path, sizeof(v9inode->qid.path));
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p get key %llu", &v9inode->vfs_inode,
-		   v9inode->qid.path);
+	p9_debug(P9_DEBUG_FSC, "inode %p get key %llu\n",
+		 &v9inode->vfs_inode, v9inode->qid.path);
 	return sizeof(v9inode->qid.path);
 }
 
@@ -120,8 +120,8 @@  static void v9fs_cache_inode_get_attr(const void *cookie_netfs_data,
 	const struct v9fs_inode *v9inode = cookie_netfs_data;
 	*size = i_size_read(&v9inode->vfs_inode);
 
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p get attr %llu", &v9inode->vfs_inode,
-		   *size);
+	p9_debug(P9_DEBUG_FSC, "inode %p get attr %llu\n",
+		 &v9inode->vfs_inode, *size);
 }
 
 static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data,
@@ -129,8 +129,8 @@  static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data,
 {
 	const struct v9fs_inode *v9inode = cookie_netfs_data;
 	memcpy(buffer, &v9inode->qid.version, sizeof(v9inode->qid.version));
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p get aux %u", &v9inode->vfs_inode,
-		   v9inode->qid.version);
+	p9_debug(P9_DEBUG_FSC, "inode %p get aux %u\n",
+		 &v9inode->vfs_inode, v9inode->qid.version);
 	return sizeof(v9inode->qid.version);
 }
 
@@ -206,8 +206,8 @@  void v9fs_cache_inode_get_cookie(struct inode *inode)
 						  &v9fs_cache_inode_index_def,
 						  v9inode);
 
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p get cookie %p", inode,
-		   v9inode->fscache);
+	p9_debug(P9_DEBUG_FSC, "inode %p get cookie %p\n",
+		 inode, v9inode->fscache);
 }
 
 void v9fs_cache_inode_put_cookie(struct inode *inode)
@@ -216,8 +216,8 @@  void v9fs_cache_inode_put_cookie(struct inode *inode)
 
 	if (!v9inode->fscache)
 		return;
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p put cookie %p", inode,
-		   v9inode->fscache);
+	p9_debug(P9_DEBUG_FSC, "inode %p put cookie %p\n",
+		 inode, v9inode->fscache);
 
 	fscache_relinquish_cookie(v9inode->fscache, 0);
 	v9inode->fscache = NULL;
@@ -229,8 +229,8 @@  void v9fs_cache_inode_flush_cookie(struct inode *inode)
 
 	if (!v9inode->fscache)
 		return;
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p flush cookie %p", inode,
-		   v9inode->fscache);
+	p9_debug(P9_DEBUG_FSC, "inode %p flush cookie %p\n",
+		 inode, v9inode->fscache);
 
 	fscache_relinquish_cookie(v9inode->fscache, 1);
 	v9inode->fscache = NULL;
@@ -272,8 +272,8 @@  void v9fs_cache_inode_reset_cookie(struct inode *inode)
 	v9inode->fscache = fscache_acquire_cookie(v9ses->fscache,
 						  &v9fs_cache_inode_index_def,
 						  v9inode);
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p",
-		   inode, old, v9inode->fscache);
+	p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n",
+		 inode, old, v9inode->fscache);
 
 	spin_unlock(&v9inode->fscache_lock);
 }
@@ -323,7 +323,7 @@  int __v9fs_readpage_from_fscache(struct inode *inode, struct page *page)
 	int ret;
 	const struct v9fs_inode *v9inode = V9FS_I(inode);
 
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page);
+	p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
 	if (!v9inode->fscache)
 		return -ENOBUFS;
 
@@ -335,13 +335,13 @@  int __v9fs_readpage_from_fscache(struct inode *inode, struct page *page)
 	switch (ret) {
 	case -ENOBUFS:
 	case -ENODATA:
-		P9_DPRINTK(P9_DEBUG_FSC, "page/inode not in cache %d", ret);
+		p9_debug(P9_DEBUG_FSC, "page/inode not in cache %d\n", ret);
 		return 1;
 	case 0:
-		P9_DPRINTK(P9_DEBUG_FSC, "BIO submitted");
+		p9_debug(P9_DEBUG_FSC, "BIO submitted\n");
 		return ret;
 	default:
-		P9_DPRINTK(P9_DEBUG_FSC, "ret %d", ret);
+		p9_debug(P9_DEBUG_FSC, "ret %d\n", ret);
 		return ret;
 	}
 }
@@ -361,7 +361,7 @@  int __v9fs_readpages_from_fscache(struct inode *inode,
 	int ret;
 	const struct v9fs_inode *v9inode = V9FS_I(inode);
 
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p pages %u", inode, *nr_pages);
+	p9_debug(P9_DEBUG_FSC, "inode %p pages %u\n", inode, *nr_pages);
 	if (!v9inode->fscache)
 		return -ENOBUFS;
 
@@ -373,15 +373,15 @@  int __v9fs_readpages_from_fscache(struct inode *inode,
 	switch (ret) {
 	case -ENOBUFS:
 	case -ENODATA:
-		P9_DPRINTK(P9_DEBUG_FSC, "pages/inodes not in cache %d", ret);
+		p9_debug(P9_DEBUG_FSC, "pages/inodes not in cache %d\n", ret);
 		return 1;
 	case 0:
 		BUG_ON(!list_empty(pages));
 		BUG_ON(*nr_pages != 0);
-		P9_DPRINTK(P9_DEBUG_FSC, "BIO submitted");
+		p9_debug(P9_DEBUG_FSC, "BIO submitted\n");
 		return ret;
 	default:
-		P9_DPRINTK(P9_DEBUG_FSC, "ret %d", ret);
+		p9_debug(P9_DEBUG_FSC, "ret %d\n", ret);
 		return ret;
 	}
 }
@@ -396,9 +396,9 @@  void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page)
 	int ret;
 	const struct v9fs_inode *v9inode = V9FS_I(inode);
 
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page);
+	p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
 	ret = fscache_write_page(v9inode->fscache, page, GFP_KERNEL);
-	P9_DPRINTK(P9_DEBUG_FSC, "ret =  %d", ret);
+	p9_debug(P9_DEBUG_FSC, "ret =  %d\n", ret);
 	if (ret != 0)
 		v9fs_uncache_page(inode, page);
 }
@@ -409,7 +409,7 @@  void __v9fs_readpage_to_fscache(struct inode *inode, struct page *page)
 void __v9fs_fscache_wait_on_page_write(struct inode *inode, struct page *page)
 {
 	const struct v9fs_inode *v9inode = V9FS_I(inode);
-	P9_DPRINTK(P9_DEBUG_FSC, "inode %p page %p", inode, page);
+	p9_debug(P9_DEBUG_FSC, "inode %p page %p\n", inode, page);
 	if (PageFsCache(page))
 		fscache_wait_on_page_write(v9inode->fscache, page);
 }
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index 85b67ff..da8eefb 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -45,8 +45,8 @@  int v9fs_fid_add(struct dentry *dentry, struct p9_fid *fid)
 {
 	struct v9fs_dentry *dent;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "fid %d dentry %s\n",
-					fid->fid, dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "fid %d dentry %s\n",
+		 fid->fid, dentry->d_name.name);
 
 	dent = dentry->d_fsdata;
 	if (!dent) {
@@ -79,8 +79,8 @@  static struct p9_fid *v9fs_fid_find(struct dentry *dentry, u32 uid, int any)
 	struct v9fs_dentry *dent;
 	struct p9_fid *fid, *ret;
 
-	P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n",
-		dentry->d_name.name, dentry, uid, any);
+	p9_debug(P9_DEBUG_VFS, " dentry: %s (%p) uid %d any %d\n",
+		 dentry->d_name.name, dentry, uid, any);
 	dent = (struct v9fs_dentry *) dentry->d_fsdata;
 	ret = NULL;
 	if (dent) {
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index 2b78014..4afc182 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -23,6 +23,8 @@ 
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
@@ -85,15 +87,15 @@  static int get_cache_mode(char *s)
 
 	if (!strcmp(s, "loose")) {
 		version = CACHE_LOOSE;
-		P9_DPRINTK(P9_DEBUG_9P, "Cache mode: loose\n");
+		p9_debug(P9_DEBUG_9P, "Cache mode: loose\n");
 	} else if (!strcmp(s, "fscache")) {
 		version = CACHE_FSCACHE;
-		P9_DPRINTK(P9_DEBUG_9P, "Cache mode: fscache\n");
+		p9_debug(P9_DEBUG_9P, "Cache mode: fscache\n");
 	} else if (!strcmp(s, "none")) {
 		version = CACHE_NONE;
-		P9_DPRINTK(P9_DEBUG_9P, "Cache mode: none\n");
+		p9_debug(P9_DEBUG_9P, "Cache mode: none\n");
 	} else
-		printk(KERN_INFO "9p: Unknown Cache mode %s.\n", s);
+		pr_info("Unknown Cache mode %s\n", s);
 	return version;
 }
 
@@ -140,8 +142,8 @@  static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 		case Opt_debug:
 			r = match_int(&args[0], &option);
 			if (r < 0) {
-				P9_DPRINTK(P9_DEBUG_ERROR,
-					   "integer field, but no integer?\n");
+				p9_debug(P9_DEBUG_ERROR,
+					 "integer field, but no integer?\n");
 				ret = r;
 				continue;
 			}
@@ -154,8 +156,8 @@  static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 		case Opt_dfltuid:
 			r = match_int(&args[0], &option);
 			if (r < 0) {
-				P9_DPRINTK(P9_DEBUG_ERROR,
-					   "integer field, but no integer?\n");
+				p9_debug(P9_DEBUG_ERROR,
+					 "integer field, but no integer?\n");
 				ret = r;
 				continue;
 			}
@@ -164,8 +166,8 @@  static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 		case Opt_dfltgid:
 			r = match_int(&args[0], &option);
 			if (r < 0) {
-				P9_DPRINTK(P9_DEBUG_ERROR,
-					   "integer field, but no integer?\n");
+				p9_debug(P9_DEBUG_ERROR,
+					 "integer field, but no integer?\n");
 				ret = r;
 				continue;
 			}
@@ -174,8 +176,8 @@  static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 		case Opt_afid:
 			r = match_int(&args[0], &option);
 			if (r < 0) {
-				P9_DPRINTK(P9_DEBUG_ERROR,
-					   "integer field, but no integer?\n");
+				p9_debug(P9_DEBUG_ERROR,
+					 "integer field, but no integer?\n");
 				ret = r;
 				continue;
 			}
@@ -205,8 +207,8 @@  static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 			s = match_strdup(&args[0]);
 			if (!s) {
 				ret = -ENOMEM;
-				P9_DPRINTK(P9_DEBUG_ERROR,
-				  "problem allocating copy of cache arg\n");
+				p9_debug(P9_DEBUG_ERROR,
+					 "problem allocating copy of cache arg\n");
 				goto free_and_return;
 			}
 			ret = get_cache_mode(s);
@@ -223,8 +225,8 @@  static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 			s = match_strdup(&args[0]);
 			if (!s) {
 				ret = -ENOMEM;
-				P9_DPRINTK(P9_DEBUG_ERROR,
-				  "problem allocating copy of access arg\n");
+				p9_debug(P9_DEBUG_ERROR,
+					 "problem allocating copy of access arg\n");
 				goto free_and_return;
 			}
 
@@ -240,8 +242,8 @@  static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 				v9ses->uid = simple_strtoul(s, &e, 10);
 				if (*e != '\0') {
 					ret = -EINVAL;
-					printk(KERN_INFO "9p: Unknown access "
-							"argument %s.\n", s);
+					pr_info("Unknown access argument %s\n",
+						s);
 					kfree(s);
 					goto free_and_return;
 				}
@@ -254,9 +256,8 @@  static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
 #ifdef CONFIG_9P_FS_POSIX_ACL
 			v9ses->flags |= V9FS_POSIX_ACL;
 #else
-			P9_DPRINTK(P9_DEBUG_ERROR,
-					"Not defined CONFIG_9P_FS_POSIX_ACL. "
-					"Ignoring posixacl option\n");
+			p9_debug(P9_DEBUG_ERROR,
+				 "Not defined CONFIG_9P_FS_POSIX_ACL. Ignoring posixacl option\n");
 #endif
 			break;
 
@@ -318,7 +319,7 @@  struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
 	if (IS_ERR(v9ses->clnt)) {
 		retval = PTR_ERR(v9ses->clnt);
 		v9ses->clnt = NULL;
-		P9_DPRINTK(P9_DEBUG_ERROR, "problem initializing 9p client\n");
+		p9_debug(P9_DEBUG_ERROR, "problem initializing 9p client\n");
 		goto error;
 	}
 
@@ -371,7 +372,7 @@  struct p9_fid *v9fs_session_init(struct v9fs_session_info *v9ses,
 	if (IS_ERR(fid)) {
 		retval = PTR_ERR(fid);
 		fid = NULL;
-		P9_DPRINTK(P9_DEBUG_ERROR, "cannot attach\n");
+		p9_debug(P9_DEBUG_ERROR, "cannot attach\n");
 		goto error;
 	}
 
@@ -429,7 +430,7 @@  void v9fs_session_close(struct v9fs_session_info *v9ses)
  */
 
 void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
-	P9_DPRINTK(P9_DEBUG_ERROR, "cancel session %p\n", v9ses);
+	p9_debug(P9_DEBUG_ERROR, "cancel session %p\n", v9ses);
 	p9_client_disconnect(v9ses->clnt);
 }
 
@@ -442,7 +443,7 @@  void v9fs_session_cancel(struct v9fs_session_info *v9ses) {
 
 void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses)
 {
-	P9_DPRINTK(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses);
+	p9_debug(P9_DEBUG_ERROR, "begin cancel session %p\n", v9ses);
 	p9_client_begin_disconnect(v9ses->clnt);
 }
 
@@ -591,23 +592,23 @@  static void v9fs_cache_unregister(void)
 static int __init init_v9fs(void)
 {
 	int err;
-	printk(KERN_INFO "Installing v9fs 9p2000 file system support\n");
+	pr_info("Installing v9fs 9p2000 file system support\n");
 	/* TODO: Setup list of registered trasnport modules */
 	err = register_filesystem(&v9fs_fs_type);
 	if (err < 0) {
-		printk(KERN_ERR "Failed to register filesystem\n");
+		pr_err("Failed to register filesystem\n");
 		return err;
 	}
 
 	err = v9fs_cache_register();
 	if (err < 0) {
-		printk(KERN_ERR "Failed to register v9fs for caching\n");
+		pr_err("Failed to register v9fs for caching\n");
 		goto out_fs_unreg;
 	}
 
 	err = v9fs_sysfs_init();
 	if (err < 0) {
-		printk(KERN_ERR "Failed to register with sysfs\n");
+		pr_err("Failed to register with sysfs\n");
 		goto out_sysfs_cleanup;
 	}
 
@@ -637,6 +638,30 @@  static void __exit exit_v9fs(void)
 module_init(init_v9fs)
 module_exit(exit_v9fs)
 
+#ifdef CONFIG_NET_9P_DEBUG
+void _p9_debug(enum p9_debug_flags level, const char *func,
+	       const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	if ((p9_debug_level & level) != level)
+		return;
+
+	va_start(args, fmt);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+	if (level == P9_DEBUG_9P)
+		pr_notice("(%8.8d) %pV", task_pid_nr(current), &vaf);
+	else
+		pr_notice("-- %s (%d): %pV", func, task_pid_nr(current), &vaf);
+
+	va_end(args);
+}
+#endif
+
 MODULE_AUTHOR("Latchesar Ionkov <lucho@ionkov.net>");
 MODULE_AUTHOR("Eric Van Hensbergen <ericvh@gmail.com>");
 MODULE_AUTHOR("Ron Minnich <rminnich@lanl.gov>");
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 2524e4c..0ad61c6 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -56,7 +56,7 @@  static int v9fs_fid_readpage(struct p9_fid *fid, struct page *page)
 	struct inode *inode;
 
 	inode = page->mapping->host;
-	P9_DPRINTK(P9_DEBUG_VFS, "\n");
+	p9_debug(P9_DEBUG_VFS, "\n");
 
 	BUG_ON(!PageLocked(page));
 
@@ -116,14 +116,14 @@  static int v9fs_vfs_readpages(struct file *filp, struct address_space *mapping,
 	struct inode *inode;
 
 	inode = mapping->host;
-	P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, filp);
+	p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, filp);
 
 	ret = v9fs_readpages_from_fscache(inode, mapping, pages, &nr_pages);
 	if (ret == 0)
 		return ret;
 
 	ret = read_cache_pages(mapping, pages, (void *)v9fs_vfs_readpage, filp);
-	P9_DPRINTK(P9_DEBUG_VFS, "  = %d\n", ret);
+	p9_debug(P9_DEBUG_VFS, "  = %d\n", ret);
 	return ret;
 }
 
@@ -263,10 +263,9 @@  v9fs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
 	 * Now that we do caching with cache mode enabled, We need
 	 * to support direct IO
 	 */
-	P9_DPRINTK(P9_DEBUG_VFS, "v9fs_direct_IO: v9fs_direct_IO (%s) "
-			"off/no(%lld/%lu) EINVAL\n",
-			iocb->ki_filp->f_path.dentry->d_name.name,
-			(long long) pos, nr_segs);
+	p9_debug(P9_DEBUG_VFS, "v9fs_direct_IO: v9fs_direct_IO (%s) off/no(%lld/%lu) EINVAL\n",
+		 iocb->ki_filp->f_path.dentry->d_name.name,
+		 (long long)pos, nr_segs);
 
 	return -EINVAL;
 }
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c
index e022890..d529437 100644
--- a/fs/9p/vfs_dentry.c
+++ b/fs/9p/vfs_dentry.c
@@ -53,8 +53,8 @@ 
 
 static int v9fs_dentry_delete(const struct dentry *dentry)
 {
-	P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name,
-									dentry);
+	p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
+		 dentry->d_name.name, dentry);
 
 	return 1;
 }
@@ -66,8 +66,8 @@  static int v9fs_dentry_delete(const struct dentry *dentry)
  */
 static int v9fs_cached_dentry_delete(const struct dentry *dentry)
 {
-	P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n",
-		   dentry->d_name.name, dentry);
+	p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
+		 dentry->d_name.name, dentry);
 
 	/* Don't cache negative dentries */
 	if (!dentry->d_inode)
@@ -86,8 +86,8 @@  static void v9fs_dentry_release(struct dentry *dentry)
 	struct v9fs_dentry *dent;
 	struct p9_fid *temp, *current_fid;
 
-	P9_DPRINTK(P9_DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_name.name,
-									dentry);
+	p9_debug(P9_DEBUG_VFS, " dentry: %s (%p)\n",
+		 dentry->d_name.name, dentry);
 	dent = dentry->d_fsdata;
 	if (dent) {
 		list_for_each_entry_safe(current_fid, temp, &dent->fidlist,
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 598fff1..ff911e7 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -140,7 +140,7 @@  static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
 	int reclen = 0;
 	struct p9_rdir *rdir;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
 	fid = filp->private_data;
 
 	buflen = fid->clnt->msize - P9_IOHDRSZ;
@@ -168,7 +168,7 @@  static int v9fs_dir_readdir(struct file *filp, void *dirent, filldir_t filldir)
 			err = p9stat_read(fid->clnt, rdir->buf + rdir->head,
 					  rdir->tail - rdir->head, &st);
 			if (err) {
-				P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err);
+				p9_debug(P9_DEBUG_VFS, "returned %d\n", err);
 				err = -EIO;
 				p9stat_free(&st);
 				goto unlock_and_exit;
@@ -213,7 +213,7 @@  static int v9fs_dir_readdir_dotl(struct file *filp, void *dirent,
 	struct p9_dirent curdirent;
 	u64 oldoffset = 0;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "name %s\n", filp->f_path.dentry->d_name.name);
 	fid = filp->private_data;
 
 	buflen = fid->clnt->msize - P9_READDIRHDRSZ;
@@ -244,7 +244,7 @@  static int v9fs_dir_readdir_dotl(struct file *filp, void *dirent,
 					    rdir->tail - rdir->head,
 					    &curdirent);
 			if (err < 0) {
-				P9_DPRINTK(P9_DEBUG_VFS, "returned %d\n", err);
+				p9_debug(P9_DEBUG_VFS, "returned %d\n", err);
 				err = -EIO;
 				goto unlock_and_exit;
 			}
@@ -290,9 +290,8 @@  int v9fs_dir_release(struct inode *inode, struct file *filp)
 	struct p9_fid *fid;
 
 	fid = filp->private_data;
-	P9_DPRINTK(P9_DEBUG_VFS,
-			"v9fs_dir_release: inode: %p filp: %p fid: %d\n",
-			inode, filp, fid ? fid->fid : -1);
+	p9_debug(P9_DEBUG_VFS, "inode: %p filp: %p fid: %d\n",
+		 inode, filp, fid ? fid->fid : -1);
 	if (fid)
 		p9_client_clunk(fid);
 	return 0;
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 62857a8..8947f9f 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -61,7 +61,7 @@  int v9fs_file_open(struct inode *inode, struct file *file)
 	struct p9_fid *fid;
 	int omode;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
+	p9_debug(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
 	v9inode = V9FS_I(inode);
 	v9ses = v9fs_inode2v9ses(inode);
 	if (v9fs_proto_dotl(v9ses))
@@ -135,7 +135,7 @@  static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
 	int res = 0;
 	struct inode *inode = filp->f_path.dentry->d_inode;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
+	p9_debug(P9_DEBUG_VFS, "filp: %p lock: %p\n", filp, fl);
 
 	/* No mandatory locks */
 	if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
@@ -304,8 +304,8 @@  static int v9fs_file_lock_dotl(struct file *filp, int cmd, struct file_lock *fl)
 	struct inode *inode = filp->f_path.dentry->d_inode;
 	int ret = -ENOLCK;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", filp,
-				cmd, fl, filp->f_path.dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
+		 filp, cmd, fl, filp->f_path.dentry->d_name.name);
 
 	/* No mandatory locks */
 	if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
@@ -340,8 +340,8 @@  static int v9fs_file_flock_dotl(struct file *filp, int cmd,
 	struct inode *inode = filp->f_path.dentry->d_inode;
 	int ret = -ENOLCK;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n", filp,
-				cmd, fl, filp->f_path.dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "filp: %p cmd:%d lock: %p name: %s\n",
+		 filp, cmd, fl, filp->f_path.dentry->d_name.name);
 
 	/* No mandatory locks */
 	if (__mandatory_lock(inode) && fl->fl_type != F_UNLCK)
@@ -384,8 +384,8 @@  v9fs_fid_readn(struct p9_fid *fid, char *data, char __user *udata, u32 count,
 {
 	int n, total, size;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "fid %d offset %llu count %d\n", fid->fid,
-		   (long long unsigned) offset, count);
+	p9_debug(P9_DEBUG_VFS, "fid %d offset %llu count %d\n",
+		 fid->fid, (long long unsigned)offset, count);
 	n = 0;
 	total = 0;
 	size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ;
@@ -443,7 +443,7 @@  v9fs_file_read(struct file *filp, char __user *udata, size_t count,
 	struct p9_fid *fid;
 	size_t size;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset);
+	p9_debug(P9_DEBUG_VFS, "count %zu offset %lld\n", count, *offset);
 	fid = filp->private_data;
 
 	size = fid->iounit ? fid->iounit : fid->clnt->msize - P9_IOHDRSZ;
@@ -470,8 +470,8 @@  v9fs_file_write_internal(struct inode *inode, struct p9_fid *fid,
 	loff_t origin = *offset;
 	unsigned long pg_start, pg_end;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "data %p count %d offset %x\n", data,
-		(int)count, (int)*offset);
+	p9_debug(P9_DEBUG_VFS, "data %p count %d offset %x\n",
+		 data, (int)count, (int)*offset);
 
 	clnt = fid->clnt;
 	do {
@@ -552,7 +552,7 @@  static int v9fs_file_fsync(struct file *filp, loff_t start, loff_t end,
 		return retval;
 
 	mutex_lock(&inode->i_mutex);
-	P9_DPRINTK(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
+	p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
 
 	fid = filp->private_data;
 	v9fs_blank_wstat(&wstat);
@@ -575,8 +575,7 @@  int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end,
 		return retval;
 
 	mutex_lock(&inode->i_mutex);
-	P9_DPRINTK(P9_DEBUG_VFS, "v9fs_file_fsync_dotl: filp %p datasync %x\n",
-			filp, datasync);
+	p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync);
 
 	fid = filp->private_data;
 
@@ -607,8 +606,8 @@  v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
 	struct inode *inode = filp->f_path.dentry->d_inode;
 
 
-	P9_DPRINTK(P9_DEBUG_VFS, "page %p fid %lx\n",
-		   page, (unsigned long)filp->private_data);
+	p9_debug(P9_DEBUG_VFS, "page %p fid %lx\n",
+		 page, (unsigned long)filp->private_data);
 
 	v9inode = V9FS_I(inode);
 	/* make sure the cache has finished storing the page */
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 879ed88..85c2973 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -23,6 +23,8 @@ 
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
@@ -133,9 +135,8 @@  static int p9mode2unixmode(struct v9fs_session_info *v9ses,
 			res |= S_IFBLK;
 			break;
 		default:
-			P9_DPRINTK(P9_DEBUG_ERROR,
-				"Unknown special type %c %s\n", type,
-				stat->extension);
+			p9_debug(P9_DEBUG_ERROR, "Unknown special type %c %s\n",
+				 type, stat->extension);
 		};
 		*rdev = MKDEV(major, minor);
 	} else
@@ -281,8 +282,8 @@  int v9fs_init_inode(struct v9fs_session_info *v9ses,
 		} else if (v9fs_proto_dotu(v9ses)) {
 			inode->i_op = &v9fs_file_inode_operations;
 		} else {
-			P9_DPRINTK(P9_DEBUG_ERROR,
-				   "special files without extended mode\n");
+			p9_debug(P9_DEBUG_ERROR,
+				 "special files without extended mode\n");
 			err = -EINVAL;
 			goto error;
 		}
@@ -307,8 +308,8 @@  int v9fs_init_inode(struct v9fs_session_info *v9ses,
 		break;
 	case S_IFLNK:
 		if (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)) {
-			P9_DPRINTK(P9_DEBUG_ERROR, "extended modes used with "
-						"legacy protocol.\n");
+			p9_debug(P9_DEBUG_ERROR,
+				 "extended modes used with legacy protocol\n");
 			err = -EINVAL;
 			goto error;
 		}
@@ -335,8 +336,8 @@  int v9fs_init_inode(struct v9fs_session_info *v9ses,
 
 		break;
 	default:
-		P9_DPRINTK(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n",
-			   mode, mode & S_IFMT);
+		p9_debug(P9_DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n",
+			 mode, mode & S_IFMT);
 		err = -EINVAL;
 		goto error;
 	}
@@ -358,11 +359,12 @@  struct inode *v9fs_get_inode(struct super_block *sb, int mode, dev_t rdev)
 	struct inode *inode;
 	struct v9fs_session_info *v9ses = sb->s_fs_info;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode);
+	p9_debug(P9_DEBUG_VFS, "super block: %p mode: %o\n", sb, mode);
 
 	inode = new_inode(sb);
 	if (!inode) {
-		P9_EPRINTK(KERN_WARNING, "Problem allocating inode\n");
+		pr_warn("%s (%d): Problem allocating inode\n",
+			__func__, task_pid_nr(current));
 		return ERR_PTR(-ENOMEM);
 	}
 	err = v9fs_init_inode(v9ses, inode, mode, rdev);
@@ -578,15 +580,15 @@  static int v9fs_remove(struct inode *dir, struct dentry *dentry, int flags)
 	struct p9_fid *v9fid, *dfid;
 	struct v9fs_session_info *v9ses;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n",
-		   dir, dentry, flags);
+	p9_debug(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %x\n",
+		 dir, dentry, flags);
 
 	v9ses = v9fs_inode2v9ses(dir);
 	inode = dentry->d_inode;
 	dfid = v9fs_fid_lookup(dentry->d_parent);
 	if (IS_ERR(dfid)) {
 		retval = PTR_ERR(dfid);
-		P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", retval);
+		p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", retval);
 		return retval;
 	}
 	if (v9fs_proto_dotl(v9ses))
@@ -635,7 +637,7 @@  v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
 	struct p9_fid *dfid, *ofid, *fid;
 	struct inode *inode;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
 
 	err = 0;
 	ofid = NULL;
@@ -644,7 +646,7 @@  v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
 	dfid = v9fs_fid_lookup(dentry->d_parent);
 	if (IS_ERR(dfid)) {
 		err = PTR_ERR(dfid);
-		P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
 		return ERR_PTR(err);
 	}
 
@@ -652,13 +654,13 @@  v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
 	ofid = p9_client_walk(dfid, 0, NULL, 1);
 	if (IS_ERR(ofid)) {
 		err = PTR_ERR(ofid);
-		P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
 		return ERR_PTR(err);
 	}
 
 	err = p9_client_fcreate(ofid, name, perm, mode, extension);
 	if (err < 0) {
-		P9_DPRINTK(P9_DEBUG_VFS, "p9_client_fcreate failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "p9_client_fcreate failed %d\n", err);
 		goto error;
 	}
 
@@ -666,7 +668,7 @@  v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
 	fid = p9_client_walk(dfid, 1, &name, 1);
 	if (IS_ERR(fid)) {
 		err = PTR_ERR(fid);
-		P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
 		fid = NULL;
 		goto error;
 	}
@@ -675,7 +677,7 @@  v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
 	inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);
-		P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
 		goto error;
 	}
 	err = v9fs_fid_add(dentry, fid);
@@ -793,7 +795,7 @@  static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 	struct p9_fid *fid;
 	struct v9fs_session_info *v9ses;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
 	err = 0;
 	v9ses = v9fs_inode2v9ses(dir);
 	perm = unixmode2p9mode(v9ses, mode | S_IFDIR);
@@ -831,8 +833,8 @@  struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
 	char *name;
 	int result = 0;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n",
-		dir, dentry->d_name.name, dentry, nameidata);
+	p9_debug(P9_DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n",
+		 dir, dentry->d_name.name, dentry, nameidata);
 
 	if (dentry->d_name.len > NAME_MAX)
 		return ERR_PTR(-ENAMETOOLONG);
@@ -938,7 +940,7 @@  v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	struct p9_fid *newdirfid;
 	struct p9_wstat wstat;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "\n");
+	p9_debug(P9_DEBUG_VFS, "\n");
 	retval = 0;
 	old_inode = old_dentry->d_inode;
 	new_inode = new_dentry->d_inode;
@@ -974,8 +976,7 @@  v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		 * 9P .u can only handle file rename in the same directory
 		 */
 
-		P9_DPRINTK(P9_DEBUG_ERROR,
-				"old dir and new dir are different\n");
+		p9_debug(P9_DEBUG_ERROR, "old dir and new dir are different\n");
 		retval = -EXDEV;
 		goto clunk_newdir;
 	}
@@ -1031,7 +1032,7 @@  v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
 	struct p9_fid *fid;
 	struct p9_wstat *st;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry);
+	p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
 	err = -EPERM;
 	v9ses = v9fs_dentry2v9ses(dentry);
 	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
@@ -1068,7 +1069,7 @@  static int v9fs_vfs_setattr(struct dentry *dentry, struct iattr *iattr)
 	struct p9_fid *fid;
 	struct p9_wstat wstat;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "\n");
+	p9_debug(P9_DEBUG_VFS, "\n");
 	retval = inode_change_ok(dentry->d_inode, iattr);
 	if (retval)
 		return retval;
@@ -1213,7 +1214,7 @@  static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
 	struct p9_fid *fid;
 	struct p9_wstat *st;
 
-	P9_DPRINTK(P9_DEBUG_VFS, " %s\n", dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, " %s\n", dentry->d_name.name);
 	retval = -EPERM;
 	v9ses = v9fs_dentry2v9ses(dentry);
 	fid = v9fs_fid_lookup(dentry);
@@ -1235,8 +1236,8 @@  static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
 	/* copy extension buffer into buffer */
 	strncpy(buffer, st->extension, buflen);
 
-	P9_DPRINTK(P9_DEBUG_VFS,
-		"%s -> %s (%s)\n", dentry->d_name.name, st->extension, buffer);
+	p9_debug(P9_DEBUG_VFS, "%s -> %s (%s)\n",
+		 dentry->d_name.name, st->extension, buffer);
 
 	retval = strnlen(buffer, buflen);
 done:
@@ -1257,7 +1258,7 @@  static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 	int len = 0;
 	char *link = __getname();
 
-	P9_DPRINTK(P9_DEBUG_VFS, "%s n", dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
 
 	if (!link)
 		link = ERR_PTR(-ENOMEM);
@@ -1288,8 +1289,8 @@  v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
 {
 	char *s = nd_get_link(nd);
 
-	P9_DPRINTK(P9_DEBUG_VFS, " %s %s\n", dentry->d_name.name,
-		IS_ERR(s) ? "<error>" : s);
+	p9_debug(P9_DEBUG_VFS, " %s %s\n",
+		 dentry->d_name.name, IS_ERR(s) ? "<error>" : s);
 	if (!IS_ERR(s))
 		__putname(s);
 }
@@ -1312,7 +1313,7 @@  static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
 
 	v9ses = v9fs_inode2v9ses(dir);
 	if (!v9fs_proto_dotu(v9ses)) {
-		P9_DPRINTK(P9_DEBUG_ERROR, "not extended\n");
+		p9_debug(P9_DEBUG_ERROR, "not extended\n");
 		return -EPERM;
 	}
 
@@ -1340,8 +1341,8 @@  static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
 static int
 v9fs_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
 {
-	P9_DPRINTK(P9_DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino,
-					dentry->d_name.name, symname);
+	p9_debug(P9_DEBUG_VFS, " %lu,%s,%s\n",
+		 dir->i_ino, dentry->d_name.name, symname);
 
 	return v9fs_vfs_mkspecial(dir, dentry, S_IFLNK, symname);
 }
@@ -1362,9 +1363,8 @@  v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
 	char *name;
 	struct p9_fid *oldfid;
 
-	P9_DPRINTK(P9_DEBUG_VFS,
-		" %lu,%s,%s\n", dir->i_ino, dentry->d_name.name,
-		old_dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, " %lu,%s,%s\n",
+		 dir->i_ino, dentry->d_name.name, old_dentry->d_name.name);
 
 	oldfid = v9fs_fid_clone(old_dentry);
 	if (IS_ERR(oldfid))
@@ -1403,9 +1403,9 @@  v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
 	int retval;
 	char *name;
 
-	P9_DPRINTK(P9_DEBUG_VFS,
-		" %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino,
-		dentry->d_name.name, mode, MAJOR(rdev), MINOR(rdev));
+	p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %x MAJOR: %u MINOR: %u\n",
+		 dir->i_ino, dentry->d_name.name, mode,
+		 MAJOR(rdev), MINOR(rdev));
 
 	if (!new_valid_dev(rdev))
 		return -EINVAL;
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 0b5745e..73488fb 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -283,13 +283,13 @@  v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 	}
 
 	name = (char *) dentry->d_name.name;
-	P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x "
-			"mode:0x%x\n", name, flags, omode);
+	p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%x\n",
+		 name, flags, omode);
 
 	dfid = v9fs_fid_lookup(dentry->d_parent);
 	if (IS_ERR(dfid)) {
 		err = PTR_ERR(dfid);
-		P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
 		return err;
 	}
 
@@ -297,7 +297,7 @@  v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 	ofid = p9_client_walk(dfid, 0, NULL, 1);
 	if (IS_ERR(ofid)) {
 		err = PTR_ERR(ofid);
-		P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
 		return err;
 	}
 
@@ -307,16 +307,15 @@  v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 	/* Update mode based on ACL value */
 	err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
 	if (err) {
-		P9_DPRINTK(P9_DEBUG_VFS,
-			   "Failed to get acl values in creat %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "Failed to get acl values in creat %d\n",
+			 err);
 		goto error;
 	}
 	err = p9_client_create_dotl(ofid, name, v9fs_open_to_dotl_flags(flags),
 				    mode, gid, &qid);
 	if (err < 0) {
-		P9_DPRINTK(P9_DEBUG_VFS,
-				"p9_client_open_dotl failed in creat %d\n",
-				err);
+		p9_debug(P9_DEBUG_VFS, "p9_client_open_dotl failed in creat %d\n",
+			 err);
 		goto error;
 	}
 	v9fs_invalidate_inode_attr(dir);
@@ -325,14 +324,14 @@  v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 	fid = p9_client_walk(dfid, 1, &name, 1);
 	if (IS_ERR(fid)) {
 		err = PTR_ERR(fid);
-		P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n", err);
 		fid = NULL;
 		goto error;
 	}
 	inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
 	if (IS_ERR(inode)) {
 		err = PTR_ERR(inode);
-		P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", err);
 		goto error;
 	}
 	err = v9fs_fid_add(dentry, fid);
@@ -408,7 +407,7 @@  static int v9fs_vfs_mkdir_dotl(struct inode *dir,
 	struct dentry *dir_dentry;
 	struct posix_acl *dacl = NULL, *pacl = NULL;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
 	err = 0;
 	v9ses = v9fs_inode2v9ses(dir);
 
@@ -420,7 +419,7 @@  static int v9fs_vfs_mkdir_dotl(struct inode *dir,
 	dfid = v9fs_fid_lookup(dir_dentry);
 	if (IS_ERR(dfid)) {
 		err = PTR_ERR(dfid);
-		P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
 		dfid = NULL;
 		goto error;
 	}
@@ -430,8 +429,8 @@  static int v9fs_vfs_mkdir_dotl(struct inode *dir,
 	/* Update mode based on ACL value */
 	err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
 	if (err) {
-		P9_DPRINTK(P9_DEBUG_VFS,
-			   "Failed to get acl values in mkdir %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mkdir %d\n",
+			 err);
 		goto error;
 	}
 	name = (char *) dentry->d_name.name;
@@ -444,8 +443,8 @@  static int v9fs_vfs_mkdir_dotl(struct inode *dir,
 		fid = p9_client_walk(dfid, 1, &name, 1);
 		if (IS_ERR(fid)) {
 			err = PTR_ERR(fid);
-			P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
-				err);
+			p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
+				 err);
 			fid = NULL;
 			goto error;
 		}
@@ -453,8 +452,8 @@  static int v9fs_vfs_mkdir_dotl(struct inode *dir,
 		inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
 		if (IS_ERR(inode)) {
 			err = PTR_ERR(inode);
-			P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
-				err);
+			p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
+				 err);
 			goto error;
 		}
 		err = v9fs_fid_add(dentry, fid);
@@ -495,7 +494,7 @@  v9fs_vfs_getattr_dotl(struct vfsmount *mnt, struct dentry *dentry,
 	struct p9_fid *fid;
 	struct p9_stat_dotl *st;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "dentry: %p\n", dentry);
+	p9_debug(P9_DEBUG_VFS, "dentry: %p\n", dentry);
 	err = -EPERM;
 	v9ses = v9fs_dentry2v9ses(dentry);
 	if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
@@ -537,7 +536,7 @@  int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
 	struct p9_fid *fid;
 	struct p9_iattr_dotl p9attr;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "\n");
+	p9_debug(P9_DEBUG_VFS, "\n");
 
 	retval = inode_change_ok(dentry->d_inode, iattr);
 	if (retval)
@@ -670,14 +669,13 @@  v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
 	struct v9fs_session_info *v9ses;
 
 	name = (char *) dentry->d_name.name;
-	P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_symlink_dotl : %lu,%s,%s\n",
-			dir->i_ino, name, symname);
+	p9_debug(P9_DEBUG_VFS, "%lu,%s,%s\n", dir->i_ino, name, symname);
 	v9ses = v9fs_inode2v9ses(dir);
 
 	dfid = v9fs_fid_lookup(dentry->d_parent);
 	if (IS_ERR(dfid)) {
 		err = PTR_ERR(dfid);
-		P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
 		return err;
 	}
 
@@ -687,7 +685,7 @@  v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
 	err = p9_client_symlink(dfid, name, (char *)symname, gid, &qid);
 
 	if (err < 0) {
-		P9_DPRINTK(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "p9_client_symlink failed %d\n", err);
 		goto error;
 	}
 
@@ -697,8 +695,8 @@  v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
 		fid = p9_client_walk(dfid, 1, &name, 1);
 		if (IS_ERR(fid)) {
 			err = PTR_ERR(fid);
-			P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
-					err);
+			p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
+				 err);
 			fid = NULL;
 			goto error;
 		}
@@ -707,8 +705,8 @@  v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
 		inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
 		if (IS_ERR(inode)) {
 			err = PTR_ERR(inode);
-			P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
-					err);
+			p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
+				 err);
 			goto error;
 		}
 		err = v9fs_fid_add(dentry, fid);
@@ -751,9 +749,8 @@  v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
 	struct p9_fid *dfid, *oldfid;
 	struct v9fs_session_info *v9ses;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
-			dir->i_ino, old_dentry->d_name.name,
-			dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
+		 dir->i_ino, old_dentry->d_name.name, dentry->d_name.name);
 
 	v9ses = v9fs_inode2v9ses(dir);
 	dir_dentry = v9fs_dentry_from_dir_inode(dir);
@@ -770,7 +767,7 @@  v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
 	err = p9_client_link(dfid, oldfid, (char *)dentry->d_name.name);
 
 	if (err < 0) {
-		P9_DPRINTK(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "p9_client_link failed %d\n", err);
 		return err;
 	}
 
@@ -813,9 +810,9 @@  v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
 	struct dentry *dir_dentry;
 	struct posix_acl *dacl = NULL, *pacl = NULL;
 
-	P9_DPRINTK(P9_DEBUG_VFS,
-		" %lu,%s mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino,
-		dentry->d_name.name, omode, MAJOR(rdev), MINOR(rdev));
+	p9_debug(P9_DEBUG_VFS, " %lu,%s mode: %x MAJOR: %u MINOR: %u\n",
+		 dir->i_ino, dentry->d_name.name, omode,
+		 MAJOR(rdev), MINOR(rdev));
 
 	if (!new_valid_dev(rdev))
 		return -EINVAL;
@@ -825,7 +822,7 @@  v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
 	dfid = v9fs_fid_lookup(dir_dentry);
 	if (IS_ERR(dfid)) {
 		err = PTR_ERR(dfid);
-		P9_DPRINTK(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "fid lookup failed %d\n", err);
 		dfid = NULL;
 		goto error;
 	}
@@ -835,8 +832,8 @@  v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
 	/* Update mode based on ACL value */
 	err = v9fs_acl_mode(dir, &mode, &dacl, &pacl);
 	if (err) {
-		P9_DPRINTK(P9_DEBUG_VFS,
-			   "Failed to get acl values in mknod %d\n", err);
+		p9_debug(P9_DEBUG_VFS, "Failed to get acl values in mknod %d\n",
+			 err);
 		goto error;
 	}
 	name = (char *) dentry->d_name.name;
@@ -851,8 +848,8 @@  v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
 		fid = p9_client_walk(dfid, 1, &name, 1);
 		if (IS_ERR(fid)) {
 			err = PTR_ERR(fid);
-			P9_DPRINTK(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
-				err);
+			p9_debug(P9_DEBUG_VFS, "p9_client_walk failed %d\n",
+				 err);
 			fid = NULL;
 			goto error;
 		}
@@ -860,8 +857,8 @@  v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
 		inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb);
 		if (IS_ERR(inode)) {
 			err = PTR_ERR(inode);
-			P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n",
-				err);
+			p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n",
+				 err);
 			goto error;
 		}
 		err = v9fs_fid_add(dentry, fid);
@@ -905,7 +902,7 @@  v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct nameidata *nd)
 	char *link = __getname();
 	char *target;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
+	p9_debug(P9_DEBUG_VFS, "%s\n", dentry->d_name.name);
 
 	if (!link) {
 		link = ERR_PTR(-ENOMEM);
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index c70251d..06d19735 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -121,7 +121,7 @@  static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
 	struct p9_fid *fid;
 	int retval = 0;
 
-	P9_DPRINTK(P9_DEBUG_VFS, " \n");
+	p9_debug(P9_DEBUG_VFS, "\n");
 
 	v9ses = kzalloc(sizeof(struct v9fs_session_info), GFP_KERNEL);
 	if (!v9ses)
@@ -191,7 +191,7 @@  static struct dentry *v9fs_mount(struct file_system_type *fs_type, int flags,
 		goto release_sb;
 	v9fs_fid_add(root, fid);
 
-	P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n");
+	p9_debug(P9_DEBUG_VFS, " simple set mount, return 0\n");
 	return dget(sb->s_root);
 
 clunk_fid:
@@ -223,7 +223,7 @@  static void v9fs_kill_super(struct super_block *s)
 {
 	struct v9fs_session_info *v9ses = s->s_fs_info;
 
-	P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s);
+	p9_debug(P9_DEBUG_VFS, " %p\n", s);
 
 	kill_anon_super(s);
 
@@ -231,7 +231,7 @@  static void v9fs_kill_super(struct super_block *s)
 	v9fs_session_close(v9ses);
 	kfree(v9ses);
 	s->s_fs_info = NULL;
-	P9_DPRINTK(P9_DEBUG_VFS, "exiting kill_super\n");
+	p9_debug(P9_DEBUG_VFS, "exiting kill_super\n");
 }
 
 static void
@@ -303,7 +303,7 @@  static int v9fs_write_inode(struct inode *inode,
 	 * send an fsync request to server irrespective of
 	 * wbc->sync_mode.
 	 */
-	P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
+	p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
 	v9inode = V9FS_I(inode);
 	if (!v9inode->writeback_fid)
 		return 0;
@@ -326,7 +326,7 @@  static int v9fs_write_inode_dotl(struct inode *inode,
 	 * send an fsync request to server irrespective of
 	 * wbc->sync_mode.
 	 */
-	P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
+	p9_debug(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode);
 	v9inode = V9FS_I(inode);
 	if (!v9inode->writeback_fid)
 		return 0;
diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
index d288773..29653b7 100644
--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -32,8 +32,8 @@  ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,
 	attr_fid = p9_client_xattrwalk(fid, name, &attr_size);
 	if (IS_ERR(attr_fid)) {
 		retval = PTR_ERR(attr_fid);
-		P9_DPRINTK(P9_DEBUG_VFS,
-			"p9_client_attrwalk failed %zd\n", retval);
+		p9_debug(P9_DEBUG_VFS, "p9_client_attrwalk failed %zd\n",
+			 retval);
 		attr_fid = NULL;
 		goto error;
 	}
@@ -87,8 +87,8 @@  ssize_t v9fs_xattr_get(struct dentry *dentry, const char *name,
 {
 	struct p9_fid *fid;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "%s: name = %s value_len = %zu\n",
-		__func__, name, buffer_size);
+	p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu\n",
+		 name, buffer_size);
 	fid = v9fs_fid_lookup(dentry);
 	if (IS_ERR(fid))
 		return PTR_ERR(fid);
@@ -115,8 +115,8 @@  int v9fs_xattr_set(struct dentry *dentry, const char *name,
 	int retval, msize, write_count;
 	struct p9_fid *fid = NULL;
 
-	P9_DPRINTK(P9_DEBUG_VFS, "%s: name = %s value_len = %zu flags = %d\n",
-		__func__, name, value_len, flags);
+	p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu flags = %d\n",
+		 name, value_len, flags);
 
 	fid = v9fs_fid_clone(dentry);
 	if (IS_ERR(fid)) {
@@ -129,8 +129,8 @@  int v9fs_xattr_set(struct dentry *dentry, const char *name,
 	 */
 	retval = p9_client_xattrcreate(fid, name, value_len, flags);
 	if (retval < 0) {
-		P9_DPRINTK(P9_DEBUG_VFS,
-			"p9_client_xattrcreate failed %d\n", retval);
+		p9_debug(P9_DEBUG_VFS, "p9_client_xattrcreate failed %d\n",
+			 retval);
 		goto error;
 	}
 	msize = fid->clnt->msize;
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 2d70b95..7184853 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -63,30 +63,16 @@  enum p9_debug_flags {
 
 #ifdef CONFIG_NET_9P_DEBUG
 extern unsigned int p9_debug_level;
-
-#define P9_DPRINTK(level, format, arg...) \
-do {  \
-	if ((p9_debug_level & level) == level) {\
-		if (level == P9_DEBUG_9P) \
-			printk(KERN_NOTICE "(%8.8d) " \
-			format , task_pid_nr(current) , ## arg); \
-		else \
-			printk(KERN_NOTICE "-- %s (%d): " \
-			format , __func__, task_pid_nr(current) , ## arg); \
-	} \
-} while (0)
-
+__printf(3, 4)
+void _p9_debug(enum p9_debug_flags level, const char *func,
+	       const char *fmt, ...);
+#define p9_debug(level, fmt, ...)			\
+	_p9_debug(level, __func__, fmt, ##__VA_ARGS__)
 #else
-#define P9_DPRINTK(level, format, arg...)  do { } while (0)
+#define p9_debug(level, fmt, ...)			\
+	no_printk(fmt, ##__VA_ARGS__)
 #endif
 
-
-#define P9_EPRINTK(level, format, arg...) \
-do { \
-	printk(level "9p: %s (%d): " \
-		format , __func__, task_pid_nr(current), ## arg); \
-} while (0)
-
 /**
  * enum p9_msg_t - 9P message types
  * @P9_TLERROR: not used