提交 caf4167a 编写于 作者: K Kent Overstreet 提交者: Linus Torvalds

aio: dprintk() -> pr_debug()

Signed-off-by: NKent Overstreet <koverstreet@google.com>
Cc: Zach Brown <zab@redhat.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: Selvan Mani <smani@micron.com>
Cc: Sam Bradshaw <sbradshaw@micron.com>
Acked-by: NJeff Moyer <jmoyer@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 4e179bca
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
* *
* See ../COPYING for licensing terms. * See ../COPYING for licensing terms.
*/ */
#define pr_fmt(fmt) "%s: " fmt, __func__
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -18,8 +20,6 @@ ...@@ -18,8 +20,6 @@
#include <linux/backing-dev.h> #include <linux/backing-dev.h>
#include <linux/uio.h> #include <linux/uio.h>
#define DEBUG 0
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/file.h> #include <linux/file.h>
...@@ -39,12 +39,6 @@ ...@@ -39,12 +39,6 @@
#include <asm/kmap_types.h> #include <asm/kmap_types.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#if DEBUG > 1
#define dprintk printk
#else
#define dprintk(x...) do { ; } while (0)
#endif
#define AIO_RING_MAGIC 0xa10a10a1 #define AIO_RING_MAGIC 0xa10a10a1
#define AIO_RING_COMPAT_FEATURES 1 #define AIO_RING_COMPAT_FEATURES 1
#define AIO_RING_INCOMPAT_FEATURES 0 #define AIO_RING_INCOMPAT_FEATURES 0
...@@ -124,7 +118,7 @@ static int __init aio_setup(void) ...@@ -124,7 +118,7 @@ static int __init aio_setup(void)
kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC); kiocb_cachep = KMEM_CACHE(kiocb, SLAB_HWCACHE_ALIGN|SLAB_PANIC);
kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC); kioctx_cachep = KMEM_CACHE(kioctx,SLAB_HWCACHE_ALIGN|SLAB_PANIC);
pr_debug("aio_setup: sizeof(struct page) = %d\n", (int)sizeof(struct page)); pr_debug("sizeof(struct page) = %zu\n", sizeof(struct page));
return 0; return 0;
} }
...@@ -178,7 +172,7 @@ static int aio_setup_ring(struct kioctx *ctx) ...@@ -178,7 +172,7 @@ static int aio_setup_ring(struct kioctx *ctx)
} }
info->mmap_size = nr_pages * PAGE_SIZE; info->mmap_size = nr_pages * PAGE_SIZE;
dprintk("attempting mmap of %lu bytes\n", info->mmap_size); pr_debug("attempting mmap of %lu bytes\n", info->mmap_size);
down_write(&mm->mmap_sem); down_write(&mm->mmap_sem);
info->mmap_base = do_mmap_pgoff(NULL, 0, info->mmap_size, info->mmap_base = do_mmap_pgoff(NULL, 0, info->mmap_size,
PROT_READ|PROT_WRITE, PROT_READ|PROT_WRITE,
...@@ -191,7 +185,7 @@ static int aio_setup_ring(struct kioctx *ctx) ...@@ -191,7 +185,7 @@ static int aio_setup_ring(struct kioctx *ctx)
return -EAGAIN; return -EAGAIN;
} }
dprintk("mmap address: 0x%08lx\n", info->mmap_base); pr_debug("mmap address: 0x%08lx\n", info->mmap_base);
info->nr_pages = get_user_pages(current, mm, info->mmap_base, nr_pages, info->nr_pages = get_user_pages(current, mm, info->mmap_base, nr_pages,
1, 0, info->ring_pages, NULL); 1, 0, info->ring_pages, NULL);
up_write(&mm->mmap_sem); up_write(&mm->mmap_sem);
...@@ -265,7 +259,7 @@ static void __put_ioctx(struct kioctx *ctx) ...@@ -265,7 +259,7 @@ static void __put_ioctx(struct kioctx *ctx)
aio_nr -= nr_events; aio_nr -= nr_events;
spin_unlock(&aio_nr_lock); spin_unlock(&aio_nr_lock);
} }
pr_debug("__put_ioctx: freeing %p\n", ctx); pr_debug("freeing %p\n", ctx);
call_rcu(&ctx->rcu_head, ctx_rcu_free); call_rcu(&ctx->rcu_head, ctx_rcu_free);
} }
...@@ -354,7 +348,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) ...@@ -354,7 +348,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
hlist_add_head_rcu(&ctx->list, &mm->ioctx_list); hlist_add_head_rcu(&ctx->list, &mm->ioctx_list);
spin_unlock(&mm->ioctx_lock); spin_unlock(&mm->ioctx_lock);
dprintk("aio: allocated ioctx %p[%ld]: mm=%p mask=0x%x\n", pr_debug("allocated ioctx %p[%ld]: mm=%p mask=0x%x\n",
ctx, ctx->user_id, mm, ctx->ring_info.nr); ctx, ctx->user_id, mm, ctx->ring_info.nr);
return ctx; return ctx;
...@@ -363,7 +357,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) ...@@ -363,7 +357,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
aio_free_ring(ctx); aio_free_ring(ctx);
out_freectx: out_freectx:
kmem_cache_free(kioctx_cachep, ctx); kmem_cache_free(kioctx_cachep, ctx);
dprintk("aio: error allocating ioctx %d\n", err); pr_debug("error allocating ioctx %d\n", err);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -611,8 +605,8 @@ static inline void really_put_req(struct kioctx *ctx, struct kiocb *req) ...@@ -611,8 +605,8 @@ static inline void really_put_req(struct kioctx *ctx, struct kiocb *req)
*/ */
static void __aio_put_req(struct kioctx *ctx, struct kiocb *req) static void __aio_put_req(struct kioctx *ctx, struct kiocb *req)
{ {
dprintk(KERN_DEBUG "aio_put(%p): f_count=%ld\n", pr_debug("(%p): f_count=%ld\n",
req, atomic_long_read(&req->ki_filp->f_count)); req, atomic_long_read(&req->ki_filp->f_count));
assert_spin_locked(&ctx->ctx_lock); assert_spin_locked(&ctx->ctx_lock);
...@@ -722,9 +716,9 @@ void aio_complete(struct kiocb *iocb, long res, long res2) ...@@ -722,9 +716,9 @@ void aio_complete(struct kiocb *iocb, long res, long res2)
event->res = res; event->res = res;
event->res2 = res2; event->res2 = res2;
dprintk("aio_complete: %p[%lu]: %p: %p %Lx %lx %lx\n", pr_debug("%p[%lu]: %p: %p %Lx %lx %lx\n",
ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data, ctx, tail, iocb, iocb->ki_obj.user, iocb->ki_user_data,
res, res2); res, res2);
/* after flagging the request as done, we /* after flagging the request as done, we
* must never even look at it again * must never even look at it again
...@@ -780,9 +774,7 @@ static int aio_read_evt(struct kioctx *ioctx, struct io_event *ent) ...@@ -780,9 +774,7 @@ static int aio_read_evt(struct kioctx *ioctx, struct io_event *ent)
int ret = 0; int ret = 0;
ring = kmap_atomic(info->ring_pages[0]); ring = kmap_atomic(info->ring_pages[0]);
dprintk("in aio_read_evt h%lu t%lu m%lu\n", pr_debug("h%u t%u m%u\n", ring->head, ring->tail, ring->nr);
(unsigned long)ring->head, (unsigned long)ring->tail,
(unsigned long)ring->nr);
if (ring->head == ring->tail) if (ring->head == ring->tail)
goto out; goto out;
...@@ -802,9 +794,8 @@ static int aio_read_evt(struct kioctx *ioctx, struct io_event *ent) ...@@ -802,9 +794,8 @@ static int aio_read_evt(struct kioctx *ioctx, struct io_event *ent)
spin_unlock(&info->ring_lock); spin_unlock(&info->ring_lock);
out: out:
dprintk("leaving aio_read_evt: %d h%lu t%lu\n", ret,
(unsigned long)ring->head, (unsigned long)ring->tail);
kunmap_atomic(ring); kunmap_atomic(ring);
pr_debug("%d h%u t%u\n", ret, ring->head, ring->tail);
return ret; return ret;
} }
...@@ -867,13 +858,13 @@ static int read_events(struct kioctx *ctx, ...@@ -867,13 +858,13 @@ static int read_events(struct kioctx *ctx,
if (unlikely(ret <= 0)) if (unlikely(ret <= 0))
break; break;
dprintk("read event: %Lx %Lx %Lx %Lx\n", pr_debug("%Lx %Lx %Lx %Lx\n",
ent.data, ent.obj, ent.res, ent.res2); ent.data, ent.obj, ent.res, ent.res2);
/* Could we split the check in two? */ /* Could we split the check in two? */
ret = -EFAULT; ret = -EFAULT;
if (unlikely(copy_to_user(event, &ent, sizeof(ent)))) { if (unlikely(copy_to_user(event, &ent, sizeof(ent)))) {
dprintk("aio: lost an event due to EFAULT.\n"); pr_debug("lost an event due to EFAULT.\n");
break; break;
} }
ret = 0; ret = 0;
...@@ -936,7 +927,7 @@ static int read_events(struct kioctx *ctx, ...@@ -936,7 +927,7 @@ static int read_events(struct kioctx *ctx,
ret = -EFAULT; ret = -EFAULT;
if (unlikely(copy_to_user(event, &ent, sizeof(ent)))) { if (unlikely(copy_to_user(event, &ent, sizeof(ent)))) {
dprintk("aio: lost an event due to EFAULT.\n"); pr_debug("lost an event due to EFAULT.\n");
break; break;
} }
...@@ -967,7 +958,7 @@ static void io_destroy(struct kioctx *ioctx) ...@@ -967,7 +958,7 @@ static void io_destroy(struct kioctx *ioctx)
hlist_del_rcu(&ioctx->list); hlist_del_rcu(&ioctx->list);
spin_unlock(&mm->ioctx_lock); spin_unlock(&mm->ioctx_lock);
dprintk("aio_release(%p)\n", ioctx); pr_debug("(%p)\n", ioctx);
if (likely(!was_dead)) if (likely(!was_dead))
put_ioctx(ioctx); /* twice for the list */ put_ioctx(ioctx); /* twice for the list */
...@@ -1264,7 +1255,7 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat) ...@@ -1264,7 +1255,7 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat)
kiocb->ki_retry = aio_fsync; kiocb->ki_retry = aio_fsync;
break; break;
default: default:
dprintk("EINVAL: io_submit: no operation provided\n"); pr_debug("EINVAL: no operation provided\n");
ret = -EINVAL; ret = -EINVAL;
} }
...@@ -1284,7 +1275,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, ...@@ -1284,7 +1275,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
/* enforce forwards compatibility on users */ /* enforce forwards compatibility on users */
if (unlikely(iocb->aio_reserved1 || iocb->aio_reserved2)) { if (unlikely(iocb->aio_reserved1 || iocb->aio_reserved2)) {
pr_debug("EINVAL: io_submit: reserve field set\n"); pr_debug("EINVAL: reserve field set\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1325,7 +1316,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, ...@@ -1325,7 +1316,7 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
ret = put_user(req->ki_key, &user_iocb->aio_key); ret = put_user(req->ki_key, &user_iocb->aio_key);
if (unlikely(ret)) { if (unlikely(ret)) {
dprintk("EFAULT: aio_key\n"); pr_debug("EFAULT: aio_key\n");
goto out_put_req; goto out_put_req;
} }
...@@ -1407,7 +1398,7 @@ long do_io_submit(aio_context_t ctx_id, long nr, ...@@ -1407,7 +1398,7 @@ long do_io_submit(aio_context_t ctx_id, long nr,
ctx = lookup_ioctx(ctx_id); ctx = lookup_ioctx(ctx_id);
if (unlikely(!ctx)) { if (unlikely(!ctx)) {
pr_debug("EINVAL: io_submit: invalid context id\n"); pr_debug("EINVAL: invalid context id\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册